From: mwilck@suse.com
To: Christophe Varoqui <christophe.varoqui@opensvc.com>,
Benjamin Marzinski <bmarzins@redhat.com>
Cc: dm-devel@redhat.com, Martin Wilck <mwilck@suse.com>
Subject: [dm-devel] [PATCH v3 02/21] multipathd: avoid sending "READY=1" to systemd on early shutdown
Date: Fri, 16 Oct 2020 12:43:10 +0200 [thread overview]
Message-ID: <20201016104329.8337-3-mwilck@suse.com> (raw)
In-Reply-To: <20201016104329.8337-1-mwilck@suse.com>
From: Martin Wilck <mwilck@suse.com>
If multipathd gets a shutdown request during initial reconfigure(),
it shouldn't send "READY=1" to systemd. Ensure this by sending
"READY=1" via post_config_state().
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
---
multipathd/main.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/multipathd/main.c b/multipathd/main.c
index fa53e96..53a22a4 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -189,6 +189,8 @@ static void do_sd_notify(enum daemon_status old_state,
{
char notify_msg[MSG_SIZE];
const char *msg;
+ static bool startup_done = false;
+
/*
* Checkerloop switches back and forth between idle and running state.
* No need to tell systemd each time.
@@ -205,6 +207,11 @@ static void do_sd_notify(enum daemon_status old_state,
if (msg && !safe_sprintf(notify_msg, "STATUS=%s", msg))
sd_notify(0, notify_msg);
+
+ if (new_state == DAEMON_IDLE && !startup_done) {
+ sd_notify(0, "READY=1");
+ startup_done = true;
+ }
}
#endif
@@ -2903,9 +2910,6 @@ child (__attribute__((unused)) void *param)
struct vectors * vecs;
struct multipath * mpp;
int i;
-#ifdef USE_SYSTEMD
- int startup_done = 0;
-#endif
int rc;
int pid_fd = -1;
struct config *conf;
@@ -3065,12 +3069,6 @@ child (__attribute__((unused)) void *param)
}
lock_cleanup_pop(vecs->lock);
post_config_state(DAEMON_IDLE);
-#ifdef USE_SYSTEMD
- if (!startup_done) {
- sd_notify(0, "READY=1");
- startup_done = 1;
- }
-#endif
}
}
--
2.28.0
--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
next prev parent reply other threads:[~2020-10-16 10:44 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-16 10:43 [dm-devel] [PATCH v3 00/21] multipath-tools: shutdown, libdevmapper races, globals mwilck
2020-10-16 10:43 ` [dm-devel] [PATCH v3 01/21] multipathd: allow shutdown during configure() mwilck
2020-10-16 10:43 ` mwilck [this message]
2020-10-16 10:43 ` [dm-devel] [PATCH v3 03/21] multipathd: send "STOPPING=1" to systemd on shutdown mwilck
2020-10-16 10:43 ` [dm-devel] [PATCH v3 04/21] multipathd: send "RELOADING=1" to systemd on DAEMON_CONFIGURE state mwilck
2020-10-16 10:43 ` [dm-devel] [PATCH v3 05/21] multipathd: use volatile qualifier for running_state mwilck
2020-10-16 10:43 ` [dm-devel] [PATCH v3 06/21] multipathd: generalize and fix wait_for_state_change_if() mwilck
2020-10-16 10:43 ` [dm-devel] [PATCH v3 07/21] multipathd: set_config_state(): avoid code duplication mwilck
2020-10-16 10:43 ` [dm-devel] [PATCH v3 08/21] multipathd: cancel threads early during shutdown mwilck
2020-10-16 10:43 ` [dm-devel] [PATCH v3 09/21] multipath-tools: don't call dm_lib_release() any more mwilck
2020-10-16 10:43 ` [dm-devel] [PATCH v3 10/21] libmultipath: devmapper: refactor libdm version determination mwilck
2020-10-17 4:58 ` Benjamin Marzinski
2020-10-16 10:43 ` [dm-devel] [PATCH v3 11/21] libmultipath: protect racy libdevmapper calls with a mutex mwilck
2020-10-19 16:46 ` Benjamin Marzinski
2020-10-16 10:43 ` [dm-devel] [PATCH v3 12/21] libmultipath: constify file argument in config parser mwilck
2020-10-16 10:43 ` [dm-devel] [PATCH v3 13/21] libmultipath: provide defaults for {get, put}_multipath_config mwilck
2020-10-16 10:43 ` [dm-devel] [PATCH v3 14/21] libmpathpersist: allow using libmultipath " mwilck
2020-10-16 10:43 ` [dm-devel] [PATCH v3 15/21] multipath: use {get_put}_multipath_config from libmultipath mwilck
2020-10-16 10:43 ` [dm-devel] [PATCH v3 16/21] mpathpersist: use {get, put}_multipath_config() " mwilck
2020-10-16 10:43 ` [dm-devel] [PATCH v3 17/21] libmultipath: add udev and logsink symbols mwilck
2020-10-19 17:22 ` Benjamin Marzinski
2020-10-16 10:43 ` [dm-devel] [PATCH v3 18/21] multipath: remove logsink and udev mwilck
2020-10-16 10:43 ` [dm-devel] [PATCH v3 19/21] libmpathpersist: call libmultipath_{init, exit}() mwilck
2020-10-16 10:43 ` [dm-devel] [PATCH v3 20/21] mpathpersist: remove logsink and udev mwilck
2020-10-16 10:43 ` [dm-devel] [PATCH v3 21/21] multipathd: " mwilck
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=20201016104329.8337-3-mwilck@suse.com \
--to=mwilck@suse.com \
--cc=bmarzins@redhat.com \
--cc=christophe.varoqui@opensvc.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).