Skip to contentSkip to conversation

multipath-tools/multipath mpath_wait multipath ...

PATCH [email protected] 1 participant 1 message Aug 23, 2010 Device mapper

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/dm
Module name: multipath-tools
Branch: RHEL5_FC6
Changes by: [email protected] 2010-08-23 22:06:59

Modified files:
multipath : mpath_wait multipath.rules

Log message:
Fix for bz #568127. mpathwait will now wait for /dev/mapper/<mutipath_dev_name> to be created before calling kpartx on it. This fixes a race condition. Not applicable upstream.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath/mpath_wait.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.1&r2=1.1.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath/multipath.rules.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.11.2.2&r2=1.11.2.3

multipath/mpath_wait +12 -0
@@ -3,6 +3,18 @@
 retry=3
 sec=1
 
+if  [ $# -eq 1 ]
+then
+	while [ ! -e $1 -a "$retry" -gt 0 ]
+	do
+		retry=$(($retry - 1))
+		sleep $sec
+	done
+	[ -e $1 ]
+	ret=$?
+	exit $ret
+fi
+
 /sbin/dmsetup info -c --noheadings -j $1 -m $2 2> /dev/null | grep -q .*:${1}:${2}:L.*:.*:.*:.*:.*
 ret=$?
 
multipath/multipath.rules +1 -1
@@ -6,7 +6,7 @@
 PROGRAM!="/sbin/mpath_wait %M %m", GOTO="end_mpath"
 PROGRAM!="/sbin/dmsetup info -c --noheadings -j %M -m %m", GOTO="end_mpath"
 RESULT!="*:*:*:*:*:*:*:mpath-*", GOTO="kpartx_check"
-PROGRAM=="/sbin/dmsetup info -c --noheadings -o name -j %M -m %m", RESULT=="?*", NAME="%k", SYMLINK="mpath/%c", RUN+="/sbin/kpartx -a -p p /dev/mapper/%c"
+PROGRAM=="/sbin/dmsetup info -c --noheadings -o name -j %M -m %m", RESULT=="?*", NAME="%k", SYMLINK="mpath/%c", RUN+="/bin/bash -c '/sbin/mpath_wait /dev/mapper/%c; /sbin/kpartx -a -p p /dev/mapper/%c'"
 OPTIONS="last_rule"
 LABEL="kpartx_check"
 RESULT!="*:*:*:*:*:*:*:part*-mpath-*", GOTO="end_mpath"