RFC: SCSI-0 test for no LUN

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

 



Does anyone object to the patch below?  The only way it could cause
trouble would be if someone had a SCSI-0 device that reported a PDT of 31,
which normally would indicate no LUN present.

Alan Stern



Index: l2616/drivers/scsi/scsi_scan.c
===================================================================
--- l2616.orig/drivers/scsi/scsi_scan.c
+++ l2616/drivers/scsi/scsi_scan.c
@@ -877,6 +877,19 @@ static int scsi_probe_and_add_lun(struct
 		goto out_free_result;
 	}
 
+	/*
+	 * Non-standard SCSI devices may set the PDT to 0x1f (unknown or
+	 * no device type) instead of using the peripheral qualifier to
+	 * indicate that no LUN is present.  For example, USB UFI does this.
+	 */
+	if (sdev->scsi_level == 0 && (result[0] & 0x1f) == 0x1f) {
+		SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO
+					"scsi scan: peripheral device type"
+					" of 31, no device added\n"));
+		res = SCSI_SCAN_TARGET_PRESENT;
+		goto out_free_result;
+	}
+
 	res = scsi_add_lun(sdev, result, &bflags);
 	if (res == SCSI_SCAN_LUN_PRESENT) {
 		if (bflags & BLIST_KEY) {

-
: 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