On Mon, 2025-12-01 at 22:02 -0500, Benjamin Marzinski wrote:
> When libmpathpersist notifies multipathd that a key has been
> registered,
> cli_setprstatus() calls pr_register_active_paths() with a flag to let
> it
> know that the paths are likely already registered, and it can skip
> re-registering them, as long as the number of active paths matches
> the
> number of registered keys. This shortcut can fail, causing multipathd
> to
> not register needed paths, if either a path becomes usable and
> another
> becomes unusable while libmpathpersist is running or if there already
> were registered keys for I_T Nexus's that don't correspond to path
> devices.
> 
> To make this shortcut work in cases like that, this commit adds a new
> multipathd command "setprstatus map <map> pathlist <pathlist>", where
> <pathlist> is a quoted, comma separated list of scsi path devices.
> libmpathpersist will send out the list of paths it registered the key
> on. pr_register_active_paths() will skip calling
> mpath_pr_event_handle()
> for paths on that list.
> 
> In order to deal with the possiblity of a preempt occuring while
> libmpathpersist was running, the code still needs to check that it
> has
> the expected number of keys.
> 
> Fixes: f7d6cd17 ("multipathd: Fix race while registering PR key")
> Signed-off-by: Benjamin Marzinski <[email protected]>
> ---
>  libmpathpersist/mpath_persist_int.c |  6 +--
>  libmpathpersist/mpath_updatepr.c    | 48 +++++++++++++++++------
>  libmpathpersist/mpathpr.h           |  4 +-
>  multipathd/callbacks.c              |  1 +
>  multipathd/cli.c                    |  1 +
>  multipathd/cli.h                    |  2 +
>  multipathd/cli_handlers.c           | 39 ++++++++++++++++--
>  multipathd/main.c                   | 61 +++++++++++++++++++--------
> --
>  multipathd/main.h                   |  3 +-
>  multipathd/multipathd.8.in          |  6 +++
>  10 files changed, 132 insertions(+), 39 deletions(-)

I may be missing something, but this is quite a lot of additional
complexity just for the shortcut. Have you considered just not taking
the shortcut in the first place?

Martin

Reply via email to