diff --git a/0003-sg3_utils-1.42-delete-lun-rescan-scsi-bus-report-error.patch b/0003-sg3_utils-1.42-delete-lun-rescan-scsi-bus-report-error.patch index d4adb6a6120858ae3aedeec42cfe22dc734fe1bc..c1e1156db2a8930c1805ebcfaf9e26190ca1fe8d 100644 --- a/0003-sg3_utils-1.42-delete-lun-rescan-scsi-bus-report-error.patch +++ b/0003-sg3_utils-1.42-delete-lun-rescan-scsi-bus-report-error.patch @@ -11,7 +11,7 @@ diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh index 25a5f2a..dc3026a 100755 --- a/scripts/rescan-scsi-bus.sh +++ b/scripts/rescan-scsi-bus.sh -@@ -491,7 +491,7 @@ dolunscan() +@@ -502,7 +502,7 @@ dolunscan() # Well known lun transition case. Only for Direct-Access devs (type 0) # If block directory exists && and PQUAL != 0, we unmapped lun0 and just have a well-known lun # If block directory doesn't exist && PQUAL == 0, we mapped a real lun0 @@ -20,7 +20,7 @@ index 25a5f2a..dc3026a 100755 if [ $RC = 2 ] ; then if [ -e "$devpath" ] ; then if [ -d "$devpath/block" ] ; then -@@ -500,7 +500,7 @@ dolunscan() +@@ -511,7 +511,7 @@ dolunscan() RC=0 # Set this so the system leaves the existing well known lun alone. This is a lun 0 with no block directory fi fi @@ -29,7 +29,7 @@ index 25a5f2a..dc3026a 100755 if [ -e "$devpath" ] ; then if [ ! -d "$devpath/block" ] ; then remappedlun0=1 # Transition from well-known to real lun 0 -@@ -512,7 +512,7 @@ dolunscan() +@@ -523,7 +523,7 @@ dolunscan() # Special case: lun 0 just got added (for reportlunscan), # so make sure we correctly treat it as new @@ -38,13 +38,13 @@ index 25a5f2a..dc3026a 100755 SCSISTR="" printf "\r\e[A\e[A\e[A" fi -@@ -535,7 +535,7 @@ dolunscan() +@@ -546,7 +546,7 @@ dolunscan() sleep 0.02 else echo "scsi remove-single-device $devnr" > /proc/scsi/scsi - if [ $RC -eq 1 ] || [ "$lun" -eq 0 ] ; then + if [ $RC -eq 1 ] || [ x"$lun" = x0 ] ; then - # Try readding, should fail if device is gone + # Try reading, should fail if device is gone echo "scsi add-single-device $devnr" > /proc/scsi/scsi fi -- diff --git a/0005-rescan-scsi-bus.sh-apply-fix-for-r-from-https-github.patch b/0005-rescan-scsi-bus.sh-apply-fix-for-r-from-https-github.patch deleted file mode 100644 index f5772e69f4972f9a9dae8350d96c06d6a3ea1642..0000000000000000000000000000000000000000 --- a/0005-rescan-scsi-bus.sh-apply-fix-for-r-from-https-github.patch +++ /dev/null @@ -1,43 +0,0 @@ -From fc72119f67614152d635452856ec9894474599e4 Mon Sep 17 00:00:00 2001 -From: Douglas Gilbert -Date: Mon, 3 Jan 2022 17:49:24 +0000 -Subject: [PATCH] rescan-scsi-bus.sh: apply fix for '-r' from - https://github.com/doug-gilbert/sg3_utils/pull/10/ from Nitin U. Yewale, - broken by rev 867 - -git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@929 6180dd3e-e324-4e3e-922d-17de1ae2f315 -Conflict: only keep rescan-scsi-bus's changes, change of following files -are removed: - BSD_LICENSE - CREDITS - ChangeLog - debian/changelog - doc/rescan-scsi-bus.sh.8 - doc/sg3_utils.8 - sg3_utils.spec - - --- - scripts/rescan-scsi-bus.sh | 6 ++++++ - 1 file changed, 6 insertions(+) - - diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh - index 16a7642..57fbe66 100755 - --- a/scripts/rescan-scsi-bus.sh - +++ b/scripts/rescan-scsi-bus.sh - @@ -307,7 +307,13 @@ testonline () - IPREV=$(echo "$INQ" | grep 'Product revision level:' | sed 's/^[^:]*: \(.*\)$/\1/') - STR=$(printf " Vendor: %-08s Model: %-16s Rev: %-4s" "$IVEND" "$IPROD" "$IPREV") - IPTYPE=$(echo "$INQ" | sed -n 's/.* Device_type=\([0-9]*\) .*/\1/p') - + if [ -z "$IPTYPE" ]; then - + IPTYPE=$(echo "$INQ" | sed -n 's/.* PDT=\([0-9]*\) .*/\1/p') - + fi - IPQUAL=$(echo "$INQ" | sed -n 's/ *PQual=\([0-9]*\) Device.*/\1/p') - + if [ -z "$IPQUAL" ] ; then - + IPQUAL=$(echo "$INQ" | sed -n 's/ *PQual=\([0-9]*\) PDT.*/\1/p') - + fi - if [ "$IPQUAL" != 0 ] ; then - [ -z "$IPQUAL" ] && IPQUAL=3 - [ -z "$IPTYPE" ] && IPTYPE=31 - -- - 2.34.1 - diff --git a/0006-rescan-scsi-bus-sgdevice26-do-not-traverse-sg-class-.patch b/0006-rescan-scsi-bus-sgdevice26-do-not-traverse-sg-class-.patch deleted file mode 100644 index f80e0a289153a470c9ea9543c41d562d1443fa04..0000000000000000000000000000000000000000 --- a/0006-rescan-scsi-bus-sgdevice26-do-not-traverse-sg-class-.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 4ea97e60c544ad44ee7396c815064d87f0d25874 Mon Sep 17 00:00:00 2001 -From: Douglas Gilbert -Date: Sun, 7 Aug 2022 02:49:03 +0000 -Subject: [PATCH] rescan-scsi-bus: sgdevice26: do not traverse sg class if - scsi_device isnot added - -For system which has a massive number of scsi_devices, it would takes a long time to -traverse /sys/class/scsi_generic to find a related sg. If the scsi_device of specific -scsiid host:channel:target:lun did not added, the traverse would find no sg neither. - -Signed-off-by: Wenchao Hao - -From: https://github.com/doug-gilbert/sg3_utils/pull/21 - - -git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@965 6180dd3e-e324-4e3e-922d-17de1ae2f315 ---- - scripts/rescan-scsi-bus.sh | 19 +++++++++++-------- - 1 file changed, 11 insertions(+), 8 deletions(-) - -diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh -index 0c33384..f3e3b2c 100755 ---- a/scripts/rescan-scsi-bus.sh -+++ b/scripts/rescan-scsi-bus.sh -@@ -184,18 +184,21 @@ sgdevice26 () - { - local gendev - -+ # if the scsi device has not been added, then there would not -+ # a related sgdev. So it's pointless to scan all sgs to find -+ # a related sg. -+ scsidev=/sys/class/scsi_device/${host}:${channel}:${id}:${lun} -+ if [ ! -e "$scsidev" ]; then -+ SGDEV="" -+ return -+ fi -+ - gendev=/sys/class/scsi_device/${host}:${channel}:${id}:${lun}/device/generic - if [ -e "$gendev" ] ; then - SGDEV=$(basename "$(readlink "$gendev")") -- else -- for SGDEV in /sys/class/scsi_generic/sg*; do -- DEV=$(readlink "$SGDEV/device") -- if [ "${DEV##*/}" = "$host:$channel:$id:$lun" ] ; then -- SGDEV=$(basename "$SGDEV"); return -- fi -- done -- SGDEV="" -+ return - fi -+ SGDEV="" - } - - # Find sg device with 2.4 report-devs extensions --- -2.27.0 - diff --git a/0007-rescan-scsi-bus.sh-add-option-no-lip-scan.patch b/0007-rescan-scsi-bus.sh-add-option-no-lip-scan.patch deleted file mode 100644 index 5f3766d702dfcef017da83461922fbdeb5c737d1..0000000000000000000000000000000000000000 --- a/0007-rescan-scsi-bus.sh-add-option-no-lip-scan.patch +++ /dev/null @@ -1,62 +0,0 @@ -From b109bf4c5bacf65d32d2ab4fb990efb5230fda27 Mon Sep 17 00:00:00 2001 -From: Douglas Gilbert -Date: Fri, 12 Aug 2022 02:55:43 +0000 -Subject: [PATCH] rescan-scsi-bus.sh: add option --no-lip-scan - -lip is a FC operation and can be used to rescan device but it can not -specify the channel and target. So add a new option to scan FC hosts -according to the SCSI general interface in sysfs: -/sys/class/scsi_host/hostX/scan. - -The default value of no_lip_scan is 0 which does not change the -default behavior. - -Fix https://github.com/doug-gilbert/sg3_utils/issues/20 - -Signed-off-by: Wenchao Hao - -git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@967 6180dd3e-e324-4e3e-922d-17de1ae2f315 ---- - scripts/rescan-scsi-bus.sh | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh -index 31ae736..67dccf3 100755 ---- a/scripts/rescan-scsi-bus.sh -+++ b/scripts/rescan-scsi-bus.sh -@@ -1158,6 +1158,7 @@ if [ "@$1" = @--help ] || [ "@$1" = @-h ] || [ "@$1" = "@-?" ] ; then - echo "--largelun: Tell kernel to support LUNs > 7 even on SCSI2 devs" - echo "--luns=LIST: Scan only lun(s) in LIST" - echo "--multipath: same as -m" -+ echo "--no-lip-scan: don't scan FC Host with issue-lip" - echo "--nooptscan: don't stop looking for LUNs if 0 is not found" - echo "--remove: same as -r" - echo "--reportlun2: Tell kernel to try REPORT_LUN even on SCSI2 devices" -@@ -1226,6 +1227,7 @@ mp_enable= - lipreset=-1 - declare -i scan_flags=0 - ignore_rev=0 -+no_lip_scan=0 - - # Scan options - opt="$1" -@@ -1260,6 +1262,7 @@ while [ ! -z "$opt" ] && [ -z "${opt##-*}" ] ; do - -largelun) scan_flags=$((scan_flags|0x200)) ;; - -luns=*) arg=${opt#-luns=}; lunsearch=$(expandlist "$arg") ;; - -multipath) mp_enable=1 ;; -+ -no-lip-scan) no_lip_scan=1 ;; - -nooptscan) optscan=0 ;; - -nosync) sync=0 ;; - -remove) remove=1 ;; -@@ -1337,7 +1340,7 @@ elif [ $resize -eq 1 ] ; then - else - for host in $hosts; do - echo -n "Scanning host $host " -- if [ -e "/sys/class/fc_host/host$host" ] ; then -+ if [ $no_lip_scan -eq 0 ] && [ -e "/sys/class/fc_host/host$host" ] ; then - # It's pointless to do a target scan on FC - issue_lip=/sys/class/fc_host/host$host/issue_lip - if [ -e "$issue_lip" ] && [ "$lipreset" -ge 0 ] ; then --- -2.27.0 - diff --git a/0008-rescan-scsi-bus.sh-speed-testonline.patch b/0008-rescan-scsi-bus.sh-speed-testonline.patch deleted file mode 100644 index 535bd1a8b54e0008782109b74f2495f730c6c502..0000000000000000000000000000000000000000 --- a/0008-rescan-scsi-bus.sh-speed-testonline.patch +++ /dev/null @@ -1,33 +0,0 @@ -From e680e840140d19cb3419ff92595bc2c91de3368a Mon Sep 17 00:00:00 2001 -From: Douglas Gilbert -Date: Mon, 26 Sep 2022 21:41:45 +0000 -Subject: [PATCH 1/2] rescan-scsi-bus.sh speed testonline() - -speed testonline() function when -peripheral_qualifier != 0 in the standard INQUIRY -response. See: -https://github.com/doug-gilbert/sg3_utils/issues/24 - -git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@972 6180dd3e-e324-4e3e-922d-17de1ae2f315 - -Conflict: Reserve changes about rescan-scsi-bus only ---- - scripts/rescan-scsi-bus.sh | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh -index 67dccf3..0e7697b 100755 ---- a/scripts/rescan-scsi-bus.sh -+++ b/scripts/rescan-scsi-bus.sh -@@ -276,7 +276,7 @@ testonline () - - # Handle in progress of becoming ready and unit attention - while [ $RC = 2 -o $RC = 6 ] && [ $ctr -le 30 ] ; do -- if [ $RC = 2 ] && [ "$RMB" != "1" ] ; then -+ if [ $RC = 2 ] && [ "$RMB" != "1" ] && [ sg_inq /dev/$SGDEV | grep -q -i "PQual=0" ] ; then - echo -n "." - let LN+=1 - sleep 1 --- -2.35.3 - diff --git a/0009-rescan-scsi-bus-speed-large-multipath-scans.patch b/0009-rescan-scsi-bus-speed-large-multipath-scans.patch deleted file mode 100644 index 513b8ce6b0349f39c055eb0df6349d60a711512b..0000000000000000000000000000000000000000 --- a/0009-rescan-scsi-bus-speed-large-multipath-scans.patch +++ /dev/null @@ -1,130 +0,0 @@ -From fe62f3e9ce96927bf9bcfb19b33447b54aafdc1f Mon Sep 17 00:00:00 2001 -From: Douglas Gilbert -Date: Fri, 30 Sep 2022 08:58:39 +0000 -Subject: [PATCH 2/2] rescan-scsi-bus: speed large multipath scans - -Speed multipath scans with many LUNs by caching multipath -LUN info in temporary file, see: - https://github.com/doug-gilbert/sg3_utils/issues/22 -Fix small bug in last commit, see: - https://github.com/doug-gilbert/sg3_utils/issues/24 - -git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@973 6180dd3e-e324-4e3e-922d-17de1ae2f315 - -Conflict: reserve changes about rescan-scsi-bus only ---- - scripts/rescan-scsi-bus.sh | 57 ++++++++++++++++++++++++++------------ - 1 file changed, 40 insertions(+), 17 deletions(-) - -diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh -index 0e7697b..7508dba 100755 ---- a/scripts/rescan-scsi-bus.sh -+++ b/scripts/rescan-scsi-bus.sh -@@ -6,6 +6,7 @@ - - VERSION="20180615" - SCAN_WILD_CARD=4294967295 -+TMPLUNINFOFILE="/tmp/rescan-scsi-mpath-info.txt" - - setcolor () - { -@@ -276,7 +277,7 @@ testonline () - - # Handle in progress of becoming ready and unit attention - while [ $RC = 2 -o $RC = 6 ] && [ $ctr -le 30 ] ; do -- if [ $RC = 2 ] && [ "$RMB" != "1" ] && [ sg_inq /dev/$SGDEV | grep -q -i "PQual=0" ] ; then -+ if [ $RC = 2 ] && [ "$RMB" != "1" ] && sg_inq /dev/$SGDEV | grep -q -i "PQual=0" ; then - echo -n "." - let LN+=1 - sleep 1 -@@ -777,6 +778,33 @@ searchexisting() - done - } - -+getallmultipathinfo() -+{ -+ local mp= -+ local uuid= -+ local dmtmp= -+ local maj_min= -+ local tmpfile= -+ -+ truncate -s 0 $TMPLUNINFOFILE -+ for mp in $($DMSETUP ls --target=multipath | cut -f 1) ; do -+ [ "$mp" = "No" ] && break; -+ maj_min=$($DMSETUP status "$mp" | cut -d " " -f14) -+ if [ ! -L /dev/mapper/${mp} ]; then -+ echo "softlink /dev/mapper/${mp} not available." -+ continue -+ fi -+ local ret=$(readlink /dev/mapper/$mp 2>/dev/null) -+ if [[ $? -ne 0 || -z "$ret" ]]; then -+ echo "readlink /dev/mapper/$mp failed. check multipath status." -+ continue -+ fi -+ dmtmp=$(basename $ret) -+ uuid=$(cut -f2 -d- "/sys/block/$dmtmp/dm/uuid") -+ echo "$mp $maj_min $dmtmp $uuid" >> $TMPLUNINFOFILE -+ done -+} -+ - # Go through all of the existing devices and figure out any that have been remapped - findremapped() - { -@@ -815,6 +843,8 @@ findremapped() - udevadm_settle 2>&1 /dev/null - echo "Done" - -+ getallmultipathinfo -+ - # See what changed and reload the respective multipath device if applicable - while read -r hctl sddev id_serial_old ; do - remapped=0 -@@ -945,7 +975,6 @@ findmultipath() - local dev="$1" - local find_mismatch="$2" - local mp= -- local mp2= - local found_dup=0 - local maj_min= - -@@ -955,27 +984,21 @@ findmultipath() - fi - - maj_min=$(cat "/sys/block/$dev/dev") -- for mp in $($DMSETUP ls --target=multipath | cut -f 1) ; do -- [ "$mp" = "No" ] && break; -- if "$DMSETUP" status "$mp" | grep -q " $maj_min "; then -- # With two arguments, look up current uuid from sysfs -- # if it doesn't match what was passed, this multipath -- # device is not updated, so this is a remapped LUN -- if [ -n "$find_mismatch" ] ; then -- mp2=$($MULTIPATH -l "$mp" | egrep -o "dm-[0-9]+") -- mp2=$(cut -f2 -d- "/sys/block/$mp2/dm/uuid") -- if [ "$find_mismatch" != "$mp2" ] ; then -- addmpathtolist "$mp" -- found_dup=1 -- fi -- continue -+ mp=$(cat $TMPLUNINFOFILE | grep -w "$maj_min" | cut -d " " -f1) -+ if [ -n "$mp" ]; then -+ if [ -n "$find_mismatch" ] ; then -+ uuid=$(cat $TMPLUNINFOFILE | grep -w "$maj_min" | cut -d " " -f4) -+ if [ "$find_mismatch" != "$uuid" ] ; then -+ addmpathtolist "$mp" -+ found_dup=1 - fi -+ else - # Normal mode: Find the first multipath with the sdev - # and add it to the list - addmpathtolist "$mp" - return - fi -- done -+ fi - - # Return 1 to signal that a duplicate was found to the calling function - if [ $found_dup -eq 1 ] ; then --- -2.35.3 - diff --git a/sg3_utils-1.47.tar.xz b/sg3_utils-1.47.tar.xz deleted file mode 100644 index f52f9c408ac6d3386d70bd2979f5764b3cd549fb..0000000000000000000000000000000000000000 Binary files a/sg3_utils-1.47.tar.xz and /dev/null differ diff --git a/sg3_utils-1.48.tar.xz b/sg3_utils-1.48.tar.xz new file mode 100644 index 0000000000000000000000000000000000000000..80e8a70aa745b6a0b4d8026a80d78e4a455a2dbc Binary files /dev/null and b/sg3_utils-1.48.tar.xz differ diff --git a/sg3_utils.spec b/sg3_utils.spec index f52762a8362cbf85a8f6da4a48b502a0742bfbaf..101381c908d0c1dd0924167a12143f63d8788c80 100644 --- a/sg3_utils.spec +++ b/sg3_utils.spec @@ -1,21 +1,16 @@ Name: sg3_utils -Version: 1.47 -Release: 3 +Version: 1.48 +Release: 1 Summary: Utilities that send SCSI commands to devices. License: GPL-2.0-or-later AND BSD URL: http://sg.danny.cz/sg/sg3_utils.html Source0: http://sg.danny.cz/sg/p/sg3_utils-%{version}.tar.xz -Patch0: 0000-sg3_utils-1.37-rescan-scsi-findremapped-enhance.patch -Patch1: 0001-sg3_utils-1.37-rescan-downpress.patch -Patch2: 0002-bugfix-sg3_utils-fix-syntax-error.patch -Patch3: 0003-sg3_utils-1.42-delete-lun-rescan-scsi-bus-report-error.patch -Patch4: 0004-sg3_utils-rescan-scsi-bus-list-all-LUNs-in-one-line.patch -Patch5: 0005-rescan-scsi-bus.sh-apply-fix-for-r-from-https-github.patch -Patch6: 0006-rescan-scsi-bus-sgdevice26-do-not-traverse-sg-class-.patch -Patch7: 0007-rescan-scsi-bus.sh-add-option-no-lip-scan.patch -Patch8: 0008-rescan-scsi-bus.sh-speed-testonline.patch -Patch9: 0009-rescan-scsi-bus-speed-large-multipath-scans.patch +Patch0: 0000-sg3_utils-1.37-rescan-scsi-findremapped-enhance.patch +Patch1: 0001-sg3_utils-1.37-rescan-downpress.patch +Patch2: 0002-bugfix-sg3_utils-fix-syntax-error.patch +Patch3: 0003-sg3_utils-1.42-delete-lun-rescan-scsi-bus-report-error.patch +Patch4: 0004-sg3_utils-rescan-scsi-bus-list-all-LUNs-in-one-line.patch Provides: %{name}-libs Obsoletes: %{name}-libs @@ -79,6 +74,9 @@ rm -rf $RPM_BUILD_ROOT/%{_libdir}/*.la %{_mandir}/man8/* %changelog +* Fri Oct 27 2023 Paul Thomas - 1.48-1 +- update to version 1.48 + * Thu Nov 3 2022 volcanodragon - 1.47-3 - backport speed multipath scan patches from mainline