public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] cdrom sane fallback vs 2.4.20-pre1
@ 2002-08-13 14:13 James Bottomley
  2002-08-13 15:48 ` Randy.Dunlap
  0 siblings, 1 reply; 12+ messages in thread
From: James Bottomley @ 2002-08-13 14:13 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: linux-kernel, James.Bottomley, Erik Andersen

> > -             if (ret) {
> > +             if (ret && sense.sense_key==0x05 && sense.asc==0x20 && sense.ascq==0x00) {
> 
> Do you really need to hardcode this values ?

We have no #defines for the asc and ascq codes (they are interpreted in 
constants.c but the values are hardcoded in there too).  There is a #define 
for sense_key 0x05 as ILLEGAL_REQUEST in scsi/scsi.h, but these #defines have 
annoyed a lot of people by being rather namespace polluting.

James



^ permalink raw reply	[flat|nested] 12+ messages in thread
* [PATCH] cdrom sane fallback vs 2.4.20-pre1
@ 2002-08-11 21:59 Erik Andersen
  2002-08-13  2:58 ` Marcelo Tosatti
  0 siblings, 1 reply; 12+ messages in thread
From: Erik Andersen @ 2002-08-11 21:59 UTC (permalink / raw)
  To: Marcelo Tosatti, lkml, Jens Axboe

Here is an update to cdrom.c.   SCSI-II devices are not required
to support the READ_CD packet command.  Currently, the cdrom
driver assumes that _all_ READ_CD packet command failures are due
to READ_CD being unsupported.  Obviously, there are a million
other reasons for a READ_CD packet command to fail.  Here at my
house, the most common reason for READ_CD failures is that my
kids have, once again, scratched up my CDs resulting in bad
sectors.  So the drive hits an uncorrectable error and thinks
that READ_CD is unsupported, and then trys again using READ_10
(which takes another a few seconds to fail and, of course, again
returns an L-EC Uncorrectable Error).

This patch teaches cdrom.c to only fall back to READ_10 when
the drive reports that we sent it an invalid command...

 -Erik

--
Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--

--- drivers/cdrom/cdrom.c~	Sun Aug 11 15:37:20 2002
+++ drivers/cdrom/cdrom.c	Sun Aug 11 15:37:24 2002
@@ -1916,6 +1916,7 @@
 {		
 	struct cdrom_device_ops *cdo = cdi->ops;
 	struct cdrom_generic_command cgc;
+	struct request_sense sense;
 	kdev_t dev = cdi->dev;
 	char buffer[32];
 	int ret = 0;
@@ -1951,9 +1952,11 @@
 		cgc.buffer = (char *) kmalloc(blocksize, GFP_KERNEL);
 		if (cgc.buffer == NULL)
 			return -ENOMEM;
+		memset(&sense, 0, sizeof(sense));
+		cgc.sense = &sense;
 		cgc.data_direction = CGC_DATA_READ;
 		ret = cdrom_read_block(cdi, &cgc, lba, 1, format, blocksize);
-		if (ret) {
+		if (ret && sense.sense_key==0x05 && sense.asc==0x20 && sense.ascq==0x00) {
 			/*
 			 * SCSI-II devices are not required to support
 			 * READ_CD, so let's try switching block size

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

end of thread, other threads:[~2002-08-16  3:08 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-08-13 14:13 [PATCH] cdrom sane fallback vs 2.4.20-pre1 James Bottomley
2002-08-13 15:48 ` Randy.Dunlap
2002-08-13 16:14   ` Jens Axboe
2002-08-13 16:21   ` James Bottomley
2002-08-13 16:25     ` Randy.Dunlap
2002-08-13 16:37       ` Jens Axboe
2002-08-13 17:10         ` James Bottomley
  -- strict thread matches above, loose matches on Subject: below --
2002-08-11 21:59 Erik Andersen
2002-08-13  2:58 ` Marcelo Tosatti
2002-08-13  4:12   ` Erik Andersen
2002-08-16  3:12     ` Oliver Xymoron
2002-08-13  8:42   ` Jens Axboe

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