From: "Benjamin Marzinski" <bmarzins@redhat.com>
To: device-mapper development <dm-devel@redhat.com>
Subject: [PATCH 08/10] fix INIT_REQUESTED_UDEV code
Date: Fri, 28 Oct 2016 21:55:24 -0500 [thread overview]
Message-ID: <1477709726-5442-9-git-send-email-bmarzins@redhat.com> (raw)
In-Reply-To: <1477709726-5442-1-git-send-email-bmarzins@redhat.com>
uev_update_path was not checking pp->initialized to see if multipathd
had requested that the path be reinitialized unless the path's read-only
state had changed. This kept the reinitialization code from running in
most cases where it was supposed to. This patch reorders the function to
move that check outside the read-only status change code block. This
does mean that uev_update_path now always grabs the vecs lock, where
before it would only be grabbed if the read-only status had changed. If
people are worried about this, I can add some code to limit this so that
uev_update_path will only grab it if there is a chance that it needs to
reinitialize the path.
Cc: Hannes Reinecke <hare@suse.de>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipathd/main.c | 54 +++++++++++++++++++-----------------------------------
1 file changed, 19 insertions(+), 35 deletions(-)
diff --git a/multipathd/main.c b/multipathd/main.c
index f423e35..dbb4554 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -957,51 +957,35 @@ static int
uev_update_path (struct uevent *uev, struct vectors * vecs)
{
int ro, retval = 0;
+ struct path * pp;
ro = uevent_get_disk_ro(uev);
- if (ro >= 0) {
- struct path * pp;
- struct multipath *mpp = NULL;
+ pthread_cleanup_push(cleanup_lock, &vecs->lock);
+ lock(&vecs->lock);
+ pthread_testcancel();
- condlog(2, "%s: update path write_protect to '%d' (uevent)",
- uev->kernel, ro);
- pthread_cleanup_push(cleanup_lock, &vecs->lock);
- lock(&vecs->lock);
- pthread_testcancel();
- /*
- * pthread_mutex_lock() and pthread_mutex_unlock()
- * need to be at the same indentation level, hence
- * this slightly convoluted codepath.
- */
- pp = find_path_by_dev(vecs->pathvec, uev->kernel);
- if (pp) {
- if (pp->initialized == INIT_REQUESTED_UDEV) {
- retval = 2;
- } else {
- mpp = pp->mpp;
- if (mpp && mpp->wait_for_udev) {
- mpp->wait_for_udev = 2;
- mpp = NULL;
- retval = 0;
- }
- }
- if (mpp) {
- retval = reload_map(vecs, mpp, 0, 1);
+ pp = find_path_by_dev(vecs->pathvec, uev->kernel);
+ if (pp) {
+ struct multipath *mpp = pp->mpp;
+
+ if (pp->initialized == INIT_REQUESTED_UDEV)
+ retval = uev_add_path(uev, vecs);
+ else if (mpp && ro >= 0) {
+ condlog(2, "%s: update path write_protect to '%d' (uevent)", uev->kernel, ro);
+ if (mpp->wait_for_udev)
+ mpp->wait_for_udev = 2;
+ else {
+ retval = reload_map(vecs, mpp, 0, 1);
condlog(2, "%s: map %s reloaded (retval %d)",
uev->kernel, mpp->alias, retval);
}
}
- lock_cleanup_pop(vecs->lock);
- if (!pp) {
- condlog(0, "%s: spurious uevent, path not found",
- uev->kernel);
- return 1;
- }
- if (retval == 2)
- return uev_add_path(uev, vecs);
}
+ lock_cleanup_pop(vecs->lock);
+ if (!pp)
+ condlog(0, "%s: spurious uevent, path not found", uev->kernel);
return retval;
}
--
1.8.3.1
next prev parent reply other threads:[~2016-10-29 2:55 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-29 2:55 [PATCH 00/10] misc. multipath patches Benjamin Marzinski
2016-10-29 2:55 ` [PATCH 01/10] libmultipath: add skip_kpartx option Benjamin Marzinski
2016-10-30 13:42 ` Hannes Reinecke
2016-10-29 2:55 ` [PATCH 02/10] kpartx.rules: respect skip_kpartx flag Benjamin Marzinski
2016-10-30 13:42 ` Hannes Reinecke
2016-10-29 2:55 ` [PATCH 03/10] do not allow in-use path to change wwid Benjamin Marzinski
2016-10-30 13:45 ` Hannes Reinecke
2016-10-31 14:30 ` Benjamin Marzinski
2016-10-29 2:55 ` [PATCH 04/10] multipathd: add "map failures" format wildcard Benjamin Marzinski
2016-10-30 13:45 ` Hannes Reinecke
2016-10-29 2:55 ` [PATCH 05/10] mpath: don't wait for udev if all paths are down Benjamin Marzinski
2016-10-30 13:46 ` Hannes Reinecke
2016-10-29 2:55 ` [PATCH 06/10] multipath: set cookie before using it Benjamin Marzinski
2016-10-30 13:46 ` Hannes Reinecke
2016-10-29 2:55 ` [PATCH 07/10] recover from errors in multipathd startup Benjamin Marzinski
2016-10-30 13:47 ` Hannes Reinecke
2016-10-29 2:55 ` Benjamin Marzinski [this message]
2016-10-30 13:48 ` [PATCH 08/10] fix INIT_REQUESTED_UDEV code Hannes Reinecke
2016-10-29 2:55 ` [PATCH 09/10] add disable_changed_wwids option Benjamin Marzinski
2016-10-30 13:54 ` Hannes Reinecke
2016-11-04 15:32 ` Benjamin Marzinski
2017-02-28 12:27 ` Zhangguanghui
2016-11-06 0:03 ` Xose Vazquez Perez
2016-11-07 14:47 ` Benjamin Marzinski
2016-10-29 2:55 ` [PATCH 10/10] set retrigger_tries to 0 for multipath Benjamin Marzinski
2016-10-30 13:54 ` Hannes Reinecke
2016-12-06 15:11 ` Xose Vazquez Perez
2016-12-06 15:22 ` Benjamin Marzinski
2017-04-25 14:07 ` Xose Vazquez Perez
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=1477709726-5442-9-git-send-email-bmarzins@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).