mbox series

[v2,00/13] multipath-tools: Handle tableless DM devices

Message ID 20241122211133.718861-1-bmarzins@redhat.com (mailing list archive)
Headers show
Series multipath-tools: Handle tableless DM devices | expand

Message

Benjamin Marzinski Nov. 22, 2024, 9:11 p.m. UTC
This is another stab at handling tableless multipath devices. The first
two patches are reworkings of two patches from my last patchset based
on feedback from Martin. The rest are new.

libmp_mapinfo now has a new return value, DMP_EMPTY, for devices that
don't have any table. The creation failure path is fixed to check for
this value before removing a device after a failed create, instead of
just removing any existing DM device with the same name. 

libmp_mapinfo now also always fills in info.name, info.uuid and info.dmi
if requested, whenever a device is found, even if it returns
DMP_NO_MATCH, DMP_EMPTY, or DMP_ERR. dm_find_map_by_wwid() uses this, as
well as MAPINFO_MPATH_ONLY, to only return DM_OK for valid multipath
devices, but to return the alias of any device that matches the uuid,
even if it's not a valid multipath device.

domap() has been updated to use dm_find_map_by_wwid() to check for any
DM device that matches the WWID of the device to be created. This lets
it handle tableless devices that share the WWID of the device to be
created but not its alias. Previously, multipath would fail attempting
to create these devices. Now it correctly renames and reloads them when
running multipath, starting or reloading multipathd, or running
"multipathd add map".

Finally, dm_flush_map__() and do_foreach_partmaps() also handle tabless
devices. So multipath -F will remove tabless multipath devices, as well
as tableless partition devices on top of multipath devices (tabless or
not). I cleanup up a number of minor issues while working on this.

Changes from v1 (based on discussions with Martin Wilck):
0004: Dropped the flag. libmp_mapinfo now always fills in uuid, name, and
      dmi if a device was found and they are non-NULL.
0005: Adapt to the changes in 0004
0007-0013: New patches to handle tabless devices in dm_flush_map__() and
           do_foreach_partmaps(), as well as some minor fixes/cleanups I
           encountered along the way.

Benjamin Marzinski (12):
  libmultipath: signal device with no table in libmp_mapinfo
  libmultipath: fix removing device after failed creation
  libmultipath: set uuid, name, and dmi if a device is found
  libmultipath: check table type in dm_find_map_by_wwid
  libmultipath: handle a create corner case for empty devices
  libmultipath: handle empty maps in dm_flush_map__
  libmultipath: factor out code to check if a device is a parition
  libmultipath: remove recursive calls in partmap_funcs
  libmultipath: move dm_rename__ before rename_partmap
  libmultipath: assume device is in use if dm_get_opencount fails
  libmultipath: accept empty partitions as valid in do_foreach_partmaps
  libmultipath: reduce log level for DMP_NOT_FOUND

Martin Wilck (1):
  multipath-tools tests: fix mapinfo tests

 libmultipath/configure.c   |  21 +++-
 libmultipath/devmapper.c   | 212 +++++++++++++++++++++----------------
 libmultipath/devmapper.h   |  13 ++-
 libmultipath/structs_vec.c |   5 +-
 multipathd/cli_handlers.c  |   8 +-
 tests/mapinfo.c            |  92 ++++++++++++----
 6 files changed, 235 insertions(+), 116 deletions(-)

Comments

Martin Wilck Nov. 22, 2024, 10:21 p.m. UTC | #1
On Fri, 2024-11-22 at 16:11 -0500, Benjamin Marzinski wrote:
> This is another stab at handling tableless multipath devices. The
> first
> two patches are reworkings of two patches from my last patchset based
> on feedback from Martin. The rest are new.
> 
> libmp_mapinfo now has a new return value, DMP_EMPTY, for devices that
> don't have any table. The creation failure path is fixed to check for
> this value before removing a device after a failed create, instead of
> just removing any existing DM device with the same name. 
> 
> libmp_mapinfo now also always fills in info.name, info.uuid and
> info.dmi
> if requested, whenever a device is found, even if it returns
> DMP_NO_MATCH, DMP_EMPTY, or DMP_ERR. dm_find_map_by_wwid() uses this,
> as
> well as MAPINFO_MPATH_ONLY, to only return DM_OK for valid multipath
> devices, but to return the alias of any device that matches the uuid,
> even if it's not a valid multipath device.
> 
> domap() has been updated to use dm_find_map_by_wwid() to check for
> any
> DM device that matches the WWID of the device to be created. This
> lets
> it handle tableless devices that share the WWID of the device to be
> created but not its alias. Previously, multipath would fail
> attempting
> to create these devices. Now it correctly renames and reloads them
> when
> running multipath, starting or reloading multipathd, or running
> "multipathd add map".
> 
> Finally, dm_flush_map__() and do_foreach_partmaps() also handle
> tabless
> devices. So multipath -F will remove tabless multipath devices, as
> well
> as tableless partition devices on top of multipath devices (tabless
> or
> not). I cleanup up a number of minor issues while working on this.
> 
> Changes from v1 (based on discussions with Martin Wilck):
> 0004: Dropped the flag. libmp_mapinfo now always fills in uuid, name,
> and
>       dmi if a device was found and they are non-NULL.
> 0005: Adapt to the changes in 0004
> 0007-0013: New patches to handle tabless devices in dm_flush_map__()
> and
>            do_foreach_partmaps(), as well as some minor
> fixes/cleanups I
>            encountered along the way.
> 
> Benjamin Marzinski (12):
>   libmultipath: signal device with no table in libmp_mapinfo
>   libmultipath: fix removing device after failed creation
>   libmultipath: set uuid, name, and dmi if a device is found
>   libmultipath: check table type in dm_find_map_by_wwid
>   libmultipath: handle a create corner case for empty devices
>   libmultipath: handle empty maps in dm_flush_map__
>   libmultipath: factor out code to check if a device is a parition
>   libmultipath: remove recursive calls in partmap_funcs
>   libmultipath: move dm_rename__ before rename_partmap
>   libmultipath: assume device is in use if dm_get_opencount fails
>   libmultipath: accept empty partitions as valid in
> do_foreach_partmaps
>   libmultipath: reduce log level for DMP_NOT_FOUND
> 
> Martin Wilck (1):
>   multipath-tools tests: fix mapinfo tests
> 
>  libmultipath/configure.c   |  21 +++-
>  libmultipath/devmapper.c   | 212 +++++++++++++++++++++--------------
> --
>  libmultipath/devmapper.h   |  13 ++-
>  libmultipath/structs_vec.c |   5 +-
>  multipathd/cli_handlers.c  |   8 +-
>  tests/mapinfo.c            |  92 ++++++++++++----
>  6 files changed, 235 insertions(+), 116 deletions(-)
> 

For the series, except for the small nits I mentioned in previous
posts:

Reviewed-by: Martin Wilck <mwilck@suse.com>