multipathd: protect all access to running_state
authorMartin Wilck <mwilck@suse.com>
Thu, 11 Apr 2019 10:27:14 +0000 (12:27 +0200)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Thu, 18 Apr 2019 11:05:42 +0000 (13:05 +0200)
commit19a0197500c68792a2421d2088cb9ca69e3ee93a
tree0533b7fd15e48213398816553eff8a311ca14c11
parent73712a03ba96d1c5fef69fb0318756b504ea3bc9
multipathd: protect all access to running_state

Chonyun Wu's latest patch has shown that the handling of the daemon
state variable running_state is racy and difficult to get right. It's
not a good candidate for a "benign race" annotation. So, as a first
step to sanitizing it, make sure all accesses to the state variable
are protected by config_lock.

The patch also replaces "if" with "while" in several places where the
code was supposed to wait until a certain state was reached. It's
important that DAEMON_SHUTDOWN terminates all loops of this kind.

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