Subject: scsi tape changer / st_unmount interaction.
To: None <tech-kern@netbsd.org>
From: Bill Sommerfeld <sommerfeld@orchard.arlington.ma.us>
List: tech-kern
Date: 03/20/1999 14:55:21
I've been playing with a Sony TSL-9000 tape changer.

It has the following interesting behavior:

 - when the tape drive has the "prevent media removal" bit set,
changer commands which attempt to move things into/out of the drive
fail.

 - when the tape drive is given an EJECT command (either via the
"eject" command or by mt rewoffl), the changer catches the eject and
*loads the next tape in sequence*.

This interacts poorly with the no-rewind tape device, which sets
"prevent media removal" on open(), and leaves it set on close, as this
sequence (which works with other changers i'm familiar with):

	    chio move slot 2 drive 0
	    <dump to /dev/nrst0>
	    mt rewind
	    chio move drive 0 slot 2

causes the `chio' to fail.  Changing `mt rewind' to `mt rewoffl'
causes the subsequent chio to fail for a different reason: the eject
done by mtrewoffl causes the loaded tape to be ejected into slot 2,
and the tape from slot 3 is loaded in its place..

>From looking through sys/dev/scsipi/st.c, it looks like there isn't
really a clean way to clear the "prevent media removal" without an
eject except by opening & closing the no-rewind device.

I'm not quite sure what the right answer is here..

My best guess is that doing an st_unmount(st, NOEJECT) in stclose()
when the tape's at BOT would be an improvement over the current
situation.

Anyone with more SCSI clue have any opinions on the Right Thing To Do
here?
					- Bill