[dm-devel] [PATCH 12/35] multipathd: add and set cli_handlers in a single step

Martin Wilck mwilck at suse.com
Fri Nov 12 21:45:41 UTC 2021


On Wed, 2021-09-15 at 19:01 -0500, Benjamin Marzinski wrote:
> On Fri, Sep 10, 2021 at 01:40:57PM +0200, mwilck at suse.com wrote:
> > From: Martin Wilck <mwilck at suse.com>
> > 
> > Modify set_handler_callback() such that a missing slot is created
> > if no matching slot is found. This way, we can skip the
> > initialization
> > with NULL handlers on startup.
> > 
> > Signed-off-by: Martin Wilck <mwilck at suse.com>
> > ---
> >  multipathd/cli.c | 85 +++++++-------------------------------------
> > ----
> >  multipathd/cli.h |  6 ++--
> >  2 files changed, 15 insertions(+), 76 deletions(-)
> > 
> > diff --git a/multipathd/cli.c b/multipathd/cli.c
> > index 5213813..7020d2b 100644
> > --- a/multipathd/cli.c
> > +++ b/multipathd/cli.c
> > @@ -100,26 +100,20 @@ find_handler (uint64_t fp)
> >  }
> >  
> >  int
> > -set_handler_callback (uint64_t fp, cli_handler *fn)
> > +__set_handler_callback (uint64_t fp, cli_handler *fn, bool locked)
> >  {
> > -       struct handler * h = find_handler(fp);
> > +       struct handler *h = find_handler(fp);
> >  
> 
> Wouldn't it be a bug if we reset the handler? Is this really
> something
> we need to check for? Also, if add_handler() just returned a pointer
> to
> the handler, we wouldn't need to call fail_handler() immediately
> after
> creating it.

I'll fix this in an add-on patch in v2.

Regards
Martin





More information about the dm-devel mailing list