* [PATCH] multipath: don't remove dm device on remove uevent
@ 2012-01-13 4:17 Benjamin Marzinski
2012-01-14 11:21 ` Christophe Varoqui
0 siblings, 1 reply; 2+ messages in thread
From: Benjamin Marzinski @ 2012-01-13 4:17 UTC (permalink / raw)
To: device-mapper development
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.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipathd/main.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
Index: multipath-tools-111219/multipathd/main.c
===================================================================
--- multipath-tools-111219.orig/multipathd/main.c
+++ 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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] multipath: don't remove dm device on remove uevent
2012-01-13 4:17 [PATCH] multipath: don't remove dm device on remove uevent Benjamin Marzinski
@ 2012-01-14 11:21 ` Christophe Varoqui
0 siblings, 0 replies; 2+ messages in thread
From: Christophe Varoqui @ 2012-01-14 11:21 UTC (permalink / raw)
To: dm-devel
On jeu., 2012-01-12 at 22:17 -0600, Benjamin Marzinski wrote:
> 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.
> Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
> ---
> multipathd/main.c | 22 +++++++++++++++++++---
> 1 file changed, 19 insertions(+), 3 deletions(-)
>
> Index: multipath-tools-111219/multipathd/main.c
> ===================================================================
> --- multipath-tools-111219.orig/multipathd/main.c
> +++ 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
>
> --
> dm-devel mailing list
> dm-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/dm-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-01-14 11:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-13 4:17 [PATCH] multipath: don't remove dm device on remove uevent Benjamin Marzinski
2012-01-14 11:21 ` Christophe Varoqui
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.