From: Benjamin Marzinski <bmarzins@redhat.com>
To: Brian Bunker <brian@purestorage.com>
Cc: dm-devel@lists.linux.dev, Martin Wilck <mwilck@suse.com>,
Simon Dodsley <simon@purestorage.com>
Subject: Re: [PATCH 1/1] multipath: resolve map paths before delegating -f to multipathd
Date: Mon, 28 Sep 2026 14:50:48 -0400 [thread overview]
Message-ID: <arq3COa2XcN_D-Km@redhat.com> (raw)
In-Reply-To: <27189ec36e897519735f76a26833e39b0f4557bc.1790610404.git.brian@purestorage.com>
On Mon, Sep 28, 2026 at 09:54:43AM -0700, Brian Bunker wrote:
> --- a/multipath/main.c
> +++ b/multipath/main.c
> @@ -729,6 +729,30 @@ get_dev_type(char *dev) {
> return DEV_NONE;
> }
>
> +/*
> + * multipathd resolves "del map $map" arguments by alias, WWID or dm-N
> + * name, not by device path. If a map was passed as a path, e.g.
> + * /dev/mapper/$alias or /dev/disk/by-id/dm-uuid-mpath-$WWID, replace it
> + * with the map name.
> + */
> +static void
> +resolve_devmap_path(char *dev)
> +{
> + struct stat buf;
> + char __attribute__((cleanup(cleanup_charp))) *name = NULL;
> +
> + if (valid_alias(dev) || stat(dev, &buf) != 0 ||
> + !S_ISBLK(buf.st_mode))
> + return;
> +
> + name = dm_mapname(major(buf.st_rdev), minor(buf.st_rdev));
> + if (!name)
> + return;
> +
> + condlog(3, "%s: using map name %s", dev, name);
> + strlcpy(dev, name, FILE_NAME_SIZE);
> +}
> +
> /*
> * Some multipath commands are dangerous to run while multipathd is running.
> * For example, "multipath -r" may apply a modified configuration to the kernel,
> @@ -1027,6 +1051,8 @@ main (int argc, char *argv[])
> condlog(0, "the -f option requires a map name to remove");
> goto out;
> }
Thanks for the fix. This looks good, although I wonder if we should
always update dev for a DEV_DEVMAP type device that we can stat(),
likely in get_dev_type(). That would keep us from needing to deal with
this again if we delegate anything else to multipathd. Thoughts, Martin?
Otherwise, I'm fine with this as is.
-Ben
> + if (cmd == CMD_FLUSH_ONE)
> + resolve_devmap_path(dev);
>
> while (1) {
> int ret = delegate_to_multipathd(cmd, dev, dev_type, conf);
> --
> 2.55.0
prev parent reply other threads:[~2026-09-28 18:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 16:54 [PATCH 0/1] multipath: fix "multipath -f <path>" regression since 0.9.8 Brian Bunker
2026-09-28 16:54 ` [PATCH 1/1] multipath: resolve map paths before delegating -f to multipathd Brian Bunker
2026-09-28 18:50 ` 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=arq3COa2XcN_D-Km@redhat.com \
--to=bmarzins@redhat.com \
--cc=brian@purestorage.com \
--cc=dm-devel@lists.linux.dev \
--cc=mwilck@suse.com \
--cc=simon@purestorage.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