[lkml]   [2001]   [Oct]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectSCSI tape load problem with Exabyte Drive

On 2.4.6 with st and AICXXXX driver, issuance of an MTLOAD command
via st ioctl() calls results in a unit attention and failure of
the drive while loading a tape from an EXB-480 robotics tape

Code which generates this error is attached. The error will not
clear unless the code first closes the open handle to the device,
then reopens the handle and retries the load command. The failure
scenario is always the same. The first MTLOAD command triggers
the tape drive to load the tape, then all subsequent commands
fail until the handle is closed and the device is reopened and
a second MTLOAD command gets issued, then the drive starts

I have written a tape robotics library for the Exabyte EXB-80
robotic tape library on Linux for a customer of Canopy. The
offending code is from this library.

Code attached. This error is persistent and 100% reproducable on
this hardware. The error does not involve the robot in the
library, as the robot has a unique SCSI id, and commands being
sent to the robot via the SCSI generic interface work flawlessly.
The tape drives in the robotics library appear to Linux as
tape devices on the SCSI bus, and the problems are apparent
on the SCSI tape drives via st.o.

There are no other problems at present with any of the remaining
tape code, and it is working perfectly, with the exception of
this load command.


// function used to call the st ioctl() interface. handles are opened
// in kernel space via filp_open()

int trx_tape_command(int tape_id, int cmd, int count, int count_bits)
struct file *filp;
register int ccode;
struct mtop mt_com;

if (tape_id >= MAX_TAPES)
return -EINVAL;

if ((!SystemTape[tape_id]) || (!SystemTape[tape_id]->filp))
return -EINVAL;

filp = SystemTape[tape_id]->filp;

mt_com.mt_op = cmd;
mt_com.mt_count = count;
mt_com.mt_count |= count_bits;

if (mt_com.mt_count < 0)
TRXDRVPrint("mt: negative repeat count\n");
return -EIO;

ccode = tape_ioctl(filp, MTIOCTOP, (char *)&mt_com);
if (ccode)
return ccode;

return 0;

// This code segment is what I am doing to get around this problem
// however, we still see a unit attention error periodically, and
// it does not reliably work every time.

err = trx_tape_open(device); // this is a filp_open() call
if (err)
goto done;

err = trx_tape_status(device);
if (err)
goto done;

// load command
err = trx_tape_command(device, MTLOAD, 0, 0);
TRXDRVPrint("loading tape %d ret-%d\n", (int)device, (int)err);
if (err)
goto done;

err = trx_tape_command(device, MTSETBLK, 4096, 0);
TRXDRVPrint("set tape blksize %d ret-%d\n", (int)device, (int)err);
if (err)
if (rcount++ < 3)
goto reload;
goto done;

err = trx_tape_command(device, MTREW, 0, 0);
TRXDRVPrint("rewinding tape %d ret-%d\n", (int)device, (int)err);
if (err)
goto done;

// redacted code.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:08    [W:0.211 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site