diff --git a/add-lunsearch-filter-to-searchexisting.patch b/add-lunsearch-filter-to-searchexisting.patch new file mode 100644 index 0000000..6cd88b0 --- /dev/null +++ b/add-lunsearch-filter-to-searchexisting.patch @@ -0,0 +1,44 @@ +From: Sebastian Parschauer +Date: Wed, 31 Aug 2016 15:34:23 +0200 +Subject: [PATCH] rescan-scsi-bus.sh: Add lunsearch filter to searchexisting() +References: bnc#981452 +Patch-Mainline: not yet, sent but waiting for upstream response + +A user has reported that `rescan-scsi-bus.sh --luns=` prints +all existing LUNs and scans all new LUNs instead of only the ones +specified. The problem is that searchexisting() always calls +doreportlun() and is missing the lunsearch filter e.g. used in +dosearch(). +So add the required lunsearch filter from dosearch() to +searchexisting(). + +Signed-off-by: Sebastian Parschauer +--- + scripts/rescan-scsi-bus.sh | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh +index fad4868..5bc4a95 100755 +--- a/scripts/rescan-scsi-bus.sh ++++ b/scripts/rescan-scsi-bus.sh +@@ -711,7 +711,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 + } + +-- +2.6.6 + diff --git a/sg3_utils.changes b/sg3_utils.changes index 4e03272..662478a 100644 --- a/sg3_utils.changes +++ b/sg3_utils.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Sep 7 16:26:26 CEST 2016 - sparschauer@suse.de + +- using "--lun" now works correctly (bsc#981452), adding patch: + * add-lunsearch-filter-to-searchexisting.patch + ------------------------------------------------------------------- Fri Apr 29 09:13:41 CEST 2016 - hare@suse.de diff --git a/sg3_utils.spec b/sg3_utils.spec index 65047e9..ac4de22 100644 --- a/sg3_utils.spec +++ b/sg3_utils.spec @@ -28,6 +28,7 @@ Url: http://sg.danny.cz/sg/sg3_utils.html Source: sg3_utils-%{version}.tar.xz Source1: 40-usb-blacklist.rules Patch1: sgut-libversioning.diff +Patch2: add-lunsearch-filter-to-searchexisting.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: libtool BuildRequires: udev @@ -84,6 +85,7 @@ applications that want to make use of libsgutils. %prep %setup -q %patch1 -p1 +%patch2 -p1 %build autoreconf -fi