scsi: core: map PQ=1, PDT=other values to SCSI_SCAN_TARGET_PRESENT
commit 84961f28e9
("[SCSI] Don't add scsi_device for devices that return
PQ=1, PDT=0x1f") returns SCSI_SCAN_TARGET_PRESENT if inquiry returns PQ=1,
and PDT = 0x1f. However, from the scsi spec, it seemed setting PQ=1, and
PDT to the type it is capable to support, can also mean the device is not
connected. E.g. we see an IBM/2145 returns PQ=1 and PDT=0 for a non-mapped
lun (details attached at the end).
This patch changes the check condition a bit, so the check don't require
PTD to be 0x1f when PQ=1.
$ echo 0 0 1 > /sys/class/scsi_host/host1/scan
[ 2483.722186] scsi 1:0:0:1: scsi scan: INQUIRY pass 1 length 36
[ 2483.725687] scsi 1:0:0:1: scsi scan: INQUIRY successful with code 0x0
[ 2483.729171] scsi 1:0:0:1: scsi scan: INQUIRY pass 2 length 109
[ 2483.732481] scsi 1:0:0:1: scsi scan: INQUIRY successful with code 0x0
[ 2483.735911] scsi 1:0:0:1: Direct-Access IBM 2145 0000 PQ: 1 ANSI: 6
[ 2483.741282] scsi 1:0:0:1: Attached scsi generic sg2 type 0
$ tail /proc/scsi/scsi
Attached devices:
Host: scsi1 Channel: 00 Id: 00 Lun: 00
Vendor: IBM Model: 2145 Rev: 0000
Type: Direct-Access ANSI SCSI revision: 06
Host: scsi0 Channel: 00 Id: 00 Lun: 00
Vendor: IBM Model: 2145 Rev: 0000
Type: Direct-Access ANSI SCSI revision: 06
Host: scsi1 Channel: 00 Id: 00 Lun: 01
Vendor: IBM Model: 2145 Rev: 0000
Type: Direct-Access ANSI SCSI revision: 06
$ lsscsi
[0:0:0:0] disk IBM 2145 0000 /dev/sdb
[1:0:0:0] disk IBM 2145 0000 /dev/sda
[1:0:0:1] disk IBM 2145 0000 -
Signed-off-by: Li Zhong <lizhongfs@gmail.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
7c3f8ca8e4
commit
948e922fc4
@ -1129,7 +1129,8 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget,
|
|||||||
* that no LUN is present, so don't add sdev in these cases.
|
* that no LUN is present, so don't add sdev in these cases.
|
||||||
* Two specific examples are:
|
* Two specific examples are:
|
||||||
* 1) NetApp targets: return PQ=1, PDT=0x1f
|
* 1) NetApp targets: return PQ=1, PDT=0x1f
|
||||||
* 2) USB UFI: returns PDT=0x1f, with the PQ bits being "reserved"
|
* 2) IBM/2145 targets: return PQ=1, PDT=0
|
||||||
|
* 3) USB UFI: returns PDT=0x1f, with the PQ bits being "reserved"
|
||||||
* in the UFI 1.0 spec (we cannot rely on reserved bits).
|
* in the UFI 1.0 spec (we cannot rely on reserved bits).
|
||||||
*
|
*
|
||||||
* References:
|
* References:
|
||||||
@ -1143,8 +1144,8 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget,
|
|||||||
* PDT=00h Direct-access device (floppy)
|
* PDT=00h Direct-access device (floppy)
|
||||||
* PDT=1Fh none (no FDD connected to the requested logical unit)
|
* PDT=1Fh none (no FDD connected to the requested logical unit)
|
||||||
*/
|
*/
|
||||||
if (((result[0] >> 5) == 1 || starget->pdt_1f_for_no_lun) &&
|
if (((result[0] >> 5) == 1 ||
|
||||||
(result[0] & 0x1f) == 0x1f &&
|
(starget->pdt_1f_for_no_lun && (result[0] & 0x1f) == 0x1f)) &&
|
||||||
!scsi_is_wlun(lun)) {
|
!scsi_is_wlun(lun)) {
|
||||||
SCSI_LOG_SCAN_BUS(3, sdev_printk(KERN_INFO, sdev,
|
SCSI_LOG_SCAN_BUS(3, sdev_printk(KERN_INFO, sdev,
|
||||||
"scsi scan: peripheral device type"
|
"scsi scan: peripheral device type"
|
||||||
|
Loading…
Reference in New Issue
Block a user