Christoph Hellwig wrote:
On Mon, Feb 15, 2010 at 02:51:22PM +0100, Douglas Gilbert wrote:
What about O_NONBLOCK (which stops a hang on open)?
The open code common to my utilities in Linux is
below.
No, O_NONBLOCK should have nothing to do with it and your code
snipplet looks fine. We'll need to figure out what's really going
on here.
Forget SYNCHRONIZE CACHE, the pass-through interface via
sd looks completely stupid when opened RW.
'modprobe scsi_debug opts=1'
shows all SCSI commands sent to a device (dev/sdb in this
case).
# sg_start --stop --readonly /dev/sdb
does the expected:
scsi_debug: cmd 1b 00 00 00 00 00
but remove that '--readonly' and /dev/sdb is opened RW
with this command:
# sg_start --stop /dev/sdb
then scsi_debug reports this load (of crap):
scsi_debug: cmd 1b 00 00 00 00 00
scsi_debug: cmd 12 00 00 00 fe 00
scsi_debug: cmd 12 01 00 00 fe 00
scsi_debug: cmd 12 01 83 00 fe 00
scsi_debug: cmd 28 00 00 00 00 00 00 01 00 00
scsi_debug: cmd 28 00 00 00 00 00 00 00 08 00
scsi_debug: cmd 28 00 00 00 00 00 00 00 20 00
scsi_debug: cmd 28 00 00 00 00 00 00 00 08 00
scsi_debug: cmd 28 00 00 00 00 00 00 00 08 00
So send a START_STOP_UNIT(stop) through the SG_IO
ioctl on a sd device opened RW and as a bonus get
three INQUIRYs (one standard, two VPD pages) and 5 READ
commands!
If the device is SCSI (as the scsi_debug driver is
simulating) then those READs fail because the drive
is stopped. However if that is an ATA disk behind a
SAT layer, then the disk will be spun up. That defeats
the purpose of the pass-though, especially when it
is being used to spin down the disk.
My guess, reviewing the bug reports flowing into me is
that this nonsense started around lk 2.6.29 .
Please fix.
Doug Gilbert
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html