]> git.hungrycats.org Git - linux/commit
[PATCH] sr.c should issue TEST_UNIT_READY
authorMatthew Dharm <mdharm-scsi@one-eyed-alien.net>
Mon, 1 Sep 2003 10:37:10 +0000 (03:37 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Mon, 1 Sep 2003 10:37:10 +0000 (03:37 -0700)
commit613d15646d479701c95b1b33b8b005c675b08ee0
treed6e84de74a884d5dbacb4387c227c1336472ebf3
parent471503720b111665cd8a5449d272a98c5001f0f7
[PATCH] sr.c should issue TEST_UNIT_READY

The linux/drivers/scsi/sr.c code will issue a MODE_SENSE[_10] command to
a device as the first command sent to the device.  If the device has
just come out of reset, it will likely respond with a UNIT_ATTENTION /
NOT_READY status, which causes the MODE_SENSE to fail.  In fact, the
device may have several UNIT_ATTENTION conditions queued up (power-up
reset, media change, etc.)

This results in the mode page 0x2a data not being properly read and
interpreted.  As an end-effect, things like packet-writing don't work
(because the writeable bit is not set).

The solution to this is to issue one or more TEST_UNIT_READY commands to
the device to clear any pending UNIT_ATTENTION conditions.  This is the
technique used by sd.c -- in fact, this code was lifted directly from
sd.c

At some point in the future, abstraction of this initial TEST_UNIT_READY
code between all high-level SCSI drivers may be apropriate.  For now,
this patch makes sr.c issue TEST_UNIT_READY to clear the UNIT_ATTENTION,
thus allowing the mode page 0x2a code to work properly.  Given the
approaching 2.6.0-final release, I urge that this patch be accepted.
drivers/scsi/sr.c