On Fri, 2019-04-12 at 17:07 +-0800, Li Zhong wrote: +AD4 commit 84961f28e9d1 (+ACIAWw-SCSI+AF0 Don't add scsi+AF8-device for devices that +AD4 return PQ+AD0-1, PDT+AD0-0x1f+ACI) returns SCSI+AF8-SCAN+AF8-TARGET+AF8-PRESENT if inquiry returns +AD4 PQ+AD0-1, and PDT +AD0 0x1f. However, from the scsi spec, it seemed setting PQ+AD0-1, +AD4 and PDT to the type it is capable to support, can also mean the device +AD4 is not connected. E.g. we see an IBM/2145 returns PQ+AD0-1 and PDT+AD0-0 +AD4 for a non mapped lun (details attached at the end). +AD4 +AD4 This patch changes the check condition a bit, so the check don't require +AD4 PTD to be 0x1f when PQ+AD0-1. +AD4 +AD4 +ACQ echo 0 0 1 +AD4 /sys/class/scsi+AF8-host/host1/scan +AD4 +AFs 2483.722186+AF0 scsi 1:0:0:1: scsi scan: INQUIRY pass 1 length 36 +AD4 +AFs 2483.725687+AF0 scsi 1:0:0:1: scsi scan: INQUIRY successful with code 0x0 +AD4 +AFs 2483.729171+AF0 scsi 1:0:0:1: scsi scan: INQUIRY pass 2 length 109 +AD4 +AFs 2483.732481+AF0 scsi 1:0:0:1: scsi scan: INQUIRY successful with code 0x0 +AD4 +AFs 2483.735911+AF0 scsi 1:0:0:1: Direct-Access IBM 2145 0000 PQ: 1 ANSI: 6 +AD4 +AFs 2483.741282+AF0 scsi 1:0:0:1: Attached scsi generic sg2 type 0 +AD4 +AD4 +ACQ tail /proc/scsi/scsi +AD4 Attached devices: +AD4 Host: scsi1 Channel: 00 Id: 00 Lun: 00 +AD4 Vendor: IBM Model: 2145 Rev: 0000 +AD4 Type: Direct-Access ANSI SCSI revision: 06 +AD4 Host: scsi0 Channel: 00 Id: 00 Lun: 00 +AD4 Vendor: IBM Model: 2145 Rev: 0000 +AD4 Type: Direct-Access ANSI SCSI revision: 06 +AD4 Host: scsi1 Channel: 00 Id: 00 Lun: 01 +AD4 Vendor: IBM Model: 2145 Rev: 0000 +AD4 Type: Direct-Access ANSI SCSI revision: 06 +AD4 +AD4 +ACQ lsscsi +AD4 +AFs-0:0:0:0+AF0 disk IBM 2145 0000 /dev/sdb +AD4 +AFs-1:0:0:0+AF0 disk IBM 2145 0000 /dev/sda +AD4 +AFs-1:0:0:1+AF0 disk IBM 2145 0000 - +AD4 +AD4 Signed-off-by: Li Zhong +ADw-lizhongfs+AEA-gmail.com+AD4 +AD4 --- +AD4 drivers/scsi/scsi+AF8-scan.c +AHw 4 ++1filechanged2insertions(), 2 deletions(-) +AD4 +AD4 diff --git a/drivers/scsi/scsi+AF8-scan.c b/drivers/scsi/scsi+AF8-scan.c +AD4 index 53380e07b40e..eb72644e7915 100644 +AD4 --- a/drivers/scsi/scsi+AF8-scan.c +AD4 +++b/drivers/scsi/scsiscanc11438+11438static int scsi+AF8-probe+AF8-and+AF8-add+AF8-lun(struct scsi+AF8-target +ACo-starget, +AD4 +ACo PDT+AD0-00h Direct-access device (floppy) +AD4 +ACo PDT+AD0-1Fh none (no FDD connected to the requested logical unit) +AD4 +ACo-/ +AD4 - if (((result+AFs-0+AF0 +AD4APg 5) +AD0APQ 1 +AHwAfA starget-+AD4-pdt+AF8-1f+AF8-for+AF8-no+AF8-lun) +ACYAJg +AD4 - (result+AFs-0+AF0 +ACY 0x1f) +AD0APQ 0x1f +ACYAJg +AD4 if (((result+AFs-0+AF0 +AD4APg 5) +AD0APQ 1 +AHwAfA +AD4 (starget-+AD4-pdt+AF8-1f+AF8-for+AF8-no+AF8-lun +ACYAJg (result+AFs-0+AF0 +ACY 0x1f) +AD0APQ 0x1f)) +ACYAJg +AD4 +ACE-scsi+AF8-is+AF8-wlun(lun)) +AHs +AD4 SCSI+AF8-LOG+AF8-SCAN+AF8-BUS(3, sdev+AF8-printk(KERN+AF8-INFO, sdev, +AD4 +ACI-scsi scan: peripheral device type+ACI Should the comment above that if-statement be updated? Thanks, Bart.