rescan-scsi-bus dolunscan modify break to return

This commit is contained in:
eulerstorage 2020-03-13 19:14:30 +08:00
parent ecf8da6ebc
commit a767ab8de3
5 changed files with 76 additions and 54 deletions

View File

@ -0,0 +1,66 @@
From 48a93dc7dfc8b13f89b0a20ede711de2c54fd0fc Mon Sep 17 00:00:00 2001
From: Doug Gilbert <dgilbert@interlog.com>
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

View File

@ -1,21 +0,0 @@
diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh
index 9bfd3be..417dd1d 100755
--- a/scripts/rescan-scsi-bus.sh
+++ b/scripts/rescan-scsi-bus.sh
@@ -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

View File

@ -1,28 +0,0 @@
diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh
index 417dd1d..4b23ba4 100755
--- a/scripts/rescan-scsi-bus.sh
+++ b/scripts/rescan-scsi-bus.sh
@@ -594,6 +594,7 @@ doreportlun()
if test $tmplun -eq $lun ; then
inlist=1
dolunscan $lun0added
+ [ $? -eq 1 ] && break
else
newsearch="$newsearch $tmplun"
fi
@@ -610,6 +611,7 @@ doreportlun()
# Add new ones and check stale ones
for lun in $targetluns $lunremove; do
dolunscan $lun0added
+ [ $? -eq 1 ] && break
done
}
@@ -629,6 +631,7 @@ dosearch ()
else
for lun in $lunsearch; do
dolunscan
+ [ $? -eq 1 ] && break
done
fi
done

View File

@ -1,6 +1,6 @@
Name: sg3_utils
Version: 1.42
Release: 9
Release: 10
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
@ -13,9 +13,8 @@ Patch9000: 9000-sg3_utils-1.37-rescan-scsi-findremapped-enhance.patch
Patch9001: 9001-sg3_utils-1.37-rescan-downpress.patch
Patch9002: 9002-bugfix-sg3_utils-fix-syntax-error.patch
Patch9003: 9003-sg_inq-fix-potential-unbounded-loop-in-export.patch
Patch9004: 9004-break-to-return.patch
Patch9005: 9005-for-dolunscan.patch
Patch9006: 9006-sg3_utils-1.42-delete-lun-rescan-scsi-bus-report-error.patch
Patch0002: 0002-rescan-scsi-bus-dolunscan-break-to-return.patch
Patch9004: 9004-sg3_utils-1.42-delete-lun-rescan-scsi-bus-report-error.patch
Provides: %{name}-libs
Obsoletes: %{name}-libs
@ -76,6 +75,12 @@ rm -rf $RPM_BUILD_ROOT/%{_libdir}/*.la
%{_mandir}/man8/*
%changelog
* Fri Mar 13 2020 wubo <wubo40@huawei.com> - 1.42-10
- Type:enhancemnet
- ID:NA
- SUG:restart
- DESCi: modify rescan-scsi-bus dolunscan break to return
* Tue Sep 24 2019 wubo <wubo40@huawei.com> - 1.42-9
- Type:enhancemnet
- ID:NA
@ -91,7 +96,7 @@ rm -rf $RPM_BUILD_ROOT/%{_libdir}/*.la
* Wed Aug 21 2019 wubo <wubo40@huawei.com> - 1.42-6.7
- change patch name
* Mon Jul 18 2019 wangye<wangye54@huawei.com> - 1.42-6.6
* Thu Jul 18 2019 wangye<wangye54@huawei.com> - 1.42-6.6
- Type:bugfix
- ID:NA
- SUG:NA