* [PATCH 0/3] SCSI scanning for PQ3 devs
@ 2006-03-29 20:10 Kurt Garloff
2006-03-29 20:11 ` [PATCH 1/3] Try LUN 1 and use bflags Kurt Garloff
` (5 more replies)
0 siblings, 6 replies; 11+ messages in thread
From: Kurt Garloff @ 2006-03-29 20:10 UTC (permalink / raw)
To: Linux SCSI list; +Cc: Patrick Mansfield
[-- Attachment #1: Type: text/plain, Size: 1289 bytes --]
Hi,
solving some SCSI scanning problems that have been reported to us,
I came up with the followin patch set.
The trouble is that there are devices that report a LUN with
peripheral qualifier on LUN0.
We currently don't handle this well yet:
- Blacklist flags are not used to do special handling if needed.
- If the device does NOT support the REPORT_LUNS scan, we won't
see any LUN at all, as we don't even look for LUN 1 then.
Yes, such devices do exist, actually, see PATCH3 ..
The patches do:
- Unconditionally at least look for LUN 1 if LUN 0 was a PQ3
device (but abort scanning there is SPARSELUN is not set
and no device can be attached to LUN 1)
- Return the blacklist flags for further usage even if LUN 0
was a PQ3 device.
- Improve the scsi logging information for the the user about
the PQ3 issue.
- Introduce a blacklist flag BLIST_ATTACH_PQ3 that allows
a PQ3 device to be registered with the OS and thus sg can
attach to it. Add two devices to the list.
(One could argue that this should be default, but who knows
what virtual scsi driver will break then ...)
Patches are agains 2.6.16, please consider merging for 2.6.17
or shoot back feedback to me.
Best,
--
Kurt Garloff, Head Architect Linux R&D, Novell Inc.
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/3] Try LUN 1 and use bflags
2006-03-29 20:10 [PATCH 0/3] SCSI scanning for PQ3 devs Kurt Garloff
@ 2006-03-29 20:11 ` Kurt Garloff
2006-03-31 16:39 ` Patrick Mansfield
2006-03-29 20:12 ` [PATCH 2/3] Better log messages for PQ3 devs Kurt Garloff
` (4 subsequent siblings)
5 siblings, 1 reply; 11+ messages in thread
From: Kurt Garloff @ 2006-03-29 20:11 UTC (permalink / raw)
To: Linux SCSI list; +Cc: Patrick Mansfield
[-- Attachment #1: Type: text/plain, Size: 2227 bytes --]
From: Kurt Garloff <garloff@suse.de>
Subject: Tolerate PQ 3 at LUN 0 for scanning
Patch-mainline:
References: 158532
Some devices report a peripheral qualifier of 3 for LUN 0; with the original
code, we would still try a REPORT_LUNS scan (if SCSI level is >= 3 or if we
have the BLIST_REPORTLUNS2 passed in), but NOT any sequential scan.
Also, the device at LUN 0 (which is not connected according to the PQ) is not
registered with the OS.
Unfortunately, SANs exist that are SCSI-2 and do NOT support REPORT_LUNS, but
report a unknown device with PQ 3 on LUN 0. We still need to scan them, and
most probably we even need BLIST_SPARSELUN (and BLIST_LARGELUN). See the bug
reference for an infamous example.
This is patch 1/3:
If we end up in sequential scan, at least try LUN 1 for devices
that reported a PQ of 3 for LUN 0.
Also return blacklist flags, even for PQ3 devices.
Acked-by:
Signed-off-by: Kurt Garloff <garloff@suse.de>
Index: linux-2.6.16/drivers/scsi/scsi_scan.c
===================================================================
--- linux-2.6.16.orig/drivers/scsi/scsi_scan.c
+++ linux-2.6.16/drivers/scsi/scsi_scan.c
@@ -860,6 +860,8 @@ static int scsi_probe_and_add_lun(struct
if (scsi_probe_lun(sdev, result, result_len, &bflags))
goto out_free_result;
+ if (bflagsp)
+ *bflagsp = bflags;
/*
* result contains valid SCSI INQUIRY data.
*/
@@ -887,8 +889,6 @@ static int scsi_probe_and_add_lun(struct
sdev->lockable = 0;
scsi_unlock_floptical(sdev, result);
}
- if (bflagsp)
- *bflagsp = bflags;
}
out_free_result:
@@ -945,11 +945,13 @@ static void scsi_sequential_lun_scan(str
sparse_lun = 0;
/*
- * If not sparse lun and no device attached at LUN 0 do not scan
- * any further.
- */
+ * If LUN0 did respond, but did not have an attachable LUN (PQ=3),
+ * we do NOT abort the sequential scan yet, let's try one more
+ * LUN and only abort the scan if we don't find anything there.
+ *
if (!sparse_lun && (lun0_res != SCSI_SCAN_LUN_PRESENT))
return;
+ */
/*
* If less than SCSI_1_CSS, and no special lun scaning, stop
--
Kurt Garloff, Head Architect Linux R&D, Novell Inc.
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 2/3] Better log messages for PQ3 devs
2006-03-29 20:10 [PATCH 0/3] SCSI scanning for PQ3 devs Kurt Garloff
2006-03-29 20:11 ` [PATCH 1/3] Try LUN 1 and use bflags Kurt Garloff
@ 2006-03-29 20:12 ` Kurt Garloff
2006-03-29 20:30 ` Matthew Wilcox
2006-03-29 20:13 ` [PATCH 3/3] BLIST_ATTACH_PQ3 flags Kurt Garloff
` (3 subsequent siblings)
5 siblings, 1 reply; 11+ messages in thread
From: Kurt Garloff @ 2006-03-29 20:12 UTC (permalink / raw)
To: Linux SCSI list; +Cc: Patrick Mansfield
[-- Attachment #1: Type: text/plain, Size: 2995 bytes --]
From: Kurt Garloff <garloff@suse.de>
Subject: Tolerate PQ 3 at LUN 0 for scanning
Patch-mainline:
References: 158532
Some devices report a peripheral qualifier of 3 for LUN 0; with the original
code, we would still try a REPORT_LUNS scan (if SCSI level is >= 3 or if we
have the BLIST_REPORTLUNS2 passed in), but NOT any sequential scan.
Also, the device at LUN 0 (which is not connected according to the PQ) is not
registered with the OS.
Unfortunately, SANs exist that are SCSI-2 and do NOT support REPORT_LUNS, but
report a unknown device with PQ 3 on LUN 0. We still need to scan them, and
most probably we even need BLIST_SPARSELUN (and BLIST_LARGELUN). See the bug
reference for an infamous example.
This patch 2/3:
If a PQ3 device is found, log a message that describes the device
(INQUIRY DATA and C:B:T:U tuple) and make a suggestion for blacklisting
it.
Acked-by:
Signed-off-by: Kurt Garloff <garloff@suse.de>
Index: linux-2.6.16/drivers/scsi/scsi_scan.c
===================================================================
--- linux-2.6.16.orig/drivers/scsi/scsi_scan.c
+++ linux-2.6.16/drivers/scsi/scsi_scan.c
@@ -795,8 +795,31 @@ static inline void scsi_destroy_sdev(str
transport_destroy_device(&sdev->sdev_gendev);
put_device(&sdev->sdev_gendev);
}
+/**
+ * scsi_inq_str - print INQUIRY data from min to max index,
+ * strip trailing whitespace
+ * @buf: Output buffer with at least end-first+1 bytes of space
+ * @inq: Inquiry buffer (input)
+ * @first: Offset of string into inq
+ * @end: Index after last character in inq
+ */
+static unsigned char* scsi_inq_str(unsigned char* buf, unsigned char *inq,
+ unsigned first, unsigned end)
+{
+ unsigned term = 0, idx;
+ for (idx = 0; idx+first < end && idx+first < inq[4]+5; ++idx) {
+ if (inq[idx+first] > 0x20) {
+ buf[idx] = inq[idx+first];
+ term = idx+1;
+ } else {
+ buf[idx] = ' ';
+ }
+ }
+ buf[term] = 0;
+ return buf;
+}
/**
* scsi_probe_and_add_lun - probe a LUN, if a LUN is found add it
* @starget: pointer to target device structure
@@ -873,11 +896,19 @@ static int scsi_probe_and_add_lun(struct
* For disks, this implies that there is no
* logical disk configured at sdev->lun, but there
* is a target id responding.
*/
- SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO
- "scsi scan: peripheral qualifier of 3,"
- " no device added\n"));
+ SCSI_LOG_SCAN_BUS(2, printk(KERN_INFO "scsi scan: periph.qual. of 3,"
+ " device %s not added\n",
+ sdev->sdev_gendev.bus_id));
+ if (lun == 0) {
+ unsigned char vend[9], mod[17];
+ SCSI_LOG_SCAN_BUS(1, printk(KERN_INFO "scsi scan: consider passing "
+ "scsi_mod.dev_flags=%s:%s:0x240 or 0x800240\n",
+ scsi_inq_str(vend, result, 8, 16),
+ scsi_inq_str(mod, result, 16, 32)));
+ }
+
res = SCSI_SCAN_TARGET_PRESENT;
goto out_free_result;
}
--
Kurt Garloff, Head Architect Linux R&D, Novell Inc.
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 3/3] BLIST_ATTACH_PQ3 flags
2006-03-29 20:10 [PATCH 0/3] SCSI scanning for PQ3 devs Kurt Garloff
2006-03-29 20:11 ` [PATCH 1/3] Try LUN 1 and use bflags Kurt Garloff
2006-03-29 20:12 ` [PATCH 2/3] Better log messages for PQ3 devs Kurt Garloff
@ 2006-03-29 20:13 ` Kurt Garloff
2006-04-03 13:16 ` [PATCH 1/3] Try LUN 1 and use bflags Kurt Garloff
` (2 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Kurt Garloff @ 2006-03-29 20:13 UTC (permalink / raw)
To: Linux SCSI list
[-- Attachment #1: Type: text/plain, Size: 2887 bytes --]
From: Kurt Garloff <garloff@suse.de>
Subject: Tolerate PQ 3 at LUN 0 for scanning
Patch-mainline:
References: 158532
Some devices report a peripheral qualifier of 3 for LUN 0; with the original
code, we would still try a REPORT_LUNS scan (if SCSI level is >= 3 or if we
have the BLIST_REPORTLUNS2 passed in), but NOT any sequential scan.
Also, the device at LUN 0 (which is not connected according to the PQ) is not
registered with the OS.
Unfortunately, SANs exist that are SCSI-2 and do NOT support REPORT_LUNS, but
report a unknown device with PQ 3 on LUN 0. We still need to scan them, and
most probably we even need BLIST_SPARSELUN (and BLIST_LARGELUN). See the bug
reference for an infamous example.
This is patch 3/3:
3. Implement the blacklist flag BLIST_ATTACH_PQ3 that makes the scsi
scanning code register PQ3 devices and continues scanning; only sg
will attach thanks to scsi_bus_match().
Acked-by:
Signed-off-by: Kurt Garloff <garloff@suse.de>
Index: linux-2.6.16/drivers/scsi/scsi_scan.c
===================================================================
--- linux-2.6.16.orig/drivers/scsi/scsi_scan.c
+++ linux-2.6.16/drivers/scsi/scsi_scan.c
@@ -888,7 +888,7 @@ static int scsi_probe_and_add_lun(struct
/*
* result contains valid SCSI INQUIRY data.
*/
- if ((result[0] >> 5) == 3) {
+ if (((result[0] >> 5) == 3) && !(bflags & BLIST_ATTACH_PQ3)) {
/*
* For a Peripheral qualifier 3 (011b), the SCSI
* spec says: The device server is not capable of
Index: linux-2.6.16/drivers/scsi/scsi_devinfo.c
===================================================================
--- linux-2.6.16.orig/drivers/scsi/scsi_devinfo.c
+++ linux-2.6.16/drivers/scsi/scsi_devinfo.c
@@ -155,6 +155,8 @@ static struct {
{"HITACHI", "DF400", "*", BLIST_SPARSELUN},
{"HITACHI", "DF500", "*", BLIST_SPARSELUN},
{"HITACHI", "DF600", "*", BLIST_SPARSELUN},
+ {"HITACHI", "DISK-SUBSYSTEM", "*", BLIST_ATTACH_PQ3 | BLIST_SPARSELUN | BLIST_LARGELUN},
+ {"HITACHI", "OPEN-E", "*", BLIST_ATTACH_PQ3 | BLIST_SPARSELUN | BLIST_LARGELUN},
{"HP", "A6189A", NULL, BLIST_SPARSELUN | BLIST_LARGELUN}, /* HP VA7400 */
{"HP", "OPEN-", "*", BLIST_SPARSELUN | BLIST_LARGELUN}, /* HP XP Arrays */
{"HP", "NetRAID-4M", NULL, BLIST_FORCELUN},
Index: linux-2.6.16/include/scsi/scsi_devinfo.h
===================================================================
--- linux-2.6.16.orig/include/scsi/scsi_devinfo.h
+++ linux-2.6.16/include/scsi/scsi_devinfo.h
@@ -28,4 +28,5 @@
#define BLIST_NO_ULD_ATTACH 0x100000 /* device is actually for RAID config */
#define BLIST_SELECT_NO_ATN 0x200000 /* select without ATN */
#define BLIST_RETRY_HWERROR 0x400000 /* retry HARDWARE_ERROR */
+#define BLIST_ATTACH_PQ3 0x800000 /* Scan: Attach to PQ3 devices */
#endif
--
Kurt Garloff, Head Architect Linux R&D, Novell Inc.
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/3] Better log messages for PQ3 devs
2006-03-29 20:12 ` [PATCH 2/3] Better log messages for PQ3 devs Kurt Garloff
@ 2006-03-29 20:30 ` Matthew Wilcox
2006-03-29 22:12 ` Kurt Garloff
0 siblings, 1 reply; 11+ messages in thread
From: Matthew Wilcox @ 2006-03-29 20:30 UTC (permalink / raw)
To: Kurt Garloff, Linux SCSI list, Patrick Mansfield
On Wed, Mar 29, 2006 at 10:12:47PM +0200, Kurt Garloff wrote:
> */
> - SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO
> - "scsi scan: peripheral qualifier of 3,"
> - " no device added\n"));
> + SCSI_LOG_SCAN_BUS(2, printk(KERN_INFO "scsi scan: periph.qual. of 3,"
> + " device %s not added\n",
> + sdev->sdev_gendev.bus_id));
You seem to be suffering from long-line-itis, probably as a result of
too much exposure to ia64 code. How about:
SCSI_LOG_SCAN_BUS(2, printk(KERN_INFO "scsi scan: peripheral "
"qualifier of 3, device %s not added\n",
sdev->sdev_gendev.bus_id));
> + if (lun == 0) {
> + unsigned char vend[9], mod[17];
> + SCSI_LOG_SCAN_BUS(1, printk(KERN_INFO "scsi scan: consider passing "
> + "scsi_mod.dev_flags=%s:%s:0x240 or 0x800240\n",
Likewise:
SCSI_LOG_SCAN_BUS(1, printk(KERN_INFO "scsi scan: "
"consider passing scsi_mod.dev_flags="
"%s:%s:0x240 or 0x800240\n",
> + scsi_inq_str(vend, result, 8, 16),
> + scsi_inq_str(mod, result, 16, 32)));
> + }
> +
> res = SCSI_SCAN_TARGET_PRESENT;
> goto out_free_result;
> }
>
> --
> Kurt Garloff, Head Architect Linux R&D, Novell Inc.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/3] Better log messages for PQ3 devs
2006-03-29 20:30 ` Matthew Wilcox
@ 2006-03-29 22:12 ` Kurt Garloff
2006-03-29 22:23 ` James Bottomley
0 siblings, 1 reply; 11+ messages in thread
From: Kurt Garloff @ 2006-03-29 22:12 UTC (permalink / raw)
To: Matthew Wilcox; +Cc: Linux SCSI list, Patrick Mansfield
[-- Attachment #1: Type: text/plain, Size: 757 bytes --]
Hi Matthew,
On Wed, Mar 29, 2006 at 01:30:09PM -0700, Matthew Wilcox wrote:
> On Wed, Mar 29, 2006 at 10:12:47PM +0200, Kurt Garloff wrote:
> > */
> > - SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO
> > - "scsi scan: peripheral qualifier of 3,"
> > - " no device added\n"));
> > + SCSI_LOG_SCAN_BUS(2, printk(KERN_INFO "scsi scan: periph.qual. of 3,"
> > + " device %s not added\n",
> > + sdev->sdev_gendev.bus_id));
>
> You seem to be suffering from long-line-itis, probably as a result of
> too much exposure to ia64 code. How about:a
Indeed, my terminals are all more than 80 chars wide these days :-)
If that's the only concern, I'm happy to address it.
Thx,
--
Kurt Garloff, Head Architect Linux R&D, Novell Inc.
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/3] Better log messages for PQ3 devs
2006-03-29 22:12 ` Kurt Garloff
@ 2006-03-29 22:23 ` James Bottomley
0 siblings, 0 replies; 11+ messages in thread
From: James Bottomley @ 2006-03-29 22:23 UTC (permalink / raw)
To: Kurt Garloff; +Cc: Matthew Wilcox, Linux SCSI list, Patrick Mansfield
On Thu, 2006-03-30 at 00:12 +0200, Kurt Garloff wrote:
> Indeed, my terminals are all more than 80 chars wide these days :-)
> If that's the only concern, I'm happy to address it.
Actually, if you're going to re-roll, please use the sdev_printk() macro
instead of printk on the device bus_id.
James
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/3] Try LUN 1 and use bflags
2006-03-29 20:11 ` [PATCH 1/3] Try LUN 1 and use bflags Kurt Garloff
@ 2006-03-31 16:39 ` Patrick Mansfield
0 siblings, 0 replies; 11+ messages in thread
From: Patrick Mansfield @ 2006-03-31 16:39 UTC (permalink / raw)
To: Kurt Garloff, Linux SCSI list
On Wed, Mar 29, 2006 at 10:11:47PM +0200, Kurt Garloff wrote:
> @@ -945,11 +945,13 @@ static void scsi_sequential_lun_scan(str
> sparse_lun = 0;
>
> /*
> - * If not sparse lun and no device attached at LUN 0 do not scan
> - * any further.
> - */
> + * If LUN0 did respond, but did not have an attachable LUN (PQ=3),
> + * we do NOT abort the sequential scan yet, let's try one more
> + * LUN and only abort the scan if we don't find anything there.
> + *
> if (!sparse_lun && (lun0_res != SCSI_SCAN_LUN_PRESENT))
> return;
> + */
Just delete all that, and get rid of lun0_res.
-- Patrick Mansfield
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/3] Try LUN 1 and use bflags
2006-03-29 20:10 [PATCH 0/3] SCSI scanning for PQ3 devs Kurt Garloff
` (2 preceding siblings ...)
2006-03-29 20:13 ` [PATCH 3/3] BLIST_ATTACH_PQ3 flags Kurt Garloff
@ 2006-04-03 13:16 ` Kurt Garloff
2006-04-03 13:18 ` [PATCH 2/3] Better log messages for PQ3 devs Kurt Garloff
2006-04-03 13:20 ` [PATCH 3/3] BLIST_ATTACH_PQ3 flags Kurt Garloff
5 siblings, 0 replies; 11+ messages in thread
From: Kurt Garloff @ 2006-04-03 13:16 UTC (permalink / raw)
To: Linux SCSI list, Patrick Mansfield
[-- Attachment #1: Type: text/plain, Size: 3589 bytes --]
Hi,
patch redone, incorporating Pat Mansfield's suggestion to remove the
lun0_res variable, as it was unused after patching.
From: Kurt Garloff <garloff@suse.de>
Subject: Tolerate PQ 3 at LUN 0 for scanning
Patch-mainline:
References: 158532
Some devices report a peripheral qualifier of 3 for LUN 0; with the original
code, we would still try a REPORT_LUNS scan (if SCSI level is >= 3 or if we
have the BLIST_REPORTLUNS2 passed in), but NOT any sequential scan.
Also, the device at LUN 0 (which is not connected according to the PQ) is not
registered with the OS.
Unfortunately, SANs exist that are SCSI-2 and do NOT support REPORT_LUNS, but
report a unknown device with PQ 3 on LUN 0. We still need to scan them, and
most probably we even need BLIST_SPARSELUN (and BLIST_LARGELUN). See the bug
reference for an infamous example.
This is patch 1/3:
If we end up in sequential scan, at least try LUN 1 for devices
that reported a PQ of 3 for LUN 0.
Also return blacklist flags, even for PQ3 devices.
Acked-by:
Signed-off-by: Kurt Garloff <garloff@suse.de>
Index: linux-2.6.16/drivers/scsi/scsi_scan.c
===================================================================
--- linux-2.6.16.orig/drivers/scsi/scsi_scan.c
+++ linux-2.6.16/drivers/scsi/scsi_scan.c
@@ -859,8 +859,10 @@ static int scsi_probe_and_add_lun(struct
if (scsi_probe_lun(sdev, result, result_len, &bflags))
goto out_free_result;
+ if (bflagsp)
+ *bflagsp = bflags;
/*
* result contains valid SCSI INQUIRY data.
*/
if ((result[0] >> 5) == 3) {
@@ -886,10 +888,8 @@ static int scsi_probe_and_add_lun(struct
if (bflags & BLIST_KEY) {
sdev->lockable = 0;
scsi_unlock_floptical(sdev, result);
}
- if (bflagsp)
- *bflagsp = bflags;
}
out_free_result:
kfree(result);
@@ -912,9 +912,8 @@ static int scsi_probe_and_add_lun(struct
/**
* scsi_sequential_lun_scan - sequentially scan a SCSI target
* @starget: pointer to target structure to scan
* @bflags: black/white list flag for LUN 0
- * @lun0_res: result of scanning LUN 0
*
* Description:
* Generally, scan from LUN 1 (LUN 0 is assumed to already have been
* scanned) to some maximum lun until a LUN is found with no device
@@ -922,10 +921,9 @@ static int scsi_probe_and_add_lun(struct
*
* Modifies sdevscan->lun.
**/
static void scsi_sequential_lun_scan(struct scsi_target *starget,
- int bflags, int lun0_res, int scsi_level,
- int rescan)
+ int bflags, int scsi_level, int rescan)
{
unsigned int sparse_lun, lun, max_dev_lun;
struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
@@ -944,15 +942,8 @@ static void scsi_sequential_lun_scan(str
} else
sparse_lun = 0;
/*
- * If not sparse lun and no device attached at LUN 0 do not scan
- * any further.
- */
- if (!sparse_lun && (lun0_res != SCSI_SCAN_LUN_PRESENT))
- return;
-
- /*
* If less than SCSI_1_CSS, and no special lun scaning, stop
* scanning; this matches 2.4 behaviour, but could just be a bug
* (to continue scanning a SCSI_1_CSS device).
*
@@ -1363,9 +1354,9 @@ static void __scsi_scan_target(struct de
* The REPORT LUN did not scan the target,
* do a sequential scan.
*/
scsi_sequential_lun_scan(starget, bflags,
- res, starget->scsi_level, rescan);
+ starget->scsi_level, rescan);
}
out_reap:
/* now determine if the target has any children at all
--
Kurt Garloff, Head Architect Linux R&D, Novell Inc.
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 2/3] Better log messages for PQ3 devs
2006-03-29 20:10 [PATCH 0/3] SCSI scanning for PQ3 devs Kurt Garloff
` (3 preceding siblings ...)
2006-04-03 13:16 ` [PATCH 1/3] Try LUN 1 and use bflags Kurt Garloff
@ 2006-04-03 13:18 ` Kurt Garloff
2006-04-03 13:20 ` [PATCH 3/3] BLIST_ATTACH_PQ3 flags Kurt Garloff
5 siblings, 0 replies; 11+ messages in thread
From: Kurt Garloff @ 2006-04-03 13:18 UTC (permalink / raw)
To: Linux SCSI list, Patrick Mansfield
[-- Attachment #1: Type: text/plain, Size: 3123 bytes --]
Hi,
wrapped the lines at column 80 as suggested by Matthew and used
sedv_printk as suggested by James.
From: Kurt Garloff <garloff@suse.de>
Subject: Tolerate PQ 3 at LUN 0 for scanning
Patch-mainline:
References: 158532
Some devices report a peripheral qualifier of 3 for LUN 0; with the original
code, we would still try a REPORT_LUNS scan (if SCSI level is >= 3 or if we
have the BLIST_REPORTLUNS2 passed in), but NOT any sequential scan.
Also, the device at LUN 0 (which is not connected according to the PQ) is not
registered with the OS.
Unfortunately, SANs exist that are SCSI-2 and do NOT support REPORT_LUNS, but
report a unknown device with PQ 3 on LUN 0. We still need to scan them, and
most probably we even need BLIST_SPARSELUN (and BLIST_LARGELUN). See the bug
reference for an infamous example.
This patch 2/3:
If a PQ3 device is found, log a message that describes the device
(INQUIRY DATA and C:B:T:U tuple) and make a suggestion for blacklisting
it.
Acked-by:
Signed-off-by: Kurt Garloff <garloff@suse.de>
Index: linux-2.6.16/drivers/scsi/scsi_scan.c
===================================================================
--- linux-2.6.16.orig/drivers/scsi/scsi_scan.c
+++ linux-2.6.16/drivers/scsi/scsi_scan.c
@@ -795,8 +795,31 @@ static inline void scsi_destroy_sdev(str
transport_destroy_device(&sdev->sdev_gendev);
put_device(&sdev->sdev_gendev);
}
+/**
+ * scsi_inq_str - print INQUIRY data from min to max index,
+ * strip trailing whitespace
+ * @buf: Output buffer with at least end-first+1 bytes of space
+ * @inq: Inquiry buffer (input)
+ * @first: Offset of string into inq
+ * @end: Index after last character in inq
+ */
+static unsigned char* scsi_inq_str(unsigned char* buf, unsigned char *inq,
+ unsigned first, unsigned end)
+{
+ unsigned term = 0, idx;
+ for (idx = 0; idx+first < end && idx+first < inq[4]+5; ++idx) {
+ if (inq[idx+first] > 0x20) {
+ buf[idx] = inq[idx+first];
+ term = idx+1;
+ } else {
+ buf[idx] = ' ';
+ }
+ }
+ buf[term] = 0;
+ return buf;
+}
/**
* scsi_probe_and_add_lun - probe a LUN, if a LUN is found add it
* @starget: pointer to target device structure
@@ -875,11 +898,20 @@ static int scsi_probe_and_add_lun(struct
* For disks, this implies that there is no
* logical disk configured at sdev->lun, but there
* is a target id responding.
*/
- SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO
- "scsi scan: peripheral qualifier of 3,"
- " no device added\n"));
+ SCSI_LOG_SCAN_BUS(2, sdev_printk(KERN_INFO, sdev, "scsi scan:"
+ " peripheral qualifier of 3, device not"
+ " added\n"))
+ if (lun == 0) {
+ unsigned char vend[9], mod[17];
+ SCSI_LOG_SCAN_BUS(1, sdev_printk(KERN_INFO, sdev,
+ "scsi scan: consider passing scsi_mod."
+ "dev_flags=%s:%s:0x240 or 0x800240\n",
+ scsi_inq_str(vend, result, 8, 16),
+ scsi_inq_str(mod, result, 16, 32)));
+ }
+
res = SCSI_SCAN_TARGET_PRESENT;
goto out_free_result;
}
--
Kurt Garloff, Head Architect Linux R&D, Novell Inc.
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 3/3] BLIST_ATTACH_PQ3 flags
2006-03-29 20:10 [PATCH 0/3] SCSI scanning for PQ3 devs Kurt Garloff
` (4 preceding siblings ...)
2006-04-03 13:18 ` [PATCH 2/3] Better log messages for PQ3 devs Kurt Garloff
@ 2006-04-03 13:20 ` Kurt Garloff
5 siblings, 0 replies; 11+ messages in thread
From: Kurt Garloff @ 2006-04-03 13:20 UTC (permalink / raw)
To: Linux SCSI list, Patrick Mansfield
[-- Attachment #1: Type: text/plain, Size: 3294 bytes --]
Hi,
rediff, just for completeness. (Unchanged from old patch that still
applies with minimal offset.)
From: Kurt Garloff <garloff@suse.de>
Subject: Tolerate PQ 3 at LUN 0 for scanning
Patch-mainline:
References: 158532
Some devices report a peripheral qualifier of 3 for LUN 0; with the original
code, we would still try a REPORT_LUNS scan (if SCSI level is >= 3 or if we
have the BLIST_REPORTLUNS2 passed in), but NOT any sequential scan.
Also, the device at LUN 0 (which is not connected according to the PQ) is not
registered with the OS.
Unfortunately, SANs exist that are SCSI-2 and do NOT support REPORT_LUNS, but
report a unknown device with PQ 3 on LUN 0. We still need to scan them, and
most probably we even need BLIST_SPARSELUN (and BLIST_LARGELUN). See the bug
reference for an infamous example.
This is patch 3/3:
3. Implement the blacklist flag BLIST_ATTACH_PQ3 that makes the scsi
scanning code register PQ3 devices and continues scanning; only sg
will attach thanks to scsi_bus_match().
Acked-by:
Signed-off-by: Kurt Garloff <garloff@suse.de>
Index: linux-2.6.16/drivers/scsi/scsi_scan.c
===================================================================
--- linux-2.6.16.orig/drivers/scsi/scsi_scan.c
+++ linux-2.6.16/drivers/scsi/scsi_scan.c
@@ -887,9 +887,9 @@ static int scsi_probe_and_add_lun(struct
*bflagsp = bflags;
/*
* result contains valid SCSI INQUIRY data.
*/
- if ((result[0] >> 5) == 3) {
+ if (((result[0] >> 5) == 3) && !(bflags & BLIST_ATTACH_PQ3)) {
/*
* For a Peripheral qualifier 3 (011b), the SCSI
* spec says: The device server is not capable of
* supporting a physical device on this logical
Index: linux-2.6.16/drivers/scsi/scsi_devinfo.c
===================================================================
--- linux-2.6.16.orig/drivers/scsi/scsi_devinfo.c
+++ linux-2.6.16/drivers/scsi/scsi_devinfo.c
@@ -154,8 +154,10 @@ static struct {
{"Generic", "USB Storage-SMC", "0207", BLIST_FORCELUN | BLIST_INQUIRY_36},
{"HITACHI", "DF400", "*", BLIST_SPARSELUN},
{"HITACHI", "DF500", "*", BLIST_SPARSELUN},
{"HITACHI", "DF600", "*", BLIST_SPARSELUN},
+ {"HITACHI", "DISK-SUBSYSTEM", "*", BLIST_ATTACH_PQ3 | BLIST_SPARSELUN | BLIST_LARGELUN},
+ {"HITACHI", "OPEN-E", "*", BLIST_ATTACH_PQ3 | BLIST_SPARSELUN | BLIST_LARGELUN},
{"HP", "A6189A", NULL, BLIST_SPARSELUN | BLIST_LARGELUN}, /* HP VA7400 */
{"HP", "OPEN-", "*", BLIST_SPARSELUN | BLIST_LARGELUN}, /* HP XP Arrays */
{"HP", "NetRAID-4M", NULL, BLIST_FORCELUN},
{"HP", "HSV100", NULL, BLIST_REPORTLUN2 | BLIST_NOSTARTONADD},
Index: linux-2.6.16/include/scsi/scsi_devinfo.h
===================================================================
--- linux-2.6.16.orig/include/scsi/scsi_devinfo.h
+++ linux-2.6.16/include/scsi/scsi_devinfo.h
@@ -27,5 +27,6 @@
#define BLIST_NOT_LOCKABLE 0x80000 /* don't use PREVENT-ALLOW commands */
#define BLIST_NO_ULD_ATTACH 0x100000 /* device is actually for RAID config */
#define BLIST_SELECT_NO_ATN 0x200000 /* select without ATN */
#define BLIST_RETRY_HWERROR 0x400000 /* retry HARDWARE_ERROR */
+#define BLIST_ATTACH_PQ3 0x800000 /* Scan: Attach to PQ3 devices */
#endif
--
Kurt Garloff, Head Architect Linux R&D, Novell Inc.
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2006-04-03 13:20 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-29 20:10 [PATCH 0/3] SCSI scanning for PQ3 devs Kurt Garloff
2006-03-29 20:11 ` [PATCH 1/3] Try LUN 1 and use bflags Kurt Garloff
2006-03-31 16:39 ` Patrick Mansfield
2006-03-29 20:12 ` [PATCH 2/3] Better log messages for PQ3 devs Kurt Garloff
2006-03-29 20:30 ` Matthew Wilcox
2006-03-29 22:12 ` Kurt Garloff
2006-03-29 22:23 ` James Bottomley
2006-03-29 20:13 ` [PATCH 3/3] BLIST_ATTACH_PQ3 flags Kurt Garloff
2006-04-03 13:16 ` [PATCH 1/3] Try LUN 1 and use bflags Kurt Garloff
2006-04-03 13:18 ` [PATCH 2/3] Better log messages for PQ3 devs Kurt Garloff
2006-04-03 13:20 ` [PATCH 3/3] BLIST_ATTACH_PQ3 flags Kurt Garloff
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).