multipathd: Correctly invalidate configuration during shutdown
PATCH 1/1 multipathd: Correctly invalidate configuration during shutdown
We still need to use rcu primitives when shutting down the system; the original configuration might have become invalidated.
Signed-off-by Hannes Reinecke <[email protected]>
--- libmultipath/structs_vec.c | 2 ++ multipathd/main.c | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-)
libmultipath/structs_vec.c +2 -0
@@ -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); }
multipathd/main.c +13 -3
@@ -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);
Signature · 1 line
2.6.6