[dm-devel] [PATCH] Fix hwtable test after "libmultipath: don't bother to recheck timeout"

2023-09-01 Thread mwilck
From: Martin Wilck The previous patch "libmultipath: don't bother to recheck timeout" causes sysfs_get_timeout() to be called less frequently. Adapt the tests. Signed-off-by: Martin Wilck --- tests/test-lib.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/tests/test-lib.c

[dm-devel] [PATCH 18/21] libmultipath: keep bindings in memory

2023-09-01 Thread mwilck
From: Martin Wilck Rather than opening the bindings file every time we must retrieve a binding, keep the contents in memory and write the file only if additions have been made. This simplifies the code, and should speed up alias lookups significantly. As a side effect, the aliases will be stored

[dm-devel] [PATCH 10/21] multipath-tools test: use mock_bindings_file() consistently

2023-09-01 Thread mwilck
From: Martin Wilck Further improve test readablity. Signed-off-by: Martin Wilck --- tests/alias.c | 186 ++ 1 file changed, 80 insertions(+), 106 deletions(-) diff --git a/tests/alias.c b/tests/alias.c index cb6695b..a1415c6 100644 ---

[dm-devel] [PATCH 20/21] libmultipath: dm_get_uuid(): return emtpy UUID for non-existing maps

2023-09-01 Thread mwilck
From: Martin Wilck libdevmapper will most probably not return a UUID for non-existing maps anyway. But it's cheap to double-check here. Signed-off-by: Martin Wilck --- libmultipath/devmapper.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git

[dm-devel] [PATCH 08/21] multipath-tools test: consistent use of macros in alias test

2023-09-01 Thread mwilck
From: Martin Wilck Used the macros introduced with the tests for get_user_friendly_alias() also in the previously existing tests. Signed-off-by: Martin Wilck --- tests/alias.c | 80 --- 1 file changed, 38 insertions(+), 42 deletions(-) diff

[dm-devel] [PATCH 19/21] multipath-tools tests: fix alias tests

2023-09-01 Thread mwilck
From: Martin Wilck The different implementation of get_user_friendly_alias() and its helpers necessitates changes in the unit tests. It would be nice if it didn't, but the unit tests are too closely bound to the implementation to make this possible. - The bindings table is held in memory in

[dm-devel] [PATCH 13/21] libmultipath: alias.c: move bindings related code up

2023-09-01 Thread mwilck
From: Martin Wilck No code changes, just moving code. Signed-off-by: Martin Wilck --- libmultipath/alias.c | 239 ++- 1 file changed, 120 insertions(+), 119 deletions(-) diff --git a/libmultipath/alias.c b/libmultipath/alias.c index af2f647..5a6cdee

[dm-devel] [PATCH 15/21] libmultipath: update_bindings_file: use a single write()

2023-09-01 Thread mwilck
From: Martin Wilck Save code and syscalls by assembling the content in memory first. write() may return less bytes written than expected. Deal with it. Signed-off-by: Martin Wilck --- libmultipath/alias.c | 26 +- 1 file changed, 17 insertions(+), 9 deletions(-) diff

[dm-devel] [PATCH 11/21] libmultipath: add global variable for current bindings

2023-09-01 Thread mwilck
From: Martin Wilck Add a variable global_bindings that holds the currently active vector of bindings. This variable is freed at program exit. Signed-off-by: Martin Wilck --- libmultipath/alias.c | 11 +-- libmultipath/alias.h | 1 +

[dm-devel] [PATCH 16/21] libmultipath: update_bindings_file: don't log temp file name

2023-09-01 Thread mwilck
From: Martin Wilck The name of the temp file is unlikely to be helpful for uses, and hard to predict in the unit test. Omit it. Signed-off-by: Martin Wilck --- libmultipath/alias.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libmultipath/alias.c

[dm-devel] [PATCH 17/21] libmultipath: alias.c: factor out read_binding()

2023-09-01 Thread mwilck
From: Martin Wilck This way we can test the parsing of input lines from the bindings file more easily. Signed-off-by: Martin Wilck --- libmultipath/alias.c | 58 ++-- 1 file changed, 40 insertions(+), 18 deletions(-) diff --git a/libmultipath/alias.c

[dm-devel] [PATCH 21/21] libmultipath: adapt to new semantics of dm_get_uuid()

2023-09-01 Thread mwilck
From: Martin Wilck dm_get_uuid() will return 1 for non-existing maps. Thus we don't need to call dm_map_present() any more in alias_already_taken(). This changes our semantics: previously we'd avoid using an alias for which dm_get_uuid() had failed. Now we treat failure in dm_get_uuid() as

[dm-devel] [PATCH 06/21] multipath-tools test: simplify debugging for condlog mismatch

