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 4/7] libmultipath: add name and minor outputs for dm_map_present_by_uuid()
Date: Thu, 27 Jun 2024 14:48:37 -0400 [thread overview]
Message-ID: <Zn20BcBvXJLClyyI@redhat.com> (raw)
In-Reply-To: <6204dbb3f98a53b472e52c0356a16260f95ba2af.camel@suse.com>
On Thu, Jun 27, 2024 at 11:27:41AM +0200, Martin Wilck wrote:
> On Wed, 2024-06-05 at 19:22 -0400, Benjamin Marzinski wrote:
> > add arguments to dm_map_present_by_uuid() to allow optionally
> > fetching
> > the device name and minor number for the devices found by WWID. These
> > will be used by a later patch.
> >
> > Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
>
> I have to say I don't like this much. At least the function name should
> be changed. But actually, our handling of DM_DEVICE_INFO and
> DM_DEVICE_STATUS dm tasks needs refactoring. As far as the kernel is
> concerned, all dm ioctls that refer to an existing map will find the
> map either by uuid, by name, or by major/minor, and the map uuid and
> name will always be filled in.
>
> I'll see if I can come up with something to clean this up.
Do you want be to resend this patch with a name change, or will that
just happen as part of your cleanup?
-Ben
>
> Regards
> Martin
>
>
> > ---
> > libmultipath/devmapper.c | 11 ++++++++++-
> > libmultipath/devmapper.h | 2 +-
> > libmultipath/libmultipath.version | 2 +-
> > libmultipath/valid.c | 2 +-
> > 4 files changed, 13 insertions(+), 4 deletions(-)
> >
> > diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
> > index 08bb3c51..7fe68841 100644
> > --- a/libmultipath/devmapper.c
> > +++ b/libmultipath/devmapper.c
> > @@ -936,7 +936,7 @@ out:
> > * -1 : error
> > */
> > int
> > -dm_map_present_by_uuid(const char *uuid)
> > +dm_map_present_by_uuid(const char *uuid, char **name_p, int *minor)
> > {
> > struct dm_task *dmt;
> > struct dm_info info;
> > @@ -966,6 +966,15 @@ dm_map_present_by_uuid(const char *uuid)
> > goto out_task;
> >
> > r = !!info.exists;
> > + if (!r)
> > + goto out_task;
> > +
> > + if (name_p) {
> > + const char *name = dm_task_get_name(dmt);
> > + *name_p = (name && strlen(name)) ? strdup(name) :
> > NULL;
> > + }
> > + if (minor)
> > + *minor = info.minor;
> >
> > out_task:
> > dm_task_destroy(dmt);
> > diff --git a/libmultipath/devmapper.h b/libmultipath/devmapper.h
> > index 19b79c5b..d9c71e92 100644
> > --- a/libmultipath/devmapper.h
> > +++ b/libmultipath/devmapper.h
> > @@ -43,7 +43,7 @@ int dm_simplecmd_noflush (int task, const char
> > *name, uint16_t udev_flags);
> > int dm_addmap_create (struct multipath *mpp, char *params);
> > int dm_addmap_reload (struct multipath *mpp, char *params, int
> > flush);
> > int dm_map_present (const char *name);
> > -int dm_map_present_by_uuid(const char *uuid);
> > +int dm_map_present_by_uuid(const char *uuid, char **name_p, int
> > *minor);
> > int dm_get_map(const char *name, unsigned long long *size, char
> > **outparams);
> > int dm_get_status(const char *name, char **outstatus);
> > int dm_type(const char *name, char *type);
> > diff --git a/libmultipath/libmultipath.version
> > b/libmultipath/libmultipath.version
> > index eb511749..600de394 100644
> > --- a/libmultipath/libmultipath.version
> > +++ b/libmultipath/libmultipath.version
> > @@ -43,7 +43,7 @@ LIBMPATHCOMMON_1.0.0 {
> > put_multipath_config;
> > };
> >
> > -LIBMULTIPATH_24.0.0 {
> > +LIBMULTIPATH_25.0.0 {
> > global:
> > /* symbols referenced by multipath and multipathd */
> > add_foreign;
> > diff --git a/libmultipath/valid.c b/libmultipath/valid.c
> > index f2237787..3b060192 100644
> > --- a/libmultipath/valid.c
> > +++ b/libmultipath/valid.c
> > @@ -360,7 +360,7 @@ is_path_valid(const char *name, struct config
> > *conf, struct path *pp,
> > if (check_wwids_file(pp->wwid, 0) == 0)
> > return PATH_IS_VALID_NO_CHECK;
> >
> > - if (dm_map_present_by_uuid(pp->wwid) == 1)
> > + if (dm_map_present_by_uuid(pp->wwid, NULL, NULL) == 1)
> > return PATH_IS_VALID;
> >
> > /* all these act like FIND_MULTIPATHS_STRICT for finding if
> > a
next prev parent reply other threads:[~2024-06-27 18:48 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-05 23:22 [PATCH 0/7] multipath-tools: cli_add_map cleanup and misc fixes Benjamin Marzinski
2024-06-05 23:22 ` [PATCH 1/7] multipathd: fix flush check in flush_map() Benjamin Marzinski
2024-06-27 9:31 ` Martin Wilck
2024-06-05 23:22 ` [PATCH 2/7] libmultipath: check for not PATH_UP in detect_alua Benjamin Marzinski
2024-06-27 9:31 ` Martin Wilck
2024-06-05 23:22 ` [PATCH 3/7] multipathd: refresh multipath before calling set_no_path_retry() Benjamin Marzinski
2024-06-27 7:47 ` Martin Wilck
2024-06-27 18:32 ` Benjamin Marzinski
2024-06-27 18:39 ` Benjamin Marzinski
2024-06-27 21:31 ` Martin Wilck
2024-07-01 18:41 ` Benjamin Marzinski
2024-07-02 7:34 ` Martin Wilck
2024-07-02 18:10 ` Benjamin Marzinski
2024-07-04 7:19 ` Martin Wilck
2024-06-05 23:22 ` [PATCH 4/7] libmultipath: add name and minor outputs for dm_map_present_by_uuid() Benjamin Marzinski
2024-06-27 9:27 ` Martin Wilck
2024-06-27 18:48 ` Benjamin Marzinski [this message]
2024-06-27 20:42 ` Martin Wilck
2024-06-05 23:22 ` [PATCH 5/7] multipath-tools: Makefile.inc: compile with -fexceptions Benjamin Marzinski
2024-06-27 9:32 ` Martin Wilck
2024-06-05 23:22 ` [PATCH 6/7] multipathd: free alias if cli_add_map() is cancelled Benjamin Marzinski
2024-06-27 9:32 ` Martin Wilck
2024-06-05 23:22 ` [PATCH 7/7] multipathd: make cli_add_map() handle adding maps by WWID correctly Benjamin Marzinski
2024-06-27 9:33 ` 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=Zn20BcBvXJLClyyI@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.