[1792] in linux-scsi channel archive
Re: scsi tape: commands hang in allocate_device
daemon@ATHENA.MIT.EDU (Kai M{kisara)
Thu May 1 21:19:29 1997
Date: Fri, 2 May 1997 00:22:28 +0300 (EET DST)
From: Kai M{kisara <makisara@abies.metla.fi>
Reply-To: Kai.Makisara@metla.fi
To: Jan Echternach <jan.echternach@informatik.uni-rostock.de>
cc: linux-scsi@vger.rutgers.edu
In-Reply-To: <199705011513.RAA08641@hokkaido.informatik.uni-rostock.de>
On Thu, 1 May 1997, Jan Echternach wrote:
...
> I started to investigate the problem with the following patch:
>
> --- st.c-2.0.29 Wed Apr 23 21:05:12 1997
> +++ st.c Tue Apr 29 21:30:35 1997
> @@ -246,7 +246,11 @@
> int timeout, int retries)
> {
> if (SCpnt == NULL)
> - if ((SCpnt = allocate_device(NULL, STp->device, 1)) == NULL) {
> +/* if ((SCpnt = allocate_device(NULL, STp->device, 1)) == NULL) { */
> + printk(ST_DEB_MSG "st_do_scsi: allocate_device +\n");
> + SCpnt = allocate_device(NULL, STp->device, 1);
> + printk(ST_DEB_MSG "st_do_scsi: allocate_device -\n");
> + if (SCpnt == NULL) {
> printk(KERN_ERR "st%d: Can't get SCSI request.\n", TAPE_NR(STp->devt));
> return NULL;
> }
I think this changes the way the allocation works. The original idea is
that a new request is allocated only if a request has not yet allocated
(SCpnt == NULL). After your change the first printk is done only if the
request has not been allocated but a new request allocated in any case.
Only the first request is freed and this leads to problems sooner or
later depending on how many concurrent commands have been configured to
your SCSI driver.
The SCSI tape driver should never need more than one request. The
allocated request is freed when it is not needed any more or a function is
called that allocates a new request. It is perfectly possible that there
are bugs and at some time more than one request are needed. This would
need a hang with a SCSI adapter allowing only one concurrent command per
LUN.
...
> First example of a failing command:
> 1. boot
> 2. insert tape
> 3. modprobe st
> 4. mt -f /dev/nst0 stsetoptions scsi2logical --> hangs
>
> dmesg:
> > Detected scsi tape st0 at scsi0, channel 0, id 4, lun 0
> > st: Buffer size 66560 bytes, write threshold 30720 bytes.
> > st: Allocated tape buffer 0 (66560 bytes, dma: 1, a: 008c0018).
> > st: Allocated tape buffer 1 (66560 bytes, dma: 1, a: 008a0018).
> > st_do_scsi: allocate_device +
> > st_do_scsi: allocate_device -
> > st0: Error: 28000002, cmd: 0 0 0 0 0 0 Len: 0
> > extra data not valid Current error st09:00: sense key Unit Attention
> > Additional sense indicates Not ready to ready transition (medium may have changed)
> > st_do_scsi: allocate_device -
> > st_do_scsi: allocate_device -
> > st0: Block limits 1 - 16777215 bytes.
>
BusLogic.h contains #define BusLogic_UntaggedQueueDepth 3. The output
above showing that the hang occurs when allocating the fourth request is
consistent with this.
...
More positive feedback to finish with :-) I tried to set block size to
32768 and do a tar : it hangs in allocate_device. I will look at this
problem later today. It should be easy to fix now that I can reproduce it.
Thanks for the bug report.
Kai