device-mapper-multipath/0045-multipathd-move-conf-destruction-into-separate-funct.patch
Benjamin Marzinski 1dad67a5af device-mapper-multipath-0.8.5-1
Update Source to upstream version 0.8.5 plus post tag commits
  * Patches 0001-0102 are from
    https://github.com/openSUSE/multipath-tools/tree/queue and are
    already queued for upstream.
Rename files
  * Previous patches 0059-0068 are now patches 0103-0111
2021-01-19 18:06:09 -06:00

57 lines
1.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Wed, 23 Sep 2020 12:38:50 +0200
Subject: [PATCH] multipathd: move conf destruction into separate function
Also removing the comment about dlog() and dm_write_log().
dlog() can cope with get_multipath_config() returning NULL,
and dm_write_log() hasn't accessed the configuration for a while.
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipathd/main.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/multipathd/main.c b/multipathd/main.c
index 9eb658d4..07973e85 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -2892,6 +2892,16 @@ set_oom_adj (void)
condlog(0, "couldn't adjust oom score");
}
+static void cleanup_conf(void) {
+ struct config *conf;
+
+ conf = rcu_dereference(multipath_conf);
+ if (!conf)
+ return;
+ rcu_assign_pointer(multipath_conf, NULL);
+ call_rcu(&conf->rcu, rcu_free_config);
+}
+
static void cleanup_maps(struct vectors *vecs)
{
int queue_without_daemon, i;
@@ -3196,15 +3206,7 @@ child (__attribute__((unused)) void *param)
if (logsink == 1)
log_thread_stop();
-
- /*
- * Freeing config must be done after condlog() and dm_lib_exit(),
- * because logging functions like dlog() and dm_write_log()
- * reference the config.
- */
- conf = rcu_dereference(multipath_conf);
- rcu_assign_pointer(multipath_conf, NULL);
- call_rcu(&conf->rcu, rcu_free_config);
+ cleanup_conf();
#ifdef _DEBUG_
dbg_free_final(NULL);
#endif
--
2.17.2