Fixed problem where maps were being added and then removed. Changed the

udev rules to fix some issues.
This commit is contained in:
Benjamin Marzinski 2009-08-20 22:28:44 +00:00
parent 586aea1acc
commit 58ed7b81e7
3 changed files with 92 additions and 1 deletions

View File

@ -1,7 +1,7 @@
Summary: Tools to manage multipath devices using device-mapper
Name: device-mapper-multipath
Version: 0.4.9
Release: 4%{?dist}
Release: 5%{?dist}
License: GPL+
Group: System Environment/Base
URL: http://christophe.varoqui.free.fr/
@ -22,6 +22,8 @@ Patch11: multipath_rules.patch
Patch12: cciss_id.patch
Patch13: stop_warnings.patch
Patch14: move_bindings.patch
Patch15: dont_remove.patch
Patch16: udev_change.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: %{name}-libs = %{version}-%{release}
@ -76,6 +78,8 @@ kpartx manages partition creation and removal for device-mapper devices.
%patch12 -p1 -b .cciss_id
%patch13 -p1 -b .stop_warnings
%patch14 -p1 -b .move_bindings
%patch15 -p1 -b .dont_remove
%patch16 -p1 -b .udev_change
%build
%define _sbindir /sbin
@ -142,6 +146,10 @@ fi
%{_mandir}/man8/kpartx.8.gz
%changelog
* Thu Aug 20 2009 Benjamin Marzinski <bmarzins@redhat.com> - 0.4.8-5
- Fixed problem where maps were being added and then removed.
- Changed the udev rules to fix some issues.
* Thu Jul 30 2009 Benjamin Marzinski <bmarzins@redhat.com> - 0.4.9-4
- Fixed build issue on i686 machines.

28
dont_remove.patch Normal file
View File

@ -0,0 +1,28 @@
Index: multipath-tools/multipathd/main.c
===================================================================
--- multipath-tools.orig/multipathd/main.c
+++ multipath-tools/multipathd/main.c
@@ -290,8 +290,23 @@ ev_add_map (struct sysfs_device * dev, s
static int
uev_remove_map (struct sysfs_device * dev, struct vectors * vecs)
{
+ struct multipath * mpp;
+
condlog(2, "%s: remove map (uevent)", dev->kernel);
+#if 0
return ev_remove_map(dev->kernel, vecs);
+#else
+ mpp = find_mp_by_str(vecs->mpvec, dev->kernel);
+
+ if (!mpp) {
+ condlog(2, "%s: devmap not registered, can't remove",
+ dev->kernel);
+ return 0;
+ }
+ orphan_paths(vecs->pathvec, mpp);
+ remove_map_and_stop_waiter(mpp, vecs, 1);
+ return 0;
+#endif
}
int

55
udev_change.patch Normal file
View File

@ -0,0 +1,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"