public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@SteelEye.com>
To: SCSI Mailing List <linux-scsi@vger.kernel.org>
Subject: [PATCH] Fix up scsi_test_unit_ready() to work correctly with CD-ROMs
Date: 09 Sep 2004 09:58:15 -0400	[thread overview]
Message-ID: <1094738299.1837.2.camel@mulgrave> (raw)

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;




             reply	other threads:[~2004-09-09 13:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-09 13:58 James Bottomley [this message]
2004-09-10  4:03 ` [PATCH] Fix up scsi_test_unit_ready() to work correctly with CD-ROMs Douglas Gilbert
2004-09-11 10:35   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1094738299.1837.2.camel@mulgrave \
    --to=james.bottomley@steeleye.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox