[1786] in linux-scsi channel archive
scsi tape: commands hang in allocate_device
daemon@ATHENA.MIT.EDU (Jan Echternach)
Thu May 1 11:18:22 1997
From: Jan Echternach <echter@informatik.uni-rostock.de>
To: linux-scsi@vger.rutgers.edu (linux-scsi)
Date: Thu, 1 May 1997 17:13:13 +0200 (MET DST)
Reply-To: jan.echternach@informatik.uni-rostock.de (Jan Echternach)
System:
Linux 2.0.29 (I've just tried 2.0.30, but nothing changed)
Buslogic BT-948
> Attached devices:
> Host: scsi0 Channel: 00 Id: 00 Lun: 00
> Vendor: SEAGATE Model: ST31230N Rev: 0300
> Type: Direct-Access ANSI SCSI revision: 02
> Host: scsi0 Channel: 00 Id: 01 Lun: 00
> Vendor: NEC Model: CD-ROM DRIVE:500 Rev: 2.5
> Type: CD-ROM ANSI SCSI revision: 02
> Host: scsi0 Channel: 00 Id: 04 Lun: 00
> Vendor: SONY Model: SDT-7000 Rev: 0195
> Type: Sequential-Access ANSI SCSI revision: 02
> Host: scsi0 Channel: 00 Id: 05 Lun: 00
> Vendor: SEAGATE Model: ST43400N Rev: 0005
> Type: Direct-Access ANSI SCSI revision: 02
The first time I noticed the problem was when I tried to tar something
onto the tape with a block size of 32768 (there were no problems with a
block size of 512). tar hung in allocate_device.
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;
}
@@ -1125,7 +1129,9 @@
STp->block_size == 0) ) {
/* Schedule an asynchronous write */
if (!SCpnt) {
+ printk(ST_DEB_MSG "st_write: allocate_device +\n");
SCpnt = allocate_device(NULL, STp->device, 1);
+ printk(ST_DEB_MSG "st_write: allocate_device -\n");
if (!SCpnt)
return (-EBUSY);
}
But then almost every command accessing the tape hung in
allocate_device. I temporarily removed the printk's in st_do_scsi()
and most commands worked again.
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.
ps axln:
FLAGS UID PID PPID PRI NI SIZE RSS WCHAN STA TTY TIME COMMAND
100000 0 197 186 0 0 832 76 18b94b D 04c4 0:00 mt -f /dev/nst0 stsetoptions scsi2logical
0x18b930 <allocate_device+384>: je 0x18b958 <allocate_device+424>
0x18b932 <allocate_device+386>: movl 0x14(%esp,1),%esi
0x18b936 <allocate_device+390>: movl 0x58(%esi),%eax
0x18b939 <allocate_device+393>: cmpl $0xffffffff,%eax
0x18b93c <allocate_device+396>: je 0x18b958 <allocate_device+424>
0x18b93e <allocate_device+398>: movl 0x28(%esp,1),%eax
0x18b942 <allocate_device+402>: addl $0x14,%eax
0x18b945 <allocate_device+405>: pushl %eax
0x18b946 <allocate_device+406>: call 0x11296c <sleep_on+8>
0x18b94b <allocate_device+411>: pushl 0x1c(%esp,1)
0x18b94f <allocate_device+415>: popf
0x18b950 <allocate_device+416>: addl $0x4,%esp
0x18b953 <allocate_device+419>: jmp 0x18b854 <allocate_device+164>
Second example:
1. boot with tape in drive
2. modprobe st
3. mt -f /dev/nst0 stsetoptions scsi2logical
4. mt -f /dev/nst0 setblk 49152 --> 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: 00fc0018).
> st: Allocated tape buffer 1 (66560 bytes, dma: 1, a: 00fa0018).
> st_do_scsi: allocate_device +
> st_do_scsi: allocate_device -
> st_do_scsi: allocate_device -
> st0: Block limits 1 - 16777215 bytes.
> st_do_scsi: allocate_device -
> st0: Mode sense. Length 11, medium 0, WBS 10, BLL 8
> st0: Density 13, tape length: 0, drv buffer: 1
> st0: Block size: 512, buffer size: 66560 (130 blocks).
> st0: Mode 0 options: buffer writes: 1, async writes: 1, read ahead: 1
> st0: can bsr: 0, two FMs: 0, fast mteom: 0, auto lock: 0,
> st0: defs for wr: 0, no block limits: 0, partitions: 0, s2 log: 1
> st0: debugging: 1
> st_do_scsi: allocate_device +
> st_do_scsi: allocate_device -
--
Jan