From: Hannes Reinecke <hare@suse.de>
To: Christophe Varoqui <christophe.varoqui@gmail.com>
Cc: dm-devel@redhat.com, Hannes Reinecke <hare@suse.com>
Subject: [PATCH] multipathd: Correctly invalidate configuration during shutdown
Date: Fri, 22 Jul 2016 13:04:25 +0200 [thread overview]
Message-ID: <1469185465-12287-1-git-send-email-hare@suse.de> (raw)
We still need to use rcu primitives when shutting down the system;
the original configuration might have become invalidated.
Signed-off-by: Hannes Reinecke <hare@suse.com>
---
libmultipath/structs_vec.c | 2 ++
multipathd/main.c | 16 +++++++++++++---
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index adb1911..a0c8869 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -409,10 +409,12 @@ __setup_multipath (struct vectors * vecs, struct multipath * mpp,
mpp->alias);
}
if (reset) {
+ conf = get_multipath_config();
select_rr_weight(conf, mpp);
select_pgfailback(conf, mpp);
set_no_path_retry(conf, mpp);
select_flush_on_last_del(conf, mpp);
+ put_multipath_config(conf);
if (VECTOR_SIZE(mpp->paths) != 0)
dm_cancel_deferred_remove(mpp);
}
diff --git a/multipathd/main.c b/multipathd/main.c
index 8784307..3eeb4c6 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -2245,7 +2245,7 @@ child (void * param)
if (ignore_new_devs)
conf->ignore_new_devs = ignore_new_devs;
uxsock_timeout = conf->uxsock_timeout;
- multipath_conf = conf;
+ rcu_assign_pointer(multipath_conf, conf);
dm_init(conf->verbosity);
dm_drv_version(conf->version, TGT_MPATH);
if (init_checkers(conf->multipath_dir)) {
@@ -2313,6 +2313,11 @@ child (void * param)
}
#endif
/*
+ * Startup done, invalidate configuration
+ */
+ conf = NULL;
+
+ /*
* Signal start of configuration
*/
post_config_state(DAEMON_CONFIGURE);
@@ -2362,7 +2367,9 @@ child (void * param)
if (!need_to_delay_reconfig(vecs)) {
reconfigure(vecs);
} else {
+ conf = get_multipath_config();
conf->delayed_reconfig = 1;
+ put_multipath_config(conf);
}
lock_cleanup_pop(vecs->lock);
post_config_state(DAEMON_IDLE);
@@ -2370,9 +2377,11 @@ child (void * param)
}
lock(vecs->lock);
+ conf = get_multipath_config();
if (conf->queue_without_daemon == QUE_NO_DAEMON_OFF)
vector_foreach_slot(vecs->mpvec, mpp, i)
dm_queue_if_no_path(mpp->alias, 0);
+ put_multipath_config(conf);
remove_maps_and_stop_waiters(vecs);
unlock(vecs->lock);
@@ -2418,8 +2427,9 @@ child (void * param)
* because logging functions like dlog() and dm_write_log()
* reference the config.
*/
- free_config(conf);
- conf = NULL;
+ conf = rcu_dereference(multipath_conf);
+ rcu_assign_pointer(multipath_conf, NULL);
+ call_rcu(&conf->rcu, rcu_free_config);
udev_unref(udev);
udev = NULL;
pthread_attr_destroy(&waiter_attr);
--
2.6.6
reply other threads:[~2016-07-22 11:04 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1469185465-12287-1-git-send-email-hare@suse.de \
--to=hare@suse.de \
--cc=christophe.varoqui@gmail.com \
--cc=dm-devel@redhat.com \
--cc=hare@suse.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).