RE: [usb-storage] [Merging ATA passthru] on integrating SMART/ATA-Security in usb-storage driver

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

 



> On Mon, 7 Nov 2005, James Bottomley wrote:
> 
> > > It's quite possible that usb-storage no longer needs to force the 
> > > scsi-level to 2.  No one has recently tested what would 
> happen without 
> > > it.  Matt probably has the best selection of devices for 
> testing...
> > > 
> > > There is one problem we have with devices that report 
> themselves as SCSI-3 
> > > or SCSI-4 but hang when they receive a REPORT LUNS 
> command.  That's easily 
> > > handled by making usb-storage set the NOREPORTLUN flag.  
> Maybe that's all 
> > > we need to do.
> > 
> > If you could try this out, I'd be grateful.
> 
> I tried the patch below on several combinations of SCSI 
> levels and device 
> types.  It seems to do exactly what we want; for reads I always saw 
> READ(10) and for MODE SENSE I saw either the 6- or 10-byte 
> form, depending 
> on the device type and USB subclass value.
> 
> The question remains whether pass-thru will now work and 
> whether the patch
> will mess up some existing non-compliant device that 
> currently works okay.  
> The only way to know is by trying it out.  Matt and Timothy, 
> that's up to
> you.
> 
> Alan Stern
> 

I did some initial testing on Alan's patch with a sandisk cruzer
mini thumb drive (level 2), a memorex thumb drive (level 0),
and that cypress part (level 0), and I haven't seen any IO
problems.

After that I made another patch (below and attached because
of wrapping) you can apply after Alan's that disables cdb mangling
on level 0 devices. It was generated against Linus' git repo after
applying Alan's patch.

With both patches applied I can now do passthru cdbs on the
cypress part without issue, and I still don't see any IO issues.

Anyone out there have a better selection of hardware to test with?


Signed-off-by: Timothy Thelin <timothy.thelin@xxxxxxx>

---

diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -569,9 +569,10 @@ int scsi_dispatch_cmd(struct scsi_cmnd *
 	}
 
 	/* 
-	 * If SCSI-2 or lower, store the LUN value in cmnd.
+	 * If SCSI-2 or lower (except SCSI-0), store the LUN value in cmnd.
 	 */
-	if (cmd->device->scsi_level <= SCSI_2) {
+	if (cmd->device->scsi_level != SCSI_UNKNOWN &&
+		cmd->device->scsi_level <= SCSI_2) {
 		cmd->cmnd[1] = (cmd->cmnd[1] & 0x1f) |
 			       (cmd->device->lun << 5 & 0xe0);
 	}

Attachment: scsi-level-0-aware.patch
Description: scsi-level-0-aware.patch


[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