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

Martin Wilck mwilck at suse.com
Thu Jan 17 10:04:25 UTC 2019


On Wed, 2019-01-16 at 17:59 -0600, Benjamin Marzinski wrote:
> On Fri, Jan 04, 2019 at 06:59:13PM +0100, Martin Wilck wrote:
> > 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 cancellation is
> > imminent.
> > 
> > Signed-off-by: Martin Wilck <mwilck at suse.com>
> > ---
> >  multipathd/main.c | 25 +++++++++++++++++++++++++
> >  multipathd/main.h |  1 +
> >  2 files changed, 26 insertions(+)
> > 
> > diff --git a/multipathd/main.c b/multipathd/main.c
> > index 569a27ac..6276d34c 100644
> > --- a/multipathd/main.c
> > +++ b/multipathd/main.c
> > @@ -2614,6 +2614,31 @@ signal_init(void)
> >  	signal_set(SIGPIPE, sigend);
> >  }
> >  
> > +bool deliver_pending_signals(void)
> > +{
> > +	sigset_t set;
> > +	bool ret = exit_sig;
> > +
> > +	if (sigpending(&set) != 0)
> > +		return false;
> 
> shouldn't this return ret instead of false?

OK, for tidyness. The only error code of sigpending() is EFAULT which
is unlikely to occur for stack memory, so the whole error check is a
bit pointless.

Thanks
Martin

-- 
Dr. Martin Wilck <mwilck at suse.com>, Tel. +49 (0)911 74053 2107
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)





More information about the dm-devel mailing list