58ed7b81e7
udev rules to fix some issues.
56 lines
1.9 KiB
Diff
56 lines
1.9 KiB
Diff
---
|
|
multipath/mpath_wait | 21 +++++++++++++++------
|
|
multipath/multipath.rules | 5 ++++-
|
|
2 files changed, 19 insertions(+), 7 deletions(-)
|
|
|
|
Index: multipath-tools/multipath/mpath_wait
|
|
===================================================================
|
|
--- multipath-tools.orig/multipath/mpath_wait
|
|
+++ multipath-tools/multipath/mpath_wait
|
|
@@ -3,14 +3,23 @@
|
|
retry=3
|
|
sec=1
|
|
|
|
-/sbin/dmsetup info -c --noheadings -j $1 -m $2 2> /dev/null | grep -q .*:${1}:${2}:L.*:.*:.*:.*:.*
|
|
-ret=$?
|
|
+dev=`/sbin/dmsetup ls --target multipath -j $1 -m $2 --exec 'echo'`
|
|
+if [ -n "$dev" ]; then
|
|
+ /usr/bin/stat $dev > /dev/null 2>&1
|
|
+ ret=$?
|
|
+else
|
|
+ ret=1
|
|
+fi
|
|
|
|
-while [ "$ret" -ne 0 -a "$retry" -gt 0 ]
|
|
-do
|
|
+while [ "$ret" -ne 0 -a "$retry" -gt 0 ]; do
|
|
sleep $sec
|
|
- /sbin/dmsetup info -c --noheadings -j $1 -m $2 2> /dev/null | grep -q .*:${1}:${2}:L.*:.*:.*:.*:.*
|
|
- ret=$?
|
|
+ if [ -z "$dev" ]; then
|
|
+ dev=`/sbin/dmsetup ls --target multipath -j $1 -m $2 --exec 'echo'`
|
|
+ fi
|
|
+ if [ -n "$dev" ]; then
|
|
+ /usr/bin/stat $dev > /dev/null 2>&1
|
|
+ ret=$?
|
|
+ fi
|
|
retry=$(($retry - 1))
|
|
done
|
|
|
|
Index: multipath-tools/multipath/multipath.rules
|
|
===================================================================
|
|
--- multipath-tools.orig/multipath/multipath.rules
|
|
+++ multipath-tools/multipath/multipath.rules
|
|
@@ -2,7 +2,10 @@
|
|
# so name them after their devmap name
|
|
SUBSYSTEM!="block", GOTO="end_mpath"
|
|
RUN+="socket:/org/kernel/dm/multipath_event"
|
|
+ACTION!="change", GOTO="end_mpath"
|
|
KERNEL!="dm-[0-9]*", GOTO="end_mpath"
|
|
+ENV{DM_SUSPENDED}=="1", GOTO="end_mpath"
|
|
+ENV{DM_UUID}=="*?", ENV{DM_UUID}!="mpath-?*", GOTO="end_mpath"
|
|
PROGRAM!="/sbin/mpath_wait %M %m", GOTO="end_mpath"
|
|
-ACTION=="add", RUN+="/sbin/dmsetup ls --target multipath --exec '/sbin/kpartx -a -p p' -j %M -m %m"
|
|
+RUN+="/sbin/dmsetup ls --target multipath --exec '/sbin/kpartx -a -p p' -j %M -m %m"
|
|
LABEL="end_mpath"
|