All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Petermann <martin@linux.vnet.ibm.com>
To: linux-scsi@vger.kernel.org
Cc: Martin Petermann <martin@linux.vnet.ibm.com>
Subject: [patch 1/1] scsi: fix check of PQ and PDT bits for WLUNs
Date: Tue, 12 Aug 2008 13:40:38 +0200	[thread overview]
Message-ID: <20080812114123.133900000@linux.vnet.ibm.com> (raw)
In-Reply-To: 20080812114037.963047000@linux.vnet.ibm.com

[-- Attachment #1: scsi_scan.diff --]
[-- Type: text/plain, Size: 1568 bytes --]

From: Martin Petermann <martin@linux.vnet.ibm.com>

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@linux.vnet.ibm.com>

---
 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"));

-- 

  reply	other threads:[~2008-08-12 11:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-12 11:40 [patch 0/1] [PATCH] scsi: fix check of PQ and PDT bits for WLUNs Martin Petermann
2008-08-12 11:40 ` Martin Petermann [this message]
2008-08-21 20:14   ` [patch 1/1] " James Bottomley
2008-08-25  8:41     ` Swen Schillig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080812114123.133900000@linux.vnet.ibm.com \
    --to=martin@linux.vnet.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.