From 48a93dc7dfc8b13f89b0a20ede711de2c54fd0fc Mon Sep 17 00:00:00 2001 From: Doug Gilbert Date: Fri, 13 Mar 2020 18:43:57 +0800 Subject: [PATCH] rescan-scsi-bus-dolunscan-break-to-return --- scripts/rescan-scsi-bus.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh index 9bfd3be..8bee514 100755 --- a/scripts/rescan-scsi-bus.sh +++ b/scripts/rescan-scsi-bus.sh @@ -494,7 +494,7 @@ dolunscan() if test -z "$SCSISTR" -a $RC != 1 -a "$remappedlun0" != "1"; then printf "\r${red}DEL: $norm\r\n\n" # In the event we're replacing with a well known node, we need to let it continue, to create the replacement node - test "$remappedlun0" != "2" && return 1 + test "$remappedlun0" != "2" && return 2 fi fi if test -z "$SCSISTR" -o -n "$remappedlun0"; then @@ -513,7 +513,7 @@ dolunscan() printf "\r\e[A"; # Optimization: if lun==0, stop here (only if in non-remove mode) if test x$lun = x0 -a -z "$remove" -a x$optscan = x1; then - break; + return 1; fi else if test "$remappedlun0" != "2" ; then @@ -521,6 +521,7 @@ dolunscan() fi fi fi + return 0; } # Perform report lun scan on $host $channel $id using REPORT_LUNS @@ -593,6 +594,7 @@ doreportlun() if test $tmplun -eq $lun ; then inlist=1 dolunscan $lun0added + [ $? -eq 1 ] && break else newsearch="$newsearch $tmplun" fi @@ -609,6 +611,7 @@ doreportlun() # Add new ones and check stale ones for lun in $targetluns $lunremove; do dolunscan $lun0added + [ $? -eq 1 ] && break done } @@ -628,6 +631,7 @@ dosearch () else for lun in $lunsearch; do dolunscan + [ $? -eq 1 ] && break done fi done -- 1.8.3.1