tree 4277e7bd9da1d525465d390fd7c729fef584c167
parent bc12604255cc0ee7a04b443181c79a87a3319aa3
author Hannes Reinecke <hare@suse.de> 1175152450 +0200
committer Hannes Reinecke <hare@suse.de> 1175152450 +0200

[multipathd] Fix handling of device-mapper devices

On sles10 device-mapper devices are available only after an
'online' event, so it's quite pointless to use the 'add'
event.
And if the map is gone we should stop the checkers, too.

Signed-off-by: Hannes Reinecke <hare@suse.de>
311d95211efce0314e197f3c1dc7330e345dc297
 libmultipath/structs_vec.c |    5 ++++-
 multipathd/main.c          |   10 ++++++++--
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index 1a6d8e2..304d695 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -16,7 +16,6 @@ #include "propsel.h"
 #include "discovery.h"
 #include "waiter.h"
 
-
 /*
  * creates or updates mpp->paths reading mpp->pg
  */
@@ -282,7 +281,11 @@ #endif
 	return 0;
 out:
 	condlog(0, "%s: failed to setup multipath", mpp->alias);
+#if DAEMON
+	remove_map(mpp, vecs, stop_waiter_thread, 1);
+#else
 	remove_map(mpp, vecs, NULL, 1);
+#endif
 	return 1;
 }
 
diff --git a/multipathd/main.c b/multipathd/main.c
index 4bb9f0c..83d1374 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -646,13 +646,19 @@ uev_trigger (struct uevent * uev, void *
 	lock(vecs->lock);
 
 	/*
-	 * device map add/remove event
+	 * Device map online/offline event.
+	 * Add/Remove events are ignored here as they
+	 * lead to races with device-mapper.
 	 */
 	if (!strncmp(devname, "dm-", 3)) {
-		if (!strncmp(uev->action, "add", 3)) {
+		if (!strncmp(uev->action, "online", 6)) {
 			r = uev_add_map(devname, vecs);
 			goto out;
 		}
+		if (!strncmp(uev->action, "offline", 7)) {
+			r = uev_remove_map(devname, vecs);
+			goto out;
+		}
 		if (!strncmp(uev->action, "remove", 6)) {
 			r = uev_remove_map(devname, vecs);
 			goto out;
