[dm-devel] [PATCH 00/21] multipath-tools: user-friendly names rework

mwilck at suse.com mwilck at suse.com
Fri Sep 1 18:02:13 UTC 2023


From: Martin Wilck <mwilck at suse.com>

This patch set contains a two-step rework of the user-friendly
names code. Patch 2-5 change the current code such that it (well, almost)
never attempts to use an alias that is currently in use by another
map. We already have some checks for this, but they don't cover all
possible scenarios. Patch 6-10 add some units tests for
get_user_friendly_alias(), and restructure the unit tests somewhat.

In the second part of the set, Patch 11-18 restructure the alias code such
that we don't read the bindings file every time an alias is
requested. Instead, we just use a memory cache of the current bindings, and
re-write the file only if a new binding is added.  This reduces the number of
system calls and simplifies the code.

There are some side effects, which are discussed in the commit message of
patch 18. Most importantly, multipathd will not pick up changes to the
bindings file immediately after running "multipath -a" or "multipath -w".

Patch 19 applies the changes to the unit tests that become
necessary because of the previous patches. Patch 20/21 add another
optimization for the alias_already_taken() test.

Patch 1 is a separate, independent fix.

NOTE: my main test bed is currently unavailable, therefore this set has
yet reveived less testing than usual. I consider this a v1 series and
will do more testing while the review process is going on.

Reviews and comments welcome.

Martin Wilck (21):
  libmultipath: sysfs_set_scsi_tmo: do nothing for ACT_DRY_RUN
  libmultipath: add alias_already_taken()
  libmultipath: unify use_existing_alias() and get_user_friendly_alias()
  libmultipath: never allocate an alias that's already taken
  libmultipath: lookup_binding: add comment about the algorithm
  multipath-tools test: simplify debugging for condlog mismatch
  multipath-tools tests: add tests for get_user_friendly_alias()
  multipath-tools test: consistent use of macros in alias test
  multipath-tools tests: convert mock_{failed,used}_alias to macros
  multipath-tools test: use mock_bindings_file() consistently
  libmultipath: add global variable for current bindings
  libmultipath: rename fix_bindings_file() to update_bindings_file()
  libmultipath: alias.c: move bindings related code up
  libmultipath: update_bindings_file: take filename argument
  libmultipath: update_bindings_file: use a single write()
  libmultipath: update_bindings_file: don't log temp file name
  libmultipath: alias.c: factor out read_binding()
  libmultipath: keep bindings in memory
  multipath-tools tests: fix alias tests
  libmultipath: dm_get_uuid(): return emtpy UUID for non-existing maps
  libmultipath: adapt to new semantics of dm_get_uuid()

 libmultipath/alias.c              |  794 ++++++++---------
 libmultipath/alias.h              |   10 +-
 libmultipath/configure.c          |    7 +-
 libmultipath/devmapper.c          |   10 +-
 libmultipath/discovery.c          |    3 +
 libmultipath/libmultipath.version |    1 +
 libmultipath/propsel.c            |   19 +-
 multipath/main.c                  |    2 +
 multipathd/main.c                 |    1 +
 tests/alias.c                     | 1366 ++++++++++++++++++++++-------
 tests/test-log.c                  |    4 +-
 11 files changed, 1491 insertions(+), 726 deletions(-)

-- 
2.41.0



More information about the dm-devel mailing list