rep lun scan if LUN 0 not connected
Hi,
is there any special reason for this code in scsi_scan_target() ?
/*
* Scan LUN 0, if there is some response, scan further. Ideally, we
* would not configure LUN 0 until all LUNs are scanned.
*/
res = scsi_probe_and_add_lun(shost, channel, id, 0, &bflags, &sdev,
rescan);
if (res == SCSI_SCAN_LUN_PRESENT) {
if (scsi_report_lun_scan(sdev, bflags, rescan) != 0)
/*
* The REPORT LUN did not scan the target,
* do a sequential scan.
*/
scsi_sequential_lun_scan(shost, channel, id, bflags,
res, sdev->scsi_level, rescan);
} else if (res == SCSI_SCAN_TARGET_PRESENT) {
/*
* There's a target here, but lun 0 is offline so we
* can't use the report_lun scan. Fall back to a
* sequential lun scan with a bflags of SPARSELUN and
* a default scsi level of SCSI_2
*/
scsi_sequential_lun_scan(shost, channel, id, BLIST_SPARSELUN,
SCSI_SCAN_TARGET_PRESENT, SCSI_2, rescan);
}The return values from scsi_probe_and_add_lun() are
* SCSI_SCAN_NO_RESPONSE: could not allocate or setup a Scsi_Device
* SCSI_SCAN_TARGET_PRESENT: target responded, but no device is
* attached at the LUN
* SCSI_SCAN_LUN_PRESENT: a new Scsi_Device was allocated and initialized
I don't see a reason not to try scsi_report_lun_scan() if the target is present, but does not report to support a unit at LUN number 0.
Is there anything I overlooked in SPC3? Or any devices which behave in strange ways?
I have come across a device recently (HITACHI F500F) that does report PQ/PDevTp 3/0x1f on LUN 0, and does return a perfectly sensible answer (*) on REPORT_LUNS sent down to the target LUN 0. Actually, the raid storage devs I came across all react reasonably to REPORT_LUNS despite their behaviour on LUN 0 was varying. PQ/PDevTp = 0/3, 1/3 were the other popular answers.
(*) Some devs sent strange LUN formats that Linux does not reasonably
convert to a 32bit integer. We should move on to using opaque 8byte LUN handles some day.
So I would suggest to remove the special case forSCSI_SCAN_TARGET_PRESENT and just use
if (res != SCSI_SCAN_NO_RESPONSE) {
if (scsi_report_lun_scan(sdev, bflags, rescan) != 0)Flames? Patch wanted?
Signature · 2 lines
Kurt Garloff <[email protected]> Cologne, DE SUSE LINUX AG / Novell, Nuernberg, DE Director SUSE Labs
Quoted 35 lines · Kurt Garloff
Hi,
is there any special reason for this code in
scsi_scan_target()?/* * Scan LUN 0, if there is some response, scan further. Ideally, we * would not configure LUN 0 until all LUNs are scanned. */ res = scsi_probe_and_add_lun(shost, channel, id, 0, &bflags, &sdev, rescan); if (res == SCSI_SCAN_LUN_PRESENT) { if (scsi_report_lun_scan(sdev, bflags, rescan) != 0) /* * The REPORT LUN did not scan the target, * do a sequential scan. */ scsi_sequential_lun_scan(shost, channel, id, bflags, res, sdev->scsi_level, rescan); } else if (res == SCSI_SCAN_TARGET_PRESENT) { /* * There's a target here, but lun 0 is offline so we * can't use the report_lun scan. Fall back to a * sequential lun scan with a bflags of SPARSELUN and * a default scsi level of SCSI_2 */ scsi_sequential_lun_scan(shost, channel, id, BLIST_SPARSELUN, SCSI_SCAN_TARGET_PRESENT, SCSI_2, rescan); }The return values from
scsi_probe_and_add_lun()are
*SCSI_SCAN_NO_RESPONSE: could not allocate or setup aScsi_Device
*SCSI_SCAN_TARGET_PRESENT: target responded, but no device is
* attached at the LUN
*SCSI_SCAN_LUN_PRESENT: a newScsi_Devicewas allocated and initialized
Quoted 5 lines
I don't see a reason not to try
scsi_report_lun_scan()if the target is present, but does not report to support a unit at LUN number 0.Is there anything I overlooked in SPC3? Or any devices which behave in strange ways?
Normal.
Quoted 11 lines
I have come across a device recently (HITACHI F500F) that does report PQ/PDevTp 3/0x1f on LUN 0, and does return a perfectly sensible answer (*) on
REPORT_LUNSsent down to the target LUN 0. Actually, the raid storage devs I came across all react reasonably toREPORT_LUNSdespite their behaviour on LUN 0 was varying. PQ/PDevTp = 0/3, 1/3 were the other popular answers.(*) Some devs sent strange LUN formats that Linux does not reasonably
convert to a 32bit integer. We should move on to using opaque 8byte LUN handles some day.
Quoted 7 lines
So I would suggest to remove the special case for
SCSI_SCAN_TARGET_PRESENTand just useif (res != SCSI_SCAN_NO_RESPONSE) { if (scsi_report_lun_scan(sdev, bflags, rescan) != 0)Flames? Patch wanted?
Patch. Older code always did the REPORT LUNS if there was any target response at all.
The sdev is deleted if SCSI_SCAN_TARGET_PRESENT, so some hack is required to keep LUN 0 or ???.