diff mbox series

rescan-scsi-bus.sh: use LUN wildcard in idlist

Message ID 20181025084911.19958-1-mwilck@suse.com (mailing list archive)
State Not Applicable
Headers show
Series rescan-scsi-bus.sh: use LUN wildcard in idlist | expand

Commit Message

Martin Wilck Oct. 25, 2018, 8:49 a.m. UTC
By scanning for LUN 0 only, we may encounter a device that the
kernel won't add (e.g. peripheral device type 31) and which may
thus never appear in sysfs for us to use for REPORT LUNS. That
causes LUN additions for such devices to be missed by
"rescan-iscsi-bus.sh -a".

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 scripts/rescan-scsi-bus.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Martin Wilck Nov. 8, 2018, 2:47 p.m. UTC | #1
On Thu, 2018-10-25 at 10:49 +0200, Martin Wilck wrote:
> By scanning for LUN 0 only, we may encounter a device that the
> kernel won't add (e.g. peripheral device type 31) and which may
> thus never appear in sysfs for us to use for REPORT LUNS. That
> causes LUN additions for such devices to be missed by
> "rescan-iscsi-bus.sh -a".
> 
> Signed-off-by: Martin Wilck <mwilck@suse.com>
> ---
>  scripts/rescan-scsi-bus.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Ping - no opinions on this one?

Thanks,
Martin

> 
> diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh
> index 6989208..a2aa8d8 100755
> --- a/scripts/rescan-scsi-bus.sh
> +++ b/scripts/rescan-scsi-bus.sh
> @@ -376,7 +376,7 @@ idlist ()
>  
>    oldlist=$(ls /sys/class/scsi_device/ | sed -n
> "s/${host}:${channel}:\([0-9]*:[0-9]*\)/\1/p" | uniq)
>    # Rescan LUN 0 to check if we found new targets
> -  echo "${channel} - 0" > /sys/class/scsi_host/host${host}/scan
> +  echo "${channel} - -" > /sys/class/scsi_host/host${host}/scan
>    newlist=$(ls /sys/class/scsi_device/ | sed -n
> "s/${host}:${channel}:\([0-9]*:[0-9]*\)/\1/p" | uniq)
>    for newid in $newlist ; do
>      oldid=$newid
Douglas Gilbert Nov. 8, 2018, 3:20 p.m. UTC | #2
On 2018-10-25 10:49 a.m., Martin Wilck wrote:
> By scanning for LUN 0 only, we may encounter a device that the
> kernel won't add (e.g. peripheral device type 31) and which may
> thus never appear in sysfs for us to use for REPORT LUNS. That
> causes LUN additions for such devices to be missed by
> "rescan-iscsi-bus.sh -a".

Seems reasonable and applies clean to my development true. For
rescan-scsi-bus.sh I usually defer to Hannes. I have put it in
pending a decision from him.

BTW My alphas and betas (and releases) of sg3_utils go out through
Hannes' github account [https://github.com/hreinecke/sg3_utils] and/or
http://sg.danny.cz/sg . At the moment the latter is more up to date.

Doug Gilbert

> Signed-off-by: Martin Wilck <mwilck@suse.com>
> ---
>   scripts/rescan-scsi-bus.sh | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh
> index 6989208..a2aa8d8 100755
> --- a/scripts/rescan-scsi-bus.sh
> +++ b/scripts/rescan-scsi-bus.sh
> @@ -376,7 +376,7 @@ idlist ()
>   
>     oldlist=$(ls /sys/class/scsi_device/ | sed -n "s/${host}:${channel}:\([0-9]*:[0-9]*\)/\1/p" | uniq)
>     # Rescan LUN 0 to check if we found new targets
> -  echo "${channel} - 0" > /sys/class/scsi_host/host${host}/scan
> +  echo "${channel} - -" > /sys/class/scsi_host/host${host}/scan
>     newlist=$(ls /sys/class/scsi_device/ | sed -n "s/${host}:${channel}:\([0-9]*:[0-9]*\)/\1/p" | uniq)
>     for newid in $newlist ; do
>       oldid=$newid
>
diff mbox series

Patch

diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh
index 6989208..a2aa8d8 100755
--- a/scripts/rescan-scsi-bus.sh
+++ b/scripts/rescan-scsi-bus.sh
@@ -376,7 +376,7 @@  idlist ()
 
   oldlist=$(ls /sys/class/scsi_device/ | sed -n "s/${host}:${channel}:\([0-9]*:[0-9]*\)/\1/p" | uniq)
   # Rescan LUN 0 to check if we found new targets
-  echo "${channel} - 0" > /sys/class/scsi_host/host${host}/scan
+  echo "${channel} - -" > /sys/class/scsi_host/host${host}/scan
   newlist=$(ls /sys/class/scsi_device/ | sed -n "s/${host}:${channel}:\([0-9]*:[0-9]*\)/\1/p" | uniq)
   for newid in $newlist ; do
     oldid=$newid