Linux Device Mapper development
 help / color / mirror / Atom feed
From: Benjamin Marzinski <bmarzins@redhat.com>
To: Brian Bunker <brian@purestorage.com>
Cc: dm-devel@lists.linux.dev, Martin Wilck <mwilck@suse.com>,
	Christophe Varoqui <christophe.varoqui@opensvc.com>
Subject: Re: [PATCH v2 1/1] multipathd: don't leave maps read-only after write protect is cleared
Date: Wed, 21 Oct 2026 15:50:15 -0400	[thread overview]
Message-ID: <atkXd_j6KLmtLmBK@redhat.com> (raw)
In-Reply-To: <20261021182759.30106-2-brian@purestorage.com>

On Wed, Oct 21, 2026 at 11:27:59AM -0700, 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
> when a load succeeds:
> 
> - needs_ro_update() now sets force_readonly whenever it returns true:
>   to 1 for a DISK_RO=1 uevent, to 0 when all of the map's paths are
>   writable, and from the paths' state when the map has no dm info.
>   uev_update_path() no longer sets or clears it itself.
> 
> - 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.

Oops. Good catch.

> 
> - 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() clears it after a successful load, as it does for
>   need_reload, so it can't outlive the load it was set for.
> 
> Signed-off-by: Brian Bunker <brian@purestorage.com>

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


  reply	other threads:[~2026-10-21 19:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-21 18:27 [PATCH v2 0/1] multipathd: don't leave maps read-only after write protect is cleared Brian Bunker
2026-10-21 18:27 ` [PATCH v2 1/1] " Brian Bunker
2026-10-21 19:50   ` Benjamin Marzinski [this message]
2026-10-21 21:34   ` mwilck
2026-10-21 23:19     ` [PATCH v3 0/1] " Brian Bunker
2026-10-21 23:19       ` [PATCH v3 1/1] " Brian Bunker
2026-10-22 20:17         ` Martin Wilck
2026-10-23  0:24           ` Benjamin Marzinski
2026-10-23 20:50             ` Martin Wilck
2026-10-23 23:40               ` Benjamin Marzinski
2026-10-26  9:26                 ` Martin Wilck
2026-10-26 18:04                   ` Brian Bunker
2026-10-26 22:23                     ` Martin Wilck
2026-10-27  4:29                       ` Benjamin Marzinski
2026-10-26 22:20                 ` Martin Wilck
2026-10-27  4:52                   ` Benjamin Marzinski

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=atkXd_j6KLmtLmBK@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox