summaryrefslogtreecommitdiffstats
path: root/udev_change.patch
blob: 91de9d9d2afa020d87472301b3cc80b40ca78a79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
---
 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"