mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Jeff V. Merkey" <jmerkey@vger.timpanogas.org>
To: linux-kernel@vger.kernel.org
Cc: jmerkey@timpanogas.org
Subject: SCSI tape load problem with Exabyte Drive
Date: Tue, 16 Oct 2001 15:36:40 -0700	[thread overview]
Message-ID: <20011016153623.A21324@vger.timpanogas.org> (raw)



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
library.

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 
working.

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. 

Jeff

//
// 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.
//
//

reload:;
       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)
          {
             trx_tape_close(device);
             goto reload;
          }
          else
             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.
       //

done:;


             reply	other threads:[~2001-10-16 21:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-16 22:36 Jeff V. Merkey [this message]
2001-10-17  6:43 ` Kai Makisara
2001-10-17 17:55   ` Jeff V. Merkey
2001-10-18  1:20     ` Jeff V. Merkey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20011016153623.A21324@vger.timpanogas.org \
    --to=jmerkey@vger.timpanogas.org \
    --cc=jmerkey@timpanogas.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®