[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.
Showing
Please register or sign in to comment