Commit 8b0f49f5 authored by James Bottomley's avatar James Bottomley Committed by James Bottomley

[PATCH] Fix up scsi_test_unit_ready() to work correctly with CD-ROMs

Olaf Hering noticed that SG_IO was no-longer working correctly on some
CD-ROMS.  The reason is a change in behaviour induced by switching to
the new scsi_test_unit_ready() API.

Apparently the CD-ROM special case needs to ignore both UNIT_ATTENTION
and NOT_READY for removable media.
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent ba3f139f
......@@ -1585,11 +1585,12 @@ scsi_test_unit_ready(struct scsi_device *sdev, int timeout, int retries)
if (!sreq)
return -ENOMEM;
sreq->sr_data_direction = DMA_NONE;
scsi_wait_req(sreq, cmd, NULL, 0, timeout, retries);
sreq->sr_data_direction = DMA_NONE;
scsi_wait_req(sreq, cmd, NULL, 0, timeout, retries);
if ((driver_byte(sreq->sr_result) & DRIVER_SENSE) &&
(sreq->sr_sense_buffer[2] & 0x0f) == UNIT_ATTENTION &&
((sreq->sr_sense_buffer[2] & 0x0f) == UNIT_ATTENTION ||
(sreq->sr_sense_buffer[2] & 0x0f) == NOT_READY) &&
sdev->removable) {
sdev->changed = 1;
sreq->sr_result = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment