All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Marzinski <bmarzins@redhat.com>
To: Martin Wilck <martin.wilck@suse.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>,
	device-mapper development <dm-devel@lists.linux.dev>
Subject: Re: [PATCH 12/14] libmpatpersist: update reservation key before checking paths
Date: Thu, 28 Aug 2025 23:37:44 -0400	[thread overview]
Message-ID: <aLEgiGGxvEySW397@redhat.com> (raw)
In-Reply-To: <aad385f3a960df921765001f35f1a6f3cf39edb7.camel@suse.com>

On Mon, Aug 25, 2025 at 06:36:18PM +0200, Martin Wilck wrote:
> On Fri, 2025-07-25 at 23:58 -0400, Benjamin Marzinski wrote:
> > There is a race condition when changing reservation keys where a
> > failed
> > path could come back online after libmpathpersist checks the paths,
> > but
> > before it updates the reservation key. In this case, the path would
> > come
> > up and get reregistered with the old key by multipathd, and
> > libmpathpersist would not update its key, because the path was down
> > when it checked.
> > 
> > To fix this, check the paths after updating the key, so any path that
> > comes up after getting checked will use the updated key.
> 
> In do_mpath_persistent_reserve_out(), you call update_prkey_flags()
> before checking for MPATH_PR_SYNTAX_ERROR. Perhaps you should check the
> key parameters first?

We could, but the way the code currently is, if you called
update_prkey_flags() earlier, you can't fail those MPATH_PR_SYNTAX_ERROR
checks.

You can only call update_prkey_flags() if rq_servact is
MPATH_PROUT_REG_IGN_SA or MPATH_PROUT_REG_SA, so we only need to look at
the True branch of the outermost if statement in those
MPATH_PR_SYNTAX_ERROR checks. We also cannot fail those checks if
unregistering is true, so we only care about the case were
paramp->sa_key is non-zero. And when we call update_prkey_flags(), we
also copy the value of paramp->sa_key to mpp->reservation_key, so it too
must be non-zero. This means that can't fail the checks since they
check if mpp->reservation_key is zero or not equal to paramp->sa_key.

But it doesn't hury anything to move the update_prkey_flags() call to
after those checks either. So I'm fine with either solving this by
adding an explanation of why we don't need to worry about failing these
checks if we updated the key to the comments above the checks, or by
just moving the update_prkey_flags() call to after them. Do you have a
preference?

-Ben

 
> Martin


  reply	other threads:[~2025-08-29  3:37 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-26  3:58 [PATCH 00/14] Additional fixes and cleanups Benjamin Marzinski
2025-07-26  3:58 ` [PATCH 01/14] limpathpersist: remove update_map_pr code for NULL pp Benjamin Marzinski
2025-07-26  3:58 ` [PATCH 02/14] libmpathpersist: move update_map_pr to multipathd Benjamin Marzinski
2025-07-26  3:58 ` [PATCH 03/14] multipathd: clean up update_map_pr and mpath_pr_event_handle Benjamin Marzinski
2025-07-26  3:58 ` [PATCH 04/14] libmpathpersist: clean up duplicate function declarations Benjamin Marzinski
2025-07-26  3:58 ` [PATCH 05/14] multipathd: wrap setting and unsetting prflag Benjamin Marzinski
2025-07-26  3:58 ` [PATCH 06/14] multipathd: unregister PR key when path is restored if necessary Benjamin Marzinski
2025-07-26  3:58 ` [PATCH 07/14] libmpathpersist: Fix-up reservation_key checking Benjamin Marzinski
2025-07-26  3:58 ` [PATCH 08/14] libmpathpersist: change how reservation conflicts are handled Benjamin Marzinski
2025-07-26  3:58 ` [PATCH 09/14] libmpathpersist: Clear prkey in multipathd before unregistering Benjamin Marzinski
2025-07-26  3:58 ` [PATCH 10/14] libmpathpersist: only clear the key if we are using the prkeys file Benjamin Marzinski
2025-08-25 16:21   ` Martin Wilck
2025-08-29  3:21     ` Benjamin Marzinski
2025-08-29  7:28       ` Martin Wilck
2025-07-26  3:58 ` [PATCH 11/14] libmpathpersist: Restore old reservation key on failure Benjamin Marzinski
2025-07-26  3:58 ` [PATCH 12/14] libmpatpersist: update reservation key before checking paths Benjamin Marzinski
2025-08-25 16:36   ` Martin Wilck
2025-08-29  3:37     ` Benjamin Marzinski [this message]
2025-08-29  7:35       ` Martin Wilck
2025-07-26  3:58 ` [PATCH 13/14] libmpathpersist: retry on conflicts in mpath_prout_common Benjamin Marzinski
2025-07-26  3:58 ` [PATCH 14/14] libmpathpersist: Don't always fail registrations for retryable errors Benjamin Marzinski
2025-08-25 21:46 ` [PATCH 00/14] Additional fixes and cleanups Martin Wilck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aLEgiGGxvEySW397@redhat.com \
    --to=bmarzins@redhat.com \
    --cc=christophe.varoqui@opensvc.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=martin.wilck@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.