Re: [PATCH 2/2] sd: Try READ CAPACITY 16 first for SBC-2 devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2009-03-14 at 16:48 -0600, Matthew Wilcox wrote:
> On Sat, Mar 14, 2009 at 03:41:31PM -0500, James Bottomley wrote:
> > We're going to have to do something about the scary error messages on
> > SBC-2 supporting drives, this is what mine say (and this is after mkp's
> > chat reduction):
> > 
> > sd 1:0:1:0: [sdc] READ CAPACITY(16) failed
> > sd 1:0:1:0: [sdc] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
> > sd 1:0:1:0: [sdc] Sense Key : Illegal Request [current] 
> > sd 1:0:1:0: [sdc] Add. Sense: Invalid command operation code
> > sd 1:0:1:0: [sdc] 71096640 512-byte hardware sectors: (36.4 GB/33.9 GiB)
> 
> OK, that's relatively easy to fix.  Simply return early if the drive
> claims not to understand the command, and it'll try rc10 without printing
> the scary messages.  Like this, perhaps (note cunning factoring of code):
> 
> (compile tested only, and I'll do you a nice changelog and sign-off for
> it if it fixes the problem and you approve of this approach).
> 
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index f8260c0..60b31ea 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -1139,6 +1139,14 @@ static int media_not_present(struct scsi_disk *sdkp,
>  	return 1;
>  }
>  
> +static int invalid_field_in_cdb(struct scsi_sense_hdr *sshdr)
> +{
> +	if (!scsi_sense_valid(sshdr))
> +		return 0;
> +	return sshdr->sense_key == ILLEGAL_REQUEST &&
> +			sshdr->asc == 0x24 && sshdr->ascq == 0x0;
> +

Actually, afraid not, you're trapped in the confusing maze of ASC/ASCQ
codes, all sounding alike but meaning slightly different things:
0x24/0x00 is Invalid Field in CDB.  The problem I'm having is 0x20/00
(Invalid Command Operation Code).

This will fix it, though ... I'll just merge it into your patch.

James

---

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index bab5698..19a7b98 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1329,8 +1329,15 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp,
 		if (media_not_present(sdkp, &sshdr))
 			return -ENODEV;
 
-		if (the_result)
+		if (the_result) {
 			sense_valid = scsi_sense_valid(&sshdr);
+			if (sense_valid &&
+			    sshdr.sense_key == ILLEGAL_REQUEST &&
+			    sshdr.asc == 0x20 && sshdr.ascq == 0x00)
+				/* Invalid Command Operation Code,
+				 * just retry silently with RC10 */
+				return -EINVAL;
+		}
 		retries--;
 
 	} while (the_result && retries);


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux