]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[SCSI] fix check of PQ and PDT bits for WLUNs
authorJames Bottomley <James.Bottomley@HansenPartnership.com>
Thu, 21 Aug 2008 20:14:14 +0000 (15:14 -0500)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Fri, 29 Aug 2008 14:19:11 +0000 (09:19 -0500)
For IBM z series certain LUNs can no longer be accessed.

This is because 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, so add a
check for WLUNs in with this test.

Acked-by: Martin Petermann <martin@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
drivers/scsi/scsi_scan.c
include/scsi/scsi.h

index 84b4879cff114f8a6e709deed6e18c67966d9140..34d0de6cd51123cb42d7cda2bc4b62a2f5151c9b 100644 (file)
@@ -1080,7 +1080,8 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget,
         * 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 &&
+           !scsi_is_wlun(lun)) {
                SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO
                                        "scsi scan: peripheral device type"
                                        " of 31, no device added\n"));
index 5c40cc537d4cc625a9ad94d76190405c52694379..192f8716aa9eba82b1ebdd6555090e54d3fcb279 100644 (file)
@@ -308,6 +308,20 @@ struct scsi_lun {
        __u8 scsi_lun[8];
 };
 
+/*
+ * The Well Known LUNS (SAM-3) in our int representation of a LUN
+ */
+#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 inline int scsi_is_wlun(unsigned int lun)
+{
+       return (lun & 0xff00) == SCSI_W_LUN_BASE;
+}
+
+
 /*
  *  MESSAGE CODES
  */