All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Marzinski <bmarzins@redhat.com>
To: Brian Bunker <brian@purestorage.com>
Cc: dm-devel@lists.linux.dev, mwilck@suse.com,
	christophe.varoqui@opensvc.com
Subject: Re: [PATCH v6 1/1] multipathd: don't leave maps read-only after write protect is cleared
Date: Tue, 3 Nov 2026 19:03:10 -0500	[thread overview]
Message-ID: <aup2Pud9F51mim97@redhat.com> (raw)
In-Reply-To: <20261103003150.78513-2-brian@purestorage.com>

On Mon, Nov 02, 2026 at 04:31:50PM -0800, Brian Bunker wrote:
> ev_add_path() sets mpp->force_readonly when a newly added path is
> read-only, but never clears it. If a map is created or reloaded while
> its storage is write protected, the flag stays set. When write protect
> is cleared, the reload that uev_update_path() does for the DISK_RO=0
> uevent uses the stale flag and loads the map read-only, even though all
> of its paths are read-write. uev_update_path() clears the flag after
> that reload, so the map only recovers if another DISK_RO=0 uevent
> reloads it again. If none comes, the map stays read-only, and since
> mpp->dmi.read_only is then 1, needs_ro_update() also ignores later
> DISK_RO=1 uevents for it.
> 
> Fix this by setting force_readonly before each load and clearing it
> once the load has succeeded:
> 
> - uev_update_path() no longer takes the path's ro state from the
>   uevent's DISK_RO. The uevent only says that something changed. The
>   kernel updates the ro attribute before it sends the uevent, so sysfs
>   is current when the uevent is handled, while the uevent itself may
>   have been queued behind later changes. It just calls
>   needs_ro_update(), which reads the ro state of all of the map's paths
>   from sysfs.
> 
> - needs_ro_update() no longer takes an ro value. It sets
>   force_readonly from the ro state of the map's paths, and returns true
>   if that differs from the map's current state. If the map is already
>   read-only and has to stay so, it clears the flag and returns false,
>   since dm has to reopen the paths for any read-write reload anyway. If
>   the map has no dm info, it fetches it, and returns false if that
>   fails, instead of assuming a reload is needed. Since the flag is
>   recomputed on every call, a failed read-only reload is retried on the
>   next uevent without any special handling.
> 
> - ev_add_path() sets it from all of the map's paths rather than only
>   the path being added, and only when it is about to load the map
>   (need_do_map). mpp->paths is up to date there after adopt_paths(),
>   while mpp->pg doesn't contain the new paths yet.
> 
> - update_map(), which does reloads that were delayed while the map was
>   waiting for udev (UDEV_WAIT_RELOAD), recomputes it from the map's
>   paths before setting up the map.
> 
> - dm_addmap_create() clears it as soon as it has read it. A failed
>   create leaves no map behind, and the next create computes the flag
>   again.
> 
> - dm_addmap_reload() clears it once the reload and resume have
>   succeeded. If the reload fails, the map keeps its old table, and the
>   flag stays set so that the next reload tries again.
> 
> Signed-off-by: Brian Bunker <brian@purestorage.com>
Thanks for dealing with all the revisions

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>


      reply	other threads:[~2026-11-04  0:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03  0:31 [PATCH v6 0/1] multipathd: don't leave maps read-only after write protect is cleared Brian Bunker
2026-11-03  0:31 ` [PATCH v6 1/1] " Brian Bunker
2026-11-04  0:03   ` Benjamin Marzinski [this message]

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=aup2Pud9F51mim97@redhat.com \
    --to=bmarzins@redhat.com \
    --cc=brian@purestorage.com \
    --cc=christophe.varoqui@opensvc.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=mwilck@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.