public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix up scsi_test_unit_ready() to work correctly with CD-ROMs
@ 2004-09-09 13:58 James Bottomley
  2004-09-10  4:03 ` Douglas Gilbert
  0 siblings, 1 reply; 3+ messages in thread
From: James Bottomley @ 2004-09-09 13:58 UTC (permalink / raw)
  To: SCSI Mailing List

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.

James

===== drivers/scsi/scsi_lib.c 1.133 vs edited =====
--- 1.133/drivers/scsi/scsi_lib.c	Tue Sep  7 16:48:51 2004
+++ edited/drivers/scsi/scsi_lib.c	Wed Sep  8 22:22:27 2004
@@ -1585,11 +1585,12 @@
 	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;




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix up scsi_test_unit_ready() to work correctly with CD-ROMs
  2004-09-09 13:58 [PATCH] Fix up scsi_test_unit_ready() to work correctly with CD-ROMs James Bottomley
@ 2004-09-10  4:03 ` Douglas Gilbert
  2004-09-11 10:35   ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Douglas Gilbert @ 2004-09-10  4:03 UTC (permalink / raw)
  To: James Bottomley; +Cc: SCSI Mailing List

James Bottomley wrote:
> 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.
> 
> James
> 
> ===== drivers/scsi/scsi_lib.c 1.133 vs edited =====
> --- 1.133/drivers/scsi/scsi_lib.c	Tue Sep  7 16:48:51 2004
> +++ edited/drivers/scsi/scsi_lib.c	Wed Sep  8 22:22:27 2004
> @@ -1585,11 +1585,12 @@
>  	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) &&

James,
Is the "descriptor" sense data patch which Christoph and I
worked on likely to be accepted?

That way awkward and descriptor format unfriendly code like:
   sreq->sr_sense_buffer[2] & 0x0f) == UNIT_ATTENTION

could be replaced with something like (after a little overhead):
   sshd.sense_key == UNIT_ATTENTION

Doug Gilbert


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix up scsi_test_unit_ready() to work correctly with CD-ROMs
  2004-09-10  4:03 ` Douglas Gilbert
@ 2004-09-11 10:35   ` Christoph Hellwig
  0 siblings, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2004-09-11 10:35 UTC (permalink / raw)
  To: Douglas Gilbert; +Cc: James Bottomley, SCSI Mailing List

On Fri, Sep 10, 2004 at 02:03:28PM +1000, Douglas Gilbert wrote:
> James,
> Is the "descriptor" sense data patch which Christoph and I
> worked on likely to be accepted?

That patch (and I'd rather say it's yours because you did the hard work :))
is in now.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-09-11 10:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-09 13:58 [PATCH] Fix up scsi_test_unit_ready() to work correctly with CD-ROMs James Bottomley
2004-09-10  4:03 ` Douglas Gilbert
2004-09-11 10:35   ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox