From 03279699ded14ee8c28d21d7009259f79a836d17 Mon Sep 17 00:00:00 2001 From: sunshihao Date: Thu, 16 Apr 2020 10:24:51 +0800 Subject: [PATCH 1/4] sg3_utils-1.37-rescan-scsi-findremapped-enhance --- scripts/rescan-scsi-bus.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh index 46fe6c0..855cec9 100755 --- a/scripts/rescan-scsi-bus.sh +++ b/scripts/rescan-scsi-bus.sh @@ -808,7 +808,12 @@ findremapped() remapped=0 id_serial=$(udevadm info -q all -n "$sddev" | grep "ID_SERIAL=" | cut -d"=" -f2) [ -z "$id_serial" ] && id_serial="none" - if [ "$id_serial_old" != "$id_serial" ] ; then + dm_name=`cat /sys/class/scsi_device/$hctl/device/block/$sddev/holders/*/dm/name 2>/dev/null` + [ -z "$dm_name" ] && dm_name=$id_serial + if [ "$id_serial_old" != "$id_serial" -o "$id_serial_old" != "$dm_name" ] ; then + echo "$hctl id_serial_old=$id_serial_old" + echo "$hctl id_serial=$id_serial" + echo "$hctl dm_name=$dm_name" remapped=1 fi # If udev events updated the disks already, but the multipath device isn't update -- 2.19.1