All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Wysochanski <davidw@netapp.com>
To: hch@lst.de, James.Bottomley@steeleye.com
Cc: michaelc@cs.wisc.edu, linux-scsi@vger.kernel.org, hare@suse.de,
	"Kraft, Claire" <Claire.Kraft@netapp.com>,
	"Shenoy, Raghavendra" <Raghavendra.Shenoy@netapp.com>,
	"George, Martin" <marting@netapp.com>,
	nvinod@netapp.com
Subject: [PATCH] Don't add scsi_device for devices that return PQ=1, PDT=0x1f
Date: Thu, 27 Jul 2006 16:30:36 -0400	[thread overview]
Message-ID: <44C9226C.6030309@netapp.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 954 bytes --]

Some targets may return PQ=1 and PDT=0x1f to indicate no LUN is mapped
(Netapp targets do this).  This seems like a valid way to indicate no
LUN mapped according to SPC-3.

However, the current scsi_probe_and_add_lun() code adds a scsi_device
for targets that return PQ=1 and PDT=0x1f.  This causes LUNs of type
"UNKNOWN" to show up in /proc/scsi/scsi when no LUNs are mapped.
In addition, subsequent rescans fail to recognize LUNs that may be
added on the target, unless preceded by a write to the delete attribute
of the "UNKNOWN" LUN.

This patch addresses this problem by skipping over the scsi_add_lun()
when PQ=1,PDT=0x1f is encountered, and just returns
SCSI_SCAN_TARGET_PRESENT.

If there are objections to this patch, I can add a BLIST flag and entry
for Netapp targets but would like to avoid that if possible, since it
seems like the current code might be closer to SPC-3 with this patch.

Signed-off-by: Dave Wysochanski <davidw@netapp.com>


[-- Attachment #2: scsi_scan_fix_pq_1_pdt_1f.patch --]
[-- Type: text/x-patch, Size: 1057 bytes --]

--- linux-2.6.18-rc2/drivers/scsi/scsi_scan.c	2006-07-15 17:53:08.000000000 -0400
+++ linux-2.6.18-rc2-lun0/drivers/scsi/scsi_scan.c	2006-07-27 15:18:59.000000000 -0400
@@ -955,6 +955,24 @@ static int scsi_probe_and_add_lun(struct
 		goto out_free_result;
 	}
 
+	/*
+	 * Some targets may set PQ=1 and PDT=0x1f to signal that no LUN
+	 * is attached, so don't add device.  From SCSI SPC-3, PQ=1:
+	 * "A peripheral device having the specified peripheral device 
+	 * type is not connected to this logical unit. However, the 
+	 * device server is capable of supporting the specified peripheral
+	 * device type on this logical unit."
+	 * Also, from SCSI SPC-3, PDT=0x1f:
+	 * "Unknown or no device type" 
+	 */
+	if ((result[0] >> 5) == 1 && (result[0] & 0x1f) == 0x1f) {
+		SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO
+					"scsi scan: PQ=1, PDT=0x1f,"
+					" 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) {

             reply	other threads:[~2006-07-27 20:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-27 20:30 Dave Wysochanski [this message]
2006-08-05 12:01 ` [PATCH] Don't add scsi_device for devices that return PQ=1, PDT=0x1f Christoph Hellwig
2006-08-07  6:03   ` Dave Wysochanski
2006-08-07 14:45     ` Alan Stern
2006-08-08 15:34     ` Christoph Hellwig

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=44C9226C.6030309@netapp.com \
    --to=davidw@netapp.com \
    --cc=Claire.Kraft@netapp.com \
    --cc=James.Bottomley@steeleye.com \
    --cc=Raghavendra.Shenoy@netapp.com \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=marting@netapp.com \
    --cc=michaelc@cs.wisc.edu \
    --cc=nvinod@netapp.com \
    /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.