Hide Forgot
Description of problem: Version-Release number of selected component (if applicable): From sg3_utils-1.28-6.el6 In sg3_utils-1.28-5, `rescan-scsi-bus.sh --luns=1` will only rescan luns numbered 1, which is expected. Starting from sg3_utils-1.28-6, `rescan-scsi-bus.sh --luns=1` will scan all luns, which we don't like. How reproducible: Steps to Reproduce: 1. Attach multiple SCSI disk to a RHEL6 VM. 2. Run `rescan-scsi-bus.sh --luns=1` Actual results: It scan all luns. ~]# ./rescan-scsi-bus-test2.sh --luns=1 which: no multipath in (/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin) Scanning SCSI subsystem for new devices Scanning host 0 for SCSI target IDs 0 1 2 3 4 5 6 7, LUNs 1 Scanning for device 0 0 0 0 ... OLD: Host: scsi0 Channel: 00 Id: 00 Lun: 00 Vendor: QEMU Model: QEMU DVD-ROM Rev: 1.5. Type: CD-ROM ANSI SCSI revision: 05 Scanning host 1 for SCSI target IDs 0 1 2 3 4 5 6 7, LUNs 1 Scanning host 2 for SCSI target IDs 0 1 2 3 4 5 6 7, LUNs 1 Scanning for device 2 0 0 0 ... OLD: Host: scsi2 Channel: 00 Id: 00 Lun: 00 Vendor: QEMU Model: QEMU HARDDISK Rev: 1.5. Type: Direct-Access ANSI SCSI revision: 05 Scanning for device 2 0 0 1 ... OLD: Host: scsi2 Channel: 00 Id: 00 Lun: 01 Vendor: QEMU Model: QEMU HARDDISK Rev: 1.5. Type: Direct-Access ANSI SCSI revision: 05 0 new or changed device(s) found. 0 remapped or resized device(s) found. 0 device(s) removed. Expected results: Should only scan lun 1. ~]# ./rescan-scsi-bus-test1.sh --luns=1 Host adapter 0 (ata_piix) found. Host adapter 1 (ata_piix) found. Host adapter 2 (virtio_scsi) found. Scanning SCSI subsystem for new devices Scanning host 0 for SCSI target IDs 0 1 2 3 4 5 6 7, LUNs 1 Scanning host 1 channels 0 for SCSI target IDs 0 1 2 3 4 5 6 7, LUNs 1 Scanning host 2 channels 0 for SCSI target IDs 0 1 2 3 4 5 6 7, LUNs 1 Scanning for device 2 0 0 1 ... OLD: Host: scsi2 Channel: 00 Id: 00 Lun: 01 Vendor: QEMU Model: QEMU HARDDISK Rev: 1.5. Type: Direct-Access ANSI SCSI revision: 05 0 new device(s) found. 0 device(s) removed. Additional info: This unexpected behavior was introduced by: * Tue Jun 24 2014 Dan Horák <dhorak> - 1.28-6 - update rescan-scsi-bus.sh to 1.57 (#857200) - Resolves: #857200
Thanks for report, I believe this was reported and fixed upstream as well - https://github.com/hreinecke/sg3_utils/issues/3 ... https://github.com/hreinecke/sg3_utils/pull/4/commits/66af0c64749682e5d5dfcb372e2e521b5a583794 patch is supposed to correct this wrong behaviour. Can you please check this and confirm the fix if possible?
The patch would be: diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh index fad4868..bbe2228 100755 --- a/scripts/rescan-scsi-bus.sh +++ b/scripts/rescan-scsi-bus.sh @@ -715,7 +715,16 @@ searchexisting() else match=1 fi - test $match -eq 1 && doreportlun + + test $match -eq 0 && continue + + if [ -z "$lunsearch" ] ; then + doreportlun + else + for lun in $lunsearch ; do + dolunscan + done + fi done }
Hello I have tested sg3_utils-1.28-13.el6 and passed, move to verified
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2018:1872