Skip to contentSkip to conversation

multipath: don't remove dm device on remove uevent

PATCH Applied Benjamin Marzinski 2 participants 2 messages Jan 13, 2012 – Jan 14, 2012 Device mapper

lore
Share & tools
lore

Benjamin Marzinski

author maintainer
#0 lore raw

PATCH 1/1 multipath: don't remove dm device on remove uevent

multipathd gets remove uevents for dm devices when the devices have been removed. It shouldn't try to actually remove the device itself, since that has already been done, or it wouldn't have gotten the uevent.

---
 multipathd/main.c |   22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)
multipathd/main.c +19 -3
Index: multipath-tools-111219/multipathd/main.c
===================================================================
@@ -310,7 +310,8 @@ static int
 uev_remove_map (struct uevent * uev, struct vectors * vecs)
 {
 	char *alias;
-	int minor, rc;
+	int minor;
+	struct multipath *mpp;
 
 	condlog(2, "%s: remove map (uevent)", uev->kernel);
 	alias = uevent_get_dm_name(uev);
@@ -319,9 +320,24 @@ uev_remove_map (struct uevent * uev, str
 		return 0;
 	}
 	minor = uevent_get_minor(uev);
-	rc = ev_remove_map(uev->kernel, alias, minor, vecs);
+	mpp = find_mp_by_minor(vecs->mpvec, minor);
+
+	if (!mpp) {
+		condlog(2, "%s: devmap not registered, can't remove",
+			uev->kernel);
+		goto out;
+	}
+	if (strcmp(mpp->alias, alias)) {
+		condlog(2, "%s: minor number mismatch (map %d, event %d)",
+			mpp->alias, mpp->dmi->minor, minor);
+		goto out;
+	}
+
+	orphan_paths(vecs->pathvec, mpp);
+	remove_map_and_stop_waiter(mpp, vecs, 1);
+out:
 	FREE(alias);
-	return rc;
+	return 0;
 }
 
 int
#1 lore raw
Quoted 4 lines · Benjamin Marzinski

multipathd gets remove uevents for dm devices when the devices have been removed. It shouldn't try to actually remove the device itself, since that has already been done, or it wouldn't have gotten the uevent.

Applied.

Quoted 51 lines
---
 multipathd/main.c |   22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

Index: multipath-tools-111219/multipathd/main.c
===================================================================

multipathd/main.c +19 -4
@@ -310,7 +310,8 @@ static int
 uev_remove_map (struct uevent * uev, struct vectors * vecs)
 {
 	char *alias;
-	int minor, rc;
+	int minor;
+	struct multipath *mpp;
 
 	condlog(2, "%s: remove map (uevent)", uev->kernel);
 	alias = uevent_get_dm_name(uev);
@@ -319,9 +320,24 @@ uev_remove_map (struct uevent * uev, str
 		return 0;
 	}
 	minor = uevent_get_minor(uev);
-	rc = ev_remove_map(uev->kernel, alias, minor, vecs);
+	mpp = find_mp_by_minor(vecs->mpvec, minor);
+
+	if (!mpp) {
+		condlog(2, "%s: devmap not registered, can't remove",
+			uev->kernel);
+		goto out;
+	}
+	if (strcmp(mpp->alias, alias)) {
+		condlog(2, "%s: minor number mismatch (map %d, event %d)",
+			mpp->alias, mpp->dmi->minor, minor);
+		goto out;
+	}
+
+	orphan_paths(vecs->pathvec, mpp);
+	remove_map_and_stop_waiter(mpp, vecs, 1);
+out:
 	FREE(alias);
-	return rc;
+	return 0;
 }
 
 int
 
--

dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel