From: Benjamin Marzinski <bmarzins@redhat.com>
To: device-mapper development <dm-devel@redhat.com>
Subject: [PATCH] multipath: don't remove dm device on remove uevent
Date: Thu, 12 Jan 2012 22:17:21 -0600 [thread overview]
Message-ID: <20120113041721.GM1241@ether.msp.redhat.com> (raw)
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
next reply other threads:[~2012-01-13 4:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-13 4:17 Benjamin Marzinski [this message]
2012-01-14 11:21 ` [PATCH] multipath: don't remove dm device on remove uevent Christophe Varoqui
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120113041721.GM1241@ether.msp.redhat.com \
--to=bmarzins@redhat.com \
--cc=dm-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.