Message ID | 20220318223339.4226-2-mwilck@suse.com (mailing list archive) |
---|---|
State | Not Applicable, archived |
Delegated to: | christophe varoqui |
Headers | show |
Series | multipathd: fix __delayed_reconfig logic | expand |
On Fri, Mar 18, 2022 at 5:33 PM <mwilck@suse.com> wrote: > > From: Martin Wilck <mwilck@suse.com> > > No need to test for state == DAEMON_CONFIGURE at this point, we > know that this is the case. > > Signed-off-by: Martin Wilck <mwilck@suse.com> Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com> > --- > multipathd/main.c | 32 ++++++++++++++++---------------- > 1 file changed, 16 insertions(+), 16 deletions(-) > > diff --git a/multipathd/main.c b/multipathd/main.c > index f2c0b28..1c8839d 100644 > --- a/multipathd/main.c > +++ b/multipathd/main.c > @@ -3395,6 +3395,8 @@ child (__attribute__((unused)) void *param) > pthread_attr_destroy(&misc_attr); > > while (1) { > + int rc = 0; > + > pthread_cleanup_push(config_cleanup, NULL); > pthread_mutex_lock(&config_lock); > while (running_state != DAEMON_CONFIGURE && > @@ -3404,23 +3406,21 @@ child (__attribute__((unused)) void *param) > pthread_cleanup_pop(1); > if (state == DAEMON_SHUTDOWN) > break; > - if (state == DAEMON_CONFIGURE) { > - int rc = 0; > > - pthread_cleanup_push(cleanup_lock, &vecs->lock); > - lock(&vecs->lock); > - pthread_testcancel(); > - if (!need_to_delay_reconfig(vecs)) > - rc = reconfigure(vecs); > - else > - enable_delayed_reconfig(); > - lock_cleanup_pop(vecs->lock); > - if (!rc) > - post_config_state(DAEMON_IDLE); > - else { > - condlog(0, "fatal error applying configuration - aborting"); > - exit_daemon(); > - } > + /* handle DAEMON_CONFIGURE */ > + pthread_cleanup_push(cleanup_lock, &vecs->lock); > + lock(&vecs->lock); > + pthread_testcancel(); > + if (!need_to_delay_reconfig(vecs)) > + rc = reconfigure(vecs); > + else > + enable_delayed_reconfig(); > + lock_cleanup_pop(vecs->lock); > + if (!rc) > + post_config_state(DAEMON_IDLE); > + else { > + condlog(0, "fatal error applying configuration - aborting"); > + exit_daemon(); > } > } > > -- > 2.35.1 > -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel
diff --git a/multipathd/main.c b/multipathd/main.c index f2c0b28..1c8839d 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -3395,6 +3395,8 @@ child (__attribute__((unused)) void *param) pthread_attr_destroy(&misc_attr); while (1) { + int rc = 0; + pthread_cleanup_push(config_cleanup, NULL); pthread_mutex_lock(&config_lock); while (running_state != DAEMON_CONFIGURE && @@ -3404,23 +3406,21 @@ child (__attribute__((unused)) void *param) pthread_cleanup_pop(1); if (state == DAEMON_SHUTDOWN) break; - if (state == DAEMON_CONFIGURE) { - int rc = 0; - pthread_cleanup_push(cleanup_lock, &vecs->lock); - lock(&vecs->lock); - pthread_testcancel(); - if (!need_to_delay_reconfig(vecs)) - rc = reconfigure(vecs); - else - enable_delayed_reconfig(); - lock_cleanup_pop(vecs->lock); - if (!rc) - post_config_state(DAEMON_IDLE); - else { - condlog(0, "fatal error applying configuration - aborting"); - exit_daemon(); - } + /* handle DAEMON_CONFIGURE */ + pthread_cleanup_push(cleanup_lock, &vecs->lock); + lock(&vecs->lock); + pthread_testcancel(); + if (!need_to_delay_reconfig(vecs)) + rc = reconfigure(vecs); + else + enable_delayed_reconfig(); + lock_cleanup_pop(vecs->lock); + if (!rc) + post_config_state(DAEMON_IDLE); + else { + condlog(0, "fatal error applying configuration - aborting"); + exit_daemon(); } }