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 3/6] libmultipath: fix removing device after failed creation
Date: Mon, 18 Nov 2024 16:23:02 -0500 [thread overview]
Message-ID: <ZzuwNrL0o4Slfu-v@redhat.com> (raw)
In-Reply-To: <74d9cd1eb2dc39dfa5e365791ba000b480c73a09.camel@suse.com>
On Mon, Nov 18, 2024 at 12:21:01PM +0100, Martin Wilck wrote:
> On Fri, 2024-11-15 at 18:22 -0500, Benjamin Marzinski wrote:
> > dm_flush_nap_nosync() only removes a device if it has a multipath
> > table.
> > On failed removes, there is no table, so this function does nothing.
> > Instead, if libmp_mapinfo() returns DMP_EMPTY, then there is an empty
> > map,
> > and it is removed using dm_device_remove().
> >
> > Also, since there are no longer any callers of dm_flush_map_nosync(),
> > remove it.
> >
> > Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
> > ---
> > libmultipath/devmapper.c | 7 +++++--
> > libmultipath/devmapper.h | 1 -
> > 2 files changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
> > index b718dccf..842e7c80 100644
> > --- a/libmultipath/devmapper.c
> > +++ b/libmultipath/devmapper.c
> > @@ -557,9 +557,12 @@ int dm_addmap_create (struct multipath *mpp,
> > char * params)
> > * Failing the second part leaves an empty map.
> > Clean it up.
> > */
> > err = errno;
> > - if (dm_map_present(mpp->alias)) {
> > + if (libmp_mapinfo(DM_MAP_BY_NAME |
> > MAPINFO_MPATH_ONLY |
> > + MAPINFO_CHECK_UUID,
> > + (mapid_t) { .str = mpp->alias },
> > + (mapinfo_t) { .uuid = NULL }) ==
> > DMP_EMPTY) {
> > condlog(3, "%s: failed to load map (a path
> > might be in use)", mpp->alias);
>
> This error message seems wrong for emtpy tables.
This code exists because if you fail to fully create a DM device, you
are (or were, I'm not sure if this issue still exists) sometimes left
with an empty device that needs cleaning up. Previously multipath would
just delete any device that existed with the name of the device you were
trying to create. The new code only deletes empty devices, to avoid
accidentally deleting a valid device that got set up at the same time as
you were doing the create. But these empty devices should only exist if
you failed to load the table for the new device, perhaps because a path
was in use.
So the message still makes sense here, as much as it ever did.
-Ben
>
> Martin
>
next prev parent reply other threads:[~2024-11-18 21:23 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-15 23:22 [PATCH 0/6] multipath-tools: Handle tableless DM devices Benjamin Marzinski
2024-11-15 23:22 ` [PATCH 1/6] libmultipath: signal device with no table in libmp_mapinfo Benjamin Marzinski
2024-11-19 16:39 ` Martin Wilck
2024-11-19 20:33 ` Benjamin Marzinski
2024-11-20 8:49 ` Martin Wilck
2024-11-20 21:59 ` Benjamin Marzinski
2024-11-21 8:57 ` Martin Wilck
2024-11-21 18:00 ` Benjamin Marzinski
2024-11-15 23:22 ` [PATCH 2/6] multipath-tools tests: fix mapinfo tests Benjamin Marzinski
2024-11-15 23:22 ` [PATCH 3/6] libmultipath: fix removing device after failed creation Benjamin Marzinski
2024-11-18 11:21 ` Martin Wilck
2024-11-18 21:23 ` Benjamin Marzinski [this message]
2024-11-15 23:22 ` [PATCH 4/6] libmultipath: Add flag to always return device ID when found Benjamin Marzinski
2024-11-15 23:22 ` [PATCH 5/6] libmultipath: check table type in dm_find_map_by_wwid Benjamin Marzinski
2024-11-15 23:22 ` [PATCH 6/6] libmultipath: handle a create corner case for empty devices Benjamin Marzinski
2024-11-18 11:18 ` [PATCH 0/6] multipath-tools: Handle tableless DM devices Martin Wilck
2024-11-18 21:14 ` Benjamin Marzinski
2024-11-19 12:20 ` Martin Wilck
2024-11-19 16:40 ` Martin Wilck
2024-11-19 19:13 ` Benjamin Marzinski
2024-11-20 8:51 ` Martin Wilck
2024-11-20 19:50 ` 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=ZzuwNrL0o4Slfu-v@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.