2023-09-01 Thread mwilck
From: Martin Wilck If there's a mismatch between expected and actual log message, print both messages. Signed-off-by: Martin Wilck --- tests/test-log.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test-log.c b/tests/test-log.c index c174587..6351699 100644 ---

[dm-devel] [PATCH 14/21] libmultipath: update_bindings_file: take filename argument

2023-09-01 Thread mwilck
From: Martin Wilck This function just uses the file name, no other configuration parameters. Also, pass the Bindings argument first to use the same convention as the other functions in this file. Signed-off-by: Martin Wilck --- libmultipath/alias.c | 12 ++-- 1 file changed, 6

[dm-devel] [PATCH 07/21] multipath-tools tests: add tests for get_user_friendly_alias()

2023-09-01 Thread mwilck
From: Martin Wilck Signed-off-by: Martin Wilck --- tests/alias.c | 531 ++ 1 file changed, 531 insertions(+) diff --git a/tests/alias.c b/tests/alias.c index 11f209e..e2372d1 100644 --- a/tests/alias.c +++ b/tests/alias.c @@ -81,6 +81,35 @@ int

[dm-devel] [PATCH 09/21] multipath-tools tests: convert mock_{failed, used}_alias to macros

2023-09-01 Thread mwilck
From: Martin Wilck This way we can further improve readability of the individual test cases. Signed-off-by: Martin Wilck --- tests/alias.c | 98 +-- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/tests/alias.c b/tests/alias.c

[dm-devel] [PATCH 12/21] libmultipath: rename fix_bindings_file() to update_bindings_file()

2023-09-01 Thread mwilck
From: Martin Wilck We will use this function in a more generic way, give it a more generic name. Signed-off-by: Martin Wilck --- libmultipath/alias.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libmultipath/alias.c b/libmultipath/alias.c index 0759643..af2f647

[dm-devel] [PATCH 03/21] libmultipath: unify use_existing_alias() and get_user_friendly_alias()

2023-09-01 Thread mwilck
From: Martin Wilck These functions are only called from select_alias(). The logic is more obvious when unified in a single function. Signed-off-by: Martin Wilck Cc: David Bond --- libmultipath/alias.c | 82 -- libmultipath/alias.h | 9 ++---

[dm-devel] [PATCH 04/21] libmultipath: never allocate an alias that's already taken

2023-09-01 Thread mwilck
From: Martin Wilck If the bindings file is changed in a way that multipathd can't handle (e.g. by swapping the aliases of two maps), multipathd must not try to re-use an alias that is already used by another map. Creating or renaming a map with such an alias will fail. We already avoid this for

[dm-devel] [PATCH 05/21] libmultipath: lookup_binding: add comment about the algorithm

2023-09-01 Thread mwilck
From: Martin Wilck When I read this code, I always get confused. Adding comments to explain the algorithm. Signed-off-by: Martin Wilck --- libmultipath/alias.c | 35 +++ 1 file changed, 35 insertions(+) diff --git a/libmultipath/alias.c b/libmultipath/alias.c

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

2023-09-01 Thread mwilck
From: Martin Wilck 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

[dm-devel] [PATCH 01/21] libmultipath: sysfs_set_scsi_tmo: do nothing for ACT_DRY_RUN

2023-09-01 Thread mwilck
From: Martin Wilck "multipath -d" might change sysfs timeouts of SCSI devices. Make sure it doesn't. Signed-off-by: Martin Wilck Cc: Jehan Singh --- libmultipath/configure.c | 4 ++-- libmultipath/discovery.c | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git

[dm-devel] [PATCH 02/21] libmultipath: add alias_already_taken()

2023-09-01 Thread mwilck
From: Martin Wilck Factor out a trivial helper function. Signed-off-by: Martin Wilck Cc: David Bond --- libmultipath/alias.c | 34 -- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/libmultipath/alias.c b/libmultipath/alias.c index

Re: [dm-devel] [PATCH v2 0/4] Make prio timeouts work like checkers

2023-09-01 Thread Martin Wilck
On Fri, 2023-09-01 at 18:16 +0200, Martin Wilck wrote: > On Thu, 2023-08-31 at 16:57 -0500, Benjamin Marzinski wrote: > > This patchset changes how prioritizers set their timeouts, to make > > them > > match how the checker functions work, and also cleans up some minor > > timeout issues. > > > >

Re: [dm-devel] [PATCH v2 0/4] Make prio timeouts work like checkers

2023-09-01 Thread Martin Wilck
On Thu, 2023-08-31 at 16:57 -0500, Benjamin Marzinski wrote: > This patchset changes how prioritizers set their timeouts, to make > them > match how the checker functions work, and also cleans up some minor > timeout issues. > > This patchset has been entirely reworked based on suggestions from >