From c387f9de93750a04380f068803ce9da340cf45f5 Mon Sep 17 00:00:00 2001 From: Sebastian Parschauer Date: Wed, 31 Aug 2016 15:34:23 +0200 Subject: [PATCH] rescan-scsi-bus.sh: Add lunsearch filter to searchexisting() 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(). References: bsc#981452 Signed-off-by: Sebastian Parschauer --- scripts/rescan-scsi-bus.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh index 5f43d6d..1f957b0 100755 --- a/scripts/rescan-scsi-bus.sh +++ b/scripts/rescan-scsi-bus.sh @@ -715,7 +715,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.12.0