[patch 1/1] scsi: fix check of PQ and PDT bits for WLUNs

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

 



From: Martin Petermann <martin@xxxxxxxxxxxxxxxxxx>

With kernel version 2.6.19 a check was introduced not to create a generic
SCSI device for devices that return PQ=1 and PDT=0x1f. For WLUNs (see 
SAM-3, p. 41ff) generic SCSI devices should be created unconditionally
without looking at the PQ bit. I'm referring here to the thread "With kernel
2.6.19 no sg devices for devices that return PQ=1, PDT=0x1f" of the 
linux-scsi forum. This is my proposed fix.

Signed-off-by: Martin Petermann <martin@xxxxxxxxxxxxxxxxxx>

---
 drivers/scsi/scsi_scan.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

--- a/drivers/scsi/scsi_scan.c	2008-08-12 12:51:32.000000000 +0200
+++ b/drivers/scsi/scsi_scan.c	2008-08-12 12:58:16.000000000 +0200
@@ -75,6 +75,11 @@
 #define SCSI_SCAN_TARGET_PRESENT	1
 #define SCSI_SCAN_LUN_PRESENT		2
 
+#define SCSI_W_LUN_BASE 0xc100
+#define SCSI_W_LUN_REPORT_LUNS (SCSI_W_LUN_BASE + 1)
+#define SCSI_W_LUN_ACCESS_CONTROL (SCSI_W_LUN_BASE + 2)
+#define SCSI_W_LUN_TARGET_LOG_PAGE (SCSI_W_LUN_BASE + 3)
+
 static const char *scsi_null_device_strs = "nullnullnullnull";
 
 #define MAX_SCSI_LUNS	512
@@ -1080,7 +1085,7 @@ static int scsi_probe_and_add_lun(struct
 	 * PDT=1Fh none (no FDD connected to the requested logical unit)
 	 */
 	if (((result[0] >> 5) == 1 || starget->pdt_1f_for_no_lun) &&
-	     (result[0] & 0x1f) == 0x1f) {
+	    (result[0] & 0x1f) == 0x1f && (lun & 0xff00) != SCSI_W_LUN_BASE) {
 		SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO
 					"scsi scan: peripheral device type"
 					" of 31, no device added\n"));

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