On Mon, 9 Feb 2015, Oliver Neukum wrote: > On Mon, 2015-02-09 at 11:10 -0500, Alan Stern wrote: > > On Mon, 9 Feb 2015, Oliver Neukum wrote: > > > > > This is necessary to make some storage arrays work. > > > > > > Some storage devices have more than 8 LUNs. In addition > > > you can hook up a WideSCSI bus to USB. In these cases even > > > level 2 devices can have more than 8 devices. For them > > > it is necessary to simply believe the class specific > > > command and report its result back to the SCSI layer. > > > > > > Signed-off-by: Oliver Neukum <oneukum@xxxxxxx> > > > --- > > > drivers/usb/storage/usb.c | 6 ++++++ > > > 1 file changed, 6 insertions(+) > > > > > > diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c > > > index d468d02..cf2fafb 100644 > > > --- a/drivers/usb/storage/usb.c > > > +++ b/drivers/usb/storage/usb.c > > > @@ -889,6 +889,12 @@ static void usb_stor_scan_dwork(struct work_struct *work) > > > !(us->fflags & US_FL_SCM_MULT_TARG)) { > > > mutex_lock(&us->dev_mutex); > > > us->max_lun = usb_stor_Bulk_max_lun(us); > > > + /* > > > + * Allow proper scanning of devices that present more than 8 LUNs > > > + * While not affecting other devices that may need the previous behavior > > > + */ > > > + if (us->max_lun > 8) > > > > >= 8, not > 8. Or, if you prefer, > 7. > > > > > + us_to_host(us)->max_lun = us->max_lun+1; > > > > What about the fact that you may be overriding max_scsi_luns? > > As far as I can tell scsi_sequential_lun_scan() will prevent that by > max_dev_lun = min(max_scsi_luns, shost->max_lun); Yes, all right. > > Also, since the protocol allows only 4 bits for the LUN value, would it > > be safer to use min(us->max_lun+1, 16)? > > usb_stor_Bulk_max_lun() will always return a number between 0 and 15 Ah, okay. I was looking at an old version of that routine. However, I think you still need to change "> 8" above to ">= 8". Or to "> 7". Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html