update 0003-sg3_utils-1.42-delete-lun-rescan-scsi-bus-report-error.patch.

This commit is contained in:
Markeryang 2020-07-17 16:08:48 +08:00 committed by Gitee
parent 1caf77ddd2
commit ba4575a553

View File

@ -1,52 +1,52 @@
From 56fb49584c56afe1f222b3ee9fc12c7cfd079286 Mon Sep 17 00:00:00 2001 From 424d6468d62d09328c19cd54de1132be0940f049 Mon Sep 17 00:00:00 2001
From: wubo <wubo40@huawei.com> From: sunshihao <sunshihao@huawei.com>
Date: Tue, 27 Aug 2019 14:16:48 +0800 Date: Thu, 16 Apr 2020 11:05:20 +0800
Subject: [PATCH] rescan-scsi-bus.sh fix delete lun report error Subject: [PATCH 4/4] sg3_utils-1.42-delete-lun-rescan-scsi-bus-report-error
--- ---
scripts/rescan-scsi-bus.sh | 8 ++++---- scripts/rescan-scsi-bus.sh | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-) 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh
index 4b23ba4..3f18403 100755 index 25a5f2a..dc3026a 100755
--- a/scripts/rescan-scsi-bus.sh --- a/scripts/rescan-scsi-bus.sh
+++ b/scripts/rescan-scsi-bus.sh +++ b/scripts/rescan-scsi-bus.sh
@@ -434,7 +434,7 @@ dolunscan() @@ -491,7 +491,7 @@ dolunscan()
# Well known lun transition case. Only for Direct-Access devs (type 0) # 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 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 # If block directory doesn't exist && PQUAL == 0, we mapped a real lun0
- if test $lun -eq 0 -a $IPTYPE -eq 0 ; then - if [ "$lun" -eq 0 ] && [ $IPTYPE -eq 0 ] ; then
+ if test x"$lun" = x0 -a x"$IPTYPE" = x0 ; then + if [ "x$lun" -eq x0 ] && [ x$IPTYPE -eq 0 ] ; then
if test $RC = 2 ; then if [ $RC = 2 ] ; then
if test -e /sys/class/scsi_device/${host}:${channel}:${id}:${lun}/device; then if [ -e "$devpath" ] ; then
if test -d /sys/class/scsi_device/${host}:${channel}:${id}:${lun}/device/block ; then if [ -d "$devpath/block" ] ; then
@@ -443,7 +443,7 @@ dolunscan() @@ -500,7 +500,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 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
fi fi
- elif test $RC = 0 -a $IPTYPE -eq 0; then - elif [ $RC = 0 ] && [ $IPTYPE -eq 0 ] ; then
+ elif test $RC = 0 -a x"$IPTYPE" = x0; then + elif [ $RC = 0 ] && [ x$IPTYPE -eq x0 ] ; then
if test -e /sys/class/scsi_device/${host}:${channel}:${id}:${lun}/device; then if [ -e "$devpath" ] ; then
if test ! -d /sys/class/scsi_device/${host}:${channel}:${id}:${lun}/device/block ; then if [ ! -d "$devpath/block" ] ; then
remappedlun0=1 # Transition from well-known to real lun 0 remappedlun0=1 # Transition from well-known to real lun 0
@@ -455,7 +455,7 @@ dolunscan() @@ -512,7 +512,7 @@ dolunscan()
# Special case: lun 0 just got added (for reportlunscan), # Special case: lun 0 just got added (for reportlunscan),
# so make sure we correctly treat it as new # so make sure we correctly treat it as new
- if test "$lun" = "0" -a "$1" = "1" -a -z "$remappedlun0"; then - if [ "$lun" = "0" ] && [ "$1" = "1" ] && [ -z "$remappedlun0" ] ; then
+ if test x"$lun" = x"0" -a "$1" = "1" -a -z "$remappedlun0"; then + if [ x"$lun" = x"0" ] && [ "$1" = "1" ] && [ -z "$remappedlun0" ] ; then
SCSISTR="" SCSISTR=""
printf "\r\e[A\e[A\e[A" printf "\r\e[A\e[A\e[A"
fi fi
@@ -478,7 +478,7 @@ dolunscan() @@ -535,7 +535,7 @@ dolunscan()
sleep 0.02 sleep 0.02
else else
echo "scsi remove-single-device $devnr" > /proc/scsi/scsi echo "scsi remove-single-device $devnr" > /proc/scsi/scsi
- if test $RC -eq 1 -o $lun -eq 0 ; then - if [ $RC -eq 1 ] || [ "$lun" -eq 0 ] ; then
+ if test $RC -eq 1 -o x"$lun" = x0 ; then + if [ $RC -eq 1 ] || [ x"$lun" -eq x0 ] ; then
# Try readding, should fail if device is gone # Try readding, should fail if device is gone
echo "scsi add-single-device $devnr" > /proc/scsi/scsi echo "scsi add-single-device $devnr" > /proc/scsi/scsi
fi fi
-- --
1.8.3.1 2.19.1