Re: [dm-devel] [PATCH] multipathd: fix daemon not really shutdown

2019-01-04 Thread Martin Wilck
On Fri, 2019-01-04 at 02:25 +, Chongyun Wu wrote: > Hi Martin, > > Yes, I have your patch f1c73962's fix. > Your patch f1c73962 "multipathd: make DAEMON_SHUTDOWN a terminal > state" > is good and needed because I also meet that situation need your patch > to > fix, but we also meet another i

[dm-devel] [RFC PATCH 1/6] multipathd: fix daemon not really shutdown

2019-01-04 Thread Martin Wilck
From: Chongyun Wu 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

[dm-devel] [RFC PATCH 0/6] multipath-tools: Fix remaining shutdown delay issues

2019-01-04 Thread Martin Wilck
Hi Chongyun, Ben, all, this patch set addresses the points where I can see that handling of shutdown signals may be delayed, as discussed previously. Quoting my previous post: Let's summarize how multipathd exit works today: 1. signal arrives (signal may be blocked while uxlsnr is busy, see

[dm-devel] [RFC PATCH 4/6] multipathd: cancel threads early during shutdown

2019-01-04 Thread Martin Wilck
Cancel the other threads before taking vecs->lock. This avoids delays during shutdown caused e.g. by the checker thread holding the vecs lock. Signed-off-by: Martin Wilck --- multipathd/main.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/multipathd/main.c

[dm-devel] [RFC PATCH 2/6] multipathd: protect all access to running_state

2019-01-04 Thread Martin Wilck
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_l

[dm-devel] [RFC PATCH 5/6] multipathd: add code to handle blocked signals

2019-01-04 Thread Martin Wilck
multipathd blocks all signals except in the uxlsnr thread. Add some code to handle signals even while they're blocked. If a shutdown signal is received, deliver_pending_signals() returns TRUE. This is not the same as should_exit(), it's just a friendly warning to the caller that shutdown/thread ca

[dm-devel] [RFC PATCH 3/6] multipathd: allow shutdown during configure()

2019-01-04 Thread Martin Wilck
reconfigure() can be a long-running operation; both initial path discovery and initial map setup can take a long time. Allow the main program to indicate that the process should be interrupted if a shutdown signal was received. Signed-off-by: Martin Wilck --- libmultipath/configure.c | 5 +

[dm-devel] [RFC PATCH 6/6] multipathd: uxlsnr: handle signals while busy

2019-01-04 Thread Martin Wilck
The uxlsnr thread is responsible for receiving and handling signals in multipathd. This works well while it is idle and waiting for connections in ppoll(). But if it's busy, cli commands may need to take the vecs lock, which might take a long time. Use multipathd's ability to handle pending signal