multipathd: fix daemon not really shutdown
authorChongyun Wu <wu.chongyun@h3c.com>
Thu, 11 Apr 2019 10:27:13 +0000 (12:27 +0200)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Thu, 18 Apr 2019 11:05:40 +0000 (13:05 +0200)
Test environment: 25 hosts, each host have more than 100 luns,
each lun have two paths.
Some times when we try to ceate new multipath will encounter "could
not create uxsock:98" but the multipathd still running not shutdown
and can't response any multipathd commands also.

After reproduce this issue and debug, found below fixes might work:
(1) set_config_state() after pthread_cond_timedwait() other threads
might changed the running_state from DAEMON_SHUTDOWN to other status
like DAEMON_IDLE, which will make the shutdown process stopped.
I found logs to prove this really happened, so we need add judgement
here too.

(2) [this part removed by mwilck]

Signed-off-by: Chongyun Wu <wu.chongyun@h3c.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
multipathd/main.c

index 1413c6d..47aff2d 100644 (file)
@@ -249,7 +249,7 @@ int set_config_state(enum daemon_status state)
                                                            &config_lock, &ts);
                        }
                }
-               if (!rc) {
+               if (!rc && (running_state != DAEMON_SHUTDOWN)) {
                        running_state = state;
                        pthread_cond_broadcast(&config_cond);
 #ifdef USE_SYSTEMD