Commit 84961f28 authored by dave wysochanski's avatar dave wysochanski Committed by James Bottomley

[SCSI] Don't add scsi_device for devices that return PQ=1, PDT=0x1f

Some targets may return slight variations of PQ and PDT to indicate
no LUN mapped.  USB UFI setting PDT=0x1f but having reserved bits for
PQ is one example, and NetApp targets returning PQ=1 and PDT=0x1f is
another.  Both instances seem like reasonable responses according to
SPC-3 and UFI specs.

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.
Signed-off-by: default avatarDave Wysochanski <davidw@netapp.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 8c867b25
...@@ -893,11 +893,26 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget, ...@@ -893,11 +893,26 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget,
} }
/* /*
* Non-standard SCSI targets may set the PDT to 0x1f (unknown or * Some targets may set slight variations of PQ and PDT to signal
* no device type) instead of using the Peripheral Qualifier to * that no LUN is present, so don't add sdev in these cases.
* indicate that no LUN is present. For example, USB UFI does this. * Two specific examples are:
* 1) NetApp targets: return PQ=1, PDT=0x1f
* 2) USB UFI: returns PDT=0x1f, with the PQ bits being "reserved"
* in the UFI 1.0 spec (we cannot rely on reserved bits).
*
* References:
* 1) SCSI SPC-3, pp. 145-146
* 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."
* PDT=0x1f: "Unknown or no device type"
* 2) USB UFI 1.0, p. 20
* PDT=00h Direct-access device (floppy)
* PDT=1Fh none (no FDD connected to the requested logical unit)
*/ */
if (starget->pdt_1f_for_no_lun && (result[0] & 0x1f) == 0x1f) { if (((result[0] >> 5) == 1 || starget->pdt_1f_for_no_lun) &&
(result[0] & 0x1f) == 0x1f) {
SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO
"scsi scan: peripheral device type" "scsi scan: peripheral device type"
" of 31, no device added\n")); " of 31, no device added\n"));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment