[dm-devel] [PATCH v4 6/6] multipathd: don't rescan_path on wwid change in uev_update_path

2021-05-17 Thread Benjamin Marzinski
If get_uid() is returning a different wwid in uev_update_path(), then the uid_attribute must have already gotten updated, which was the purpose behind calling rescan_path() in the first place. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- multipathd/main.c | 1 - 1 file

[dm-devel] [PATCH v4 1/6] multipathd: don't fail to remove path once the map is removed

2021-05-17 Thread Benjamin Marzinski
map removed, there's nothing to keep us from removing the path. Call set_path_removed() before update_mpp_paths() to avoid the odd case of ev_remove_path() removing the map but not the path. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- libmultipath/structs_vec.c |

[dm-devel] [PATCH v4 2/6] multipathd: remove duplicate orphan_paths in flush_map

2021-05-17 Thread Benjamin Marzinski
remove_map_and_stop_waiter() already calls orphan_paths() so flush_map() doesn't need to call orphan_paths() before calling remove_map_and_stop_waiter(). Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- multipathd/main.c | 1 - 1 file changed, 1 deletion(-) diff --git

[dm-devel] [PATCH v4 3/6] multipathd: fix ev_remove_path return code handling

2021-05-17 Thread Benjamin Marzinski
to dereference the path after it was removed. To deal with this, make ev_remove_path() return a different symbolic value for each outcome, and make the callers react appropriately for the different values. Found by coverity. Signed-off-by: Benjamin Marzinski --- multipathd/cli_handlers.c | 24

[dm-devel] [PATCH v4 0/6] Memory issues found by coverity

2021-05-17 Thread Benjamin Marzinski
on Martin's suggestions about wwid change handling in uev_update_path(). Changes from v1: 0001: changed comment based on Martin's suggestion 0004: moved location of atexit() call based on Martin's suggestion 0006: New patch, based on Martin's comments on patch 0003 Benjamin Marzinski (6

[dm-devel] [PATCH v4 4/6] multipath: free vectors in configure

2021-05-17 Thread Benjamin Marzinski
configure() can retry multiple times, each time reallocing a maps and paths vector, and leaking the previous ones. Fix this by always freeing the vectors before configure() exits. Found by coverity. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- multipath/main.c | 7 ++- 1

[dm-devel] [PATCH v3 1/6] multipathd: don't fail to remove path once the map is removed

2021-05-14 Thread Benjamin Marzinski
map removed, there's nothing to keep us from removing the path. Call set_path_removed() before update_mpp_paths() to avoid the odd case of ev_remove_path() removing the map but not the path. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- libmultipath/structs_vec.c |

[dm-devel] [PATCH v3 3/6] multipathd: fix ev_remove_path return code handling

2021-05-14 Thread Benjamin Marzinski
to dereference the path after it was removed. To deal with this, make ev_remove_path() return a different symbolic value for each outcome, and make the callers react appropriately for the different values. Found by coverity. Signed-off-by: Benjamin Marzinski --- multipathd/cli_handlers.c | 14

[dm-devel] [PATCH v3 4/6] multipath: free vectors in configure

2021-05-14 Thread Benjamin Marzinski
configure() can retry multiple times, each time reallocing a maps and paths vector, and leaking the previous ones. Fix this by always freeing the vectors before configure() exits. Found by coverity. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- multipath/main.c | 7 ++- 1

[dm-devel] [PATCH v3 6/6] multipathd: don't rescan_path on wwid change in uev_update_path

2021-05-14 Thread Benjamin Marzinski
If get_uid() is returning a different wwid in uev_update_path(), then the uid_attribute must have already gotten updated, which was the purpose behind calling rescan_path() in the first place. Signed-off-by: Benjamin Marzinski --- multipathd/main.c | 1 - 1 file changed, 1 deletion(-) diff

[dm-devel] [PATCH v3 2/6] multipathd: remove duplicate orphan_paths in flush_map

2021-05-14 Thread Benjamin Marzinski
remove_map_and_stop_waiter() already calls orphan_paths() so flush_map() doesn't need to call orphan_paths() before calling remove_map_and_stop_waiter(). Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- multipathd/main.c | 1 - 1 file changed, 1 deletion(-) diff --git

[dm-devel] [PATCH v3 0/6] Memory issues found by coverity

2021-05-14 Thread Benjamin Marzinski
from v1: 0001: changed comment based on Martin's suggestion 0004: moved location of atexit() call based on Martin's suggestion 0006: New patch, based on Martin's comments on patch 0003 Benjamin Marzinski (6): multipathd: don't fail to remove path once the map is removed multipathd: remove

[dm-devel] [PATCH v3 5/6] kpartx: Don't leak memory when getblock returns NULL

2021-05-14 Thread Benjamin Marzinski
If a new block was allocated, but couldn't be filled, getblock will discard it. When it does so, it needs to free the block to avoid leaking memory. Found by coverity. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- kpartx/kpartx.c | 2 ++ 1 file changed, 2 insertions(+) diff

Re: [dm-devel] [PATCH v2] multipathd: fix compilation issue with liburcu < 0.8

2021-05-14 Thread Benjamin Marzinski
mory leak") > Signed-off-by: Martin Wilck Reviewed-by: Benjamin Marzinski > > --- > v2: Use $(PKGCONFIG) (Ben Marzinski); remove "\n" in awk. > > --- > multipathd/Makefile | 2 ++ > multipathd/main.c | 17 +++-- > 2 files changed, 17 insertions(+

Re: [dm-devel] [PATCH v2 6/6] multipathd: use symbolic returns for ev_remove_path()

2021-05-14 Thread Benjamin Marzinski
On Thu, May 13, 2021 at 08:11:13PM +, Martin Wilck wrote: > On Thu, 2021-05-13 at 12:23 -0500, Benjamin Marzinski wrote: > > There are many possible outcomes of calling ev_remove_path(), and not > > all callers agree on which outcomes are a success and which are a

[dm-devel] [PATCH v2 2/6] multipathd: remove duplicate orphan_paths in flush_map

2021-05-13 Thread Benjamin Marzinski
remove_map_and_stop_waiter() already calls orphan_paths() so flush_map() doesn't need to call orphan_paths() before calling remove_map_and_stop_waiter(). Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- multipathd/main.c | 1 - 1 file changed, 1 deletion(-) diff --git

[dm-devel] [PATCH v2 0/6] Memory issues found by coverity

2021-05-13 Thread Benjamin Marzinski
: changed comment based on Martin's suggestion 0004: moved location of atexit() call based on Martin's suggestion 0006: New patch, based on Martin's comments on patch 0003 Benjamin Marzinski (6): multipathd: don't fail to remove path once the map is removed multipathd: remove duplicate

[dm-devel] [PATCH v2 3/6] multipathd: make ev_remove_path return success on path removal

2021-05-13 Thread Benjamin Marzinski
to dereference the path after it was removed. Change ev_remove_path() to return success whenever the path is removed, even if the map was removed due to a failure when trying to reload it. Found by coverity. Signed-off-by: Benjamin Marzinski --- multipathd/main.c | 6 -- 1 file changed, 4 insertions

[dm-devel] [PATCH v2 5/6] kpartx: Don't leak memory when getblock returns NULL

2021-05-13 Thread Benjamin Marzinski
If a new block was allocated, but couldn't be filled, getblock will discard it. When it does so, it needs to free the block to avoid leaking memory. Found by coverity. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- kpartx/kpartx.c | 2 ++ 1 file changed, 2 insertions(+) diff

[dm-devel] [PATCH v2 1/6] multipathd: don't fail to remove path once the map is removed

2021-05-13 Thread Benjamin Marzinski
map removed, there's nothing to keep us from removing the path. Call set_path_removed() before update_mpp_paths() to avoid the odd case of ev_remove_path() removing the map but not the path. Signed-off-by: Benjamin Marzinski --- libmultipath/structs_vec.c | 4 ++-- multipathd/main.c |

[dm-devel] [PATCH v2 4/6] multipath: free vectors in configure

2021-05-13 Thread Benjamin Marzinski
configure() can retry multiple times, each time reallocing a maps and paths vector, and leaking the previous ones. Fix this by always freeing the vectors before configure() exits. Found by coverity. Signed-off-by: Benjamin Marzinski --- multipath/main.c | 7 ++- 1 file changed, 6 insertions

[dm-devel] [PATCH v2 6/6] multipathd: use symbolic returns for ev_remove_path()

2021-05-13 Thread Benjamin Marzinski
There are many possible outcomes of calling ev_remove_path(), and not all callers agree on which outcomes are a success and which are a failure. So ev_remove_path() should simply return a different value for each outcome, and the callers can decide how to deal with them. Signed-off-by: Benjamin

Re: [dm-devel] [PATCH] multipathd: fix compilation issue with liburcu < 0.8

2021-05-13 Thread Benjamin Marzinski
On Wed, May 12, 2021 at 11:17:05PM +0200, mwi...@suse.com wrote: > From: Martin Wilck > > To avoid race conditions with pending RCU callbacks on exit, it's > necessary to call rcu_barrier() in cleanup_rcu() (see > https://lists.lttng.org/pipermail/lttng-dev/2021-May/029958.html and >

Re: [dm-devel] [PATCH 3/5] multipathd: make ev_remove_path return success on path removal

2021-05-12 Thread Benjamin Marzinski
On Wed, May 12, 2021 at 08:36:49PM +, Martin Wilck wrote: > On Wed, 2021-05-12 at 14:53 -0500, Benjamin Marzinski wrote: > > On Wed, May 12, 2021 at 11:38:08AM +, Martin Wilck wrote: > > > On Tue, 2021-05-11 at 18:22 -0500, Benjamin Marzinski wrote: > > So AFAICS,

Re: [dm-devel] [PATCH 4/5] multipath: free vectors in configure

2021-05-12 Thread Benjamin Marzinski
On Wed, May 12, 2021 at 12:36:42PM +, Martin Wilck wrote: > On Tue, 2021-05-11 at 18:22 -0500, Benjamin Marzinski wrote: > > configure() can retry multiple times, each time reallocing a maps and > > paths vector, and leaking the previous ones. Fix this by always > > fr

Re: [dm-devel] [PATCH 3/5] multipathd: make ev_remove_path return success on path removal

2021-05-12 Thread Benjamin Marzinski
On Wed, May 12, 2021 at 11:38:08AM +, Martin Wilck wrote: > On Tue, 2021-05-11 at 18:22 -0500, Benjamin Marzinski wrote: > > When ev_remove_path() returns success, callers assume that the path > > (and > > possibly the map) has been removed.  When ev_remove_path() returns

Re: [dm-devel] [PATCH 1/5] multipathd: don't fail to remove path once the map is removed

2021-05-12 Thread Benjamin Marzinski
On Wed, May 12, 2021 at 09:11:01AM +, Martin Wilck wrote: > On Tue, 2021-05-11 at 18:22 -0500, Benjamin Marzinski wrote: > > In ev_remove_path(), if update_mpp_paths() fails, we delete the > > entire > > map. However, since update_mpp_paths() happens before we call >

[dm-devel] [PATCH 3/5] multipathd: make ev_remove_path return success on path removal

2021-05-11 Thread Benjamin Marzinski
to dereference the path after it was removed. Change ev_remove_path() to return success whenever the path is removed, even if the map was removed due to a failure when trying to reload it. Found by coverity. Signed-off-by: Benjamin Marzinski --- multipathd/main.c | 6 -- 1 file changed, 4 insertions

[dm-devel] [PATCH 4/5] multipath: free vectors in configure

2021-05-11 Thread Benjamin Marzinski
configure() can retry multiple times, each time reallocing a maps and paths vector, and leaking the previous ones. Fix this by always freeing the vectors before configure() exits. Found by coverity. Signed-off-by: Benjamin Marzinski --- multipath/main.c | 7 ++- 1 file changed, 6 insertions

[dm-devel] [PATCH 5/5] kpartx: Don't leak memory when getblock returns NULL

2021-05-11 Thread Benjamin Marzinski
If a new block was allocated, but couldn't be filled, getblock will discard it. When it does so, it needs to free the block to avoid leaking memory. Found by coverity. Signed-off-by: Benjamin Marzinski --- kpartx/kpartx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kpartx/kpartx.c b

[dm-devel] [PATCH 2/5] multipathd: remove duplicate orphan_paths in flush_map

2021-05-11 Thread Benjamin Marzinski
remove_map_and_stop_waiter() already calls orphan_paths() so flush_map() doesn't need to call orphan_paths() before calling remove_map_and_stop_waiter(). Signed-off-by: Benjamin Marzinski --- multipathd/main.c | 1 - 1 file changed, 1 deletion(-) diff --git a/multipathd/main.c b/multipathd

[dm-devel] [PATCH 0/5] Memory issues found by coverity

2021-05-11 Thread Benjamin Marzinski
This is collection of issues found by coverity. The first three patches deal with ev_remove_path() removing the path, but returning failure, causing a use-after-free error. The last two patches fix memory leaks. Benjamin Marzinski (5): multipathd: don't fail to remove path once the map

[dm-devel] [PATCH 1/5] multipathd: don't fail to remove path once the map is removed

2021-05-11 Thread Benjamin Marzinski
map removed, there's nothing to keep us from removing the path. Call set_path_removed() before update_mpp_paths() to avoid the odd case of ev_remove_path() removing the map but not the path. Signed-off-by: Benjamin Marzinski --- libmultipath/structs_vec.c | 3 +-- multipathd/main.c |

Re: [dm-devel] RFC: one more time: SCSI device identification

2021-04-22 Thread Benjamin Marzinski
On Thu, Apr 22, 2021 at 09:07:15AM +, Martin Wilck wrote: > On Wed, 2021-04-21 at 22:46 -0400, Martin K. Petersen wrote: > > > > Martin, > > > > > Hm, it sounds intriguing, but it has issues in its own right. For > > > years to come, user space will have to probe whether these attribute > >

Re: [dm-devel] [PATCH] libmultipath: fix memory leak in checker_cleanup_thread

2021-04-09 Thread Benjamin Marzinski
/checkers.c > @@ -368,7 +368,7 @@ static void checker_cleanup_thread(void *arg) > { > struct checker_class *cls = arg; > > - (void)checker_class_unref(cls); > + (void)free_checker_class(cls); > rcu_unregister_thread(); > } > > -- Reviewed-by: Benjamin Marzinsk

Re: [dm-devel] [PATCH 3/7] github workflows: add containerized / multi-arch tests

2021-03-30 Thread Benjamin Marzinski
On Tue, Mar 30, 2021 at 11:00:56AM +0200, Martin Wilck wrote: > On Mon, 2021-03-29 at 22:23 -0500, Benjamin Marzinski wrote: > > On Fri, Mar 26, 2021 at 10:29:40PM +0100, mwi...@suse.com wrote: > > > > > > Tell me if you want this in the multipath-tools r

Re: [dm-devel] [PATCH 4/7] libdmmp: allow building without perl

2021-03-30 Thread Benjamin Marzinski
On Tue, Mar 30, 2021 at 10:00:02AM +0200, Martin Wilck wrote: > On Mon, 2021-03-29 at 23:25 -0500, Benjamin Marzinski wrote: > > On Fri, Mar 26, 2021 at 10:29:41PM +0100, mwi...@suse.com wrote: > > > From: Martin Wilck > > > > > > Add the kernel-doc

Re: [dm-devel] [PATCH] multipathd: give up "add missing path" after multiple failures

2021-03-30 Thread Benjamin Marzinski
on ESXi) > will cause a "add missing path" message in every checker iteration. > > Fixes: b7aae60 ("multipathd: improve "add missing path" handling") > Signed-off-by: Martin Wilck Reviewed-by: Benjamin Marzinski > --- > libmultipath/discovery.c | 1

Re: [dm-devel] [PATCH] multipathd: reduce log levels in cli_add_map()

2021-03-30 Thread Benjamin Marzinski
On Mon, Mar 29, 2021 at 12:12:55PM +0200, mwi...@suse.com wrote: > From: Martin Wilck > > Normally "add map" will be used to add a map which doesn't exist > yet. Thus not finding this map in the first place is not a problem > indicator and should be logged at level 3 only. > Reviewed-by:

Re: [dm-devel] [PATCH 0/7] multipath-tools: extended github CI

2021-03-29 Thread Benjamin Marzinski
On Fri, Mar 26, 2021 at 10:29:37PM +0100, mwi...@suse.com wrote: > From: Martin Wilck > > Hi Christophe, hi Ben, For the set Reviewed-by: Benjamin Marzinski > I've spent most of this week trying to improve the multipath-tools > CI workflows on github. I now have CI workflows

Re: [dm-devel] [PATCH 4/7] libdmmp: allow building without perl

2021-03-29 Thread Benjamin Marzinski
On Fri, Mar 26, 2021 at 10:29:41PM +0100, mwi...@suse.com wrote: > From: Martin Wilck > > Add the kernel-doc generated manpages of libdmmp to git, and > change the libdmmp Makefile to regenerate them (only) when > necessary. > > This allows us to drop perl as a build-time requirement. Git

Re: [dm-devel] [PATCH 3/7] github workflows: add containerized / multi-arch tests

2021-03-29 Thread Benjamin Marzinski
On Fri, Mar 26, 2021 at 10:29:40PM +0100, mwi...@suse.com wrote: > From: Martin Wilck > > Until now, our CI only tested builds on Ubuntu, the default github > runner. This commit adds containerized build/test workflows, which can cover a > much larger range of distributions and environments. >

Re: [dm-devel] [PATCH 2/4] libmultipath: fix priorities in parse_vpd_pg83

2021-03-29 Thread Benjamin Marzinski
On Mon, Mar 29, 2021 at 07:08:14PM +, Martin Wilck wrote: > On Mon, 2021-03-29 at 13:20 -0500, Benjamin Marzinski wrote: > > > > > > multipathd could figure out the system configuration from the (non) > > > availability of certain properties, and use an ap

Re: [dm-devel] [PATCH 2/4] libmultipath: fix priorities in parse_vpd_pg83

2021-03-29 Thread Benjamin Marzinski
On Mon, Mar 29, 2021 at 08:44:46AM +, Martin Wilck wrote: > On Fri, 2021-03-26 at 21:18 -0500, Benjamin Marzinski wrote: > > On Fri, Mar 26, 2021 at 05:12:36PM +, Martin Wilck wrote: > > > On Thu, 2021-03-25 at 19:52 -0500, Benjamin Marzinski wrote: > > > >

Re: [dm-devel] [PATCH 2/4] libmultipath: fix priorities in parse_vpd_pg83

2021-03-26 Thread Benjamin Marzinski
On Fri, Mar 26, 2021 at 05:12:36PM +, Martin Wilck wrote: > On Thu, 2021-03-25 at 19:52 -0500, Benjamin Marzinski wrote: > > The priorities for the EUI-64 (0x02) and NAME (0x08) scsi identifiers > > in > > parse_vpd_pg83() don't match their priorities in 55-scsi-sg3_id.r

[dm-devel] [PATCH 4/4] multipathd: don't trigger uevent for partitions on wwid change

2021-03-25 Thread Benjamin Marzinski
If the wwid changed, the device is no longer the same, so sending add events to the devices partitions doesn't make any sense. Signed-off-by: Benjamin Marzinski --- multipathd/main.c | 1 - 1 file changed, 1 deletion(-) diff --git a/multipathd/main.c b/multipathd/main.c index bc747d0e

[dm-devel] [PATCH 1/4] libmultipath: avoid infinite loop with bad vpd page 83 identifier

2021-03-25 Thread Benjamin Marzinski
If a device with a scsi name identifier has an unknown prefix, parse_vpd_pg83() needs to advance to the next identifier, instead of simply trying the same one again in an infinite loop. Signed-off-by: Benjamin Marzinski --- libmultipath/discovery.c | 2 +- 1 file changed, 1 insertion(+), 1

[dm-devel] [PATCH 0/4] Fixups to my wwid recheck patch

2021-03-25 Thread Benjamin Marzinski
This patchset has minor fixups that were either suggested by Martin, or came up through the disussions about my "Handle remapped LUNs better" patchset. Benjamin Marzinski (4): libmultipath: avoid infinite loop with bad vpd page 83 identifier libmultipath: fix priorities in pars

[dm-devel] [PATCH 3/4] multipathd: improve getting parent udevice in rescan_path

2021-03-25 Thread Benjamin Marzinski
Instead of looping through parents and checking, just call udev_device_get_parent_with_subsystem_devtype() to get the right one. Signed-off-by: Benjamin Marzinski --- multipathd/main.c | 14 +- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/multipathd/main.c b

[dm-devel] [PATCH 2/4] libmultipath: fix priorities in parse_vpd_pg83

2021-03-25 Thread Benjamin Marzinski
The priorities for the EUI-64 (0x02) and NAME (0x08) scsi identifiers in parse_vpd_pg83() don't match their priorities in 55-scsi-sg3_id.rules. Switch them so that they match. Signed-off-by: Benjamin Marzinski --- libmultipath/discovery.c | 16 1 file changed, 8 insertions

Re: [dm-devel] [PATCH] Revert "multipath -U: reduce log level of "adding new path" message"

2021-03-22 Thread Benjamin Marzinski
valid path had been found in a map that wasn't present > in the udev db. > Reviewed-by: Benjamin Marzinski And I'm fine with you rebasing the queue branch. > Signed-off-by: Martin Wilck > --- > If this is approved, unless anyone objects, I'll simply drop the patch > that th

Re: [dm-devel] [PATCH v2 3/3] multipath-tools tests: check if /sys/dev/block is non-empty

2021-03-18 Thread Benjamin Marzinski
recent releases of podman (3.0.1), > this check is insufficient, because /sys/dev/block exists now in > containers, albeit empty. So we need to check for actual entries > in the directory. > > Fixes: f131e31 ("multipath-tools: devt test: avoid failure when run in > containers

Re: [dm-devel] [PATCH v2 1/3] libmultipath: merge update_multipath_table() and update_multipath_status()

2021-03-18 Thread Benjamin Marzinski
code for all callers. > > As we remove a symbol, the major library version must be bumped. > Reviewed-by: Benjamin Marzinski > Signed-off-by: Martin Wilck > --- > Changes v1 -> v2: > - log errors at -v2 in update_multipath_table() (Ben) > - return error in updat

Re: [dm-devel] [PATCH 2/2] 11-dm-mpath.rules: run "multipath -U" with -v1

2021-03-17 Thread Benjamin Marzinski
d be wrong, > because they are important for multipathd's operation, to verify that > multipathd does the right thing when discovering a discrepancy between the dm > state and the devices present in the system. Therefore, just decrease the > verbosity with which we invoke "mul

Re: [dm-devel] [PATCH 1/2] libmultipath: merge update_multipath_table() and update_multipath_status()

2021-03-17 Thread Benjamin Marzinski
On Wed, Mar 17, 2021 at 06:27:26PM +0100, mwi...@suse.com wrote: > From: Martin Wilck > > Since 378cb66 ("multipath: use update_pathvec_from_dm()"), > we remove paths and even pathgroups from multipathd's data structures > in update_multipath_table() if these paths are found to be non-existent.

Re: [dm-devel] [PATCH v2 3/3] multipathd: add recheck_wwid option to verify the path wwid

2021-03-11 Thread Benjamin Marzinski
On Thu, Mar 11, 2021 at 08:30:51PM +, Martin Wilck wrote: > On Wed, 2021-02-24 at 00:33 -0600, Benjamin Marzinski wrote: > > There are cases where the wwid of a path changes due to LUN remapping > > without triggering uevent for the changed path. Multipathd has no > >

[dm-devel] [PATCH 2/2] tests: add tests for checking if alias is in use

2021-03-10 Thread Benjamin Marzinski
Signed-off-by: Benjamin Marzinski --- tests/alias.c | 409 +- 1 file changed, 405 insertions(+), 4 deletions(-) diff --git a/tests/alias.c b/tests/alias.c index 344aba73..ebe1209e 100644 --- a/tests/alias.c +++ b/tests/alias.c @@ -62,6 +62,25

[dm-devel] [PATCH 1/2] libmultipath: check if user_friendly_name is in use

2021-03-10 Thread Benjamin Marzinski
one that it not currently in use by a dm device. Signed-off-by: Benjamin Marzinski --- libmultipath/alias.c | 48 +--- tests/alias.c| 22 ++-- 2 files changed, 56 insertions(+), 14 deletions(-) diff --git a/libmultipath/alias.c b

[dm-devel] [PATCH 0/2] libmutipath: only give out free user_friendly_names

2021-03-10 Thread Benjamin Marzinski
not in use. I've updated the lookup_binding() tests to test this functionality as well. Benjamin Marzinski (2): libmultipath: check if user_friendly_name is in use tests: add tests for checking if alias is in use libmultipath/alias.c | 48 - tests/alias.c| 427

Re: [dm-devel] [PATCH] multipath -U: reduce log level of "adding new path" message

2021-03-10 Thread Benjamin Marzinski
I > worked on that code, I really didn't want to miss any of these messages. Reviewed-by: Benjamin Marzinski > --- > libmultipath/structs_vec.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libmultipath/structs_vec.c b/libmultipath/structs

Re: [dm-devel] [PATCH 2/2] multipathd: add recheck_wwid_time option to verify the path wwid

2021-02-26 Thread Benjamin Marzinski
On Tue, Feb 09, 2021 at 10:19:45PM +, Martin Wilck wrote: > On Mon, 2021-02-08 at 23:19 -0600, Benjamin Marzinski wrote: > > If > > multipathd notices that a path's wwid has changed it will remove and > > re-add the path, just like the existing wwid checking code for c

[dm-devel] [PATCH v2 1/3] libmultipath: cleanup code to strip wwid trailing spaces

2021-02-23 Thread Benjamin Marzinski
Signed-off-by: Benjamin Marzinski --- libmultipath/discovery.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index 9be94cd1..3a06f319 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c

[dm-devel] [PATCH v2 3/3] multipathd: add recheck_wwid option to verify the path wwid

2021-02-23 Thread Benjamin Marzinski
configured to be able to use the uid_fallback methods. To make sure both the sysfs and udev database values are updated, multipathd triggers a both a rescan of the device and a udev add event. Co-developed-by: Chongyun Wu Signed-off-by: Benjamin Marzinski --- libmultipath/config.c

[dm-devel] [PATCH v2 0/3] Handle remapped LUNs better

2021-02-23 Thread Benjamin Marzinski
at the add uevents for the new LUN that was mapped to the old LUN id, instead of seeing add event when the old LUN was remapped to a new LUN id. This means that the uev_add_path() code is unnecessary, as Martin suspected. It's been removed. Benjamin Marzinski

[dm-devel] [PATCH v2 2/3] libmultipath: cleanup uid_attribute checking code

2021-02-23 Thread Benjamin Marzinski
checks if pp->uid_attribute is NULL, just check once for the code block. Signed-off-by: Benjamin Marzinski --- libmultipath/discovery.c | 17 - 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index 3a06f319..

[dm-devel] [PATCH] kpartx: free loop device after listing partitions

2021-02-23 Thread Benjamin Marzinski
. Also, keep kpartx from printing that the loop device has been removed at normal verbosity. Fixes: da59d15c6 ("Fix loopback file with kpartx -av") Signed-off-by: Benjamin Marzinski --- kpartx/kpartx.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/kpartx/kp

Re: [dm-devel] [PATCH 1/4] multipath-tools tests: allow control of test verbosity

2021-02-15 Thread Benjamin Marzinski
or have > other special needs. > > Also, get rid of the now obsolete global variables logsink and > udev, as these are now defined in libmultipath. > Reviewed-by: Benjamin Marzinski For the set. > Signed-off-by: Martin Wilck > --- > tests/README.md | 5 + > test

Re: [dm-devel] [PATCH 2/2] multipathd: add recheck_wwid_time option to verify the path wwid

2021-02-10 Thread Benjamin Marzinski
On Tue, Feb 09, 2021 at 10:19:45PM +, Martin Wilck wrote: > On Mon, 2021-02-08 at 23:19 -0600, Benjamin Marzinski wrote: > > There are cases where the wwid of a path changes due to LUN remapping > > without triggering uevent for the changed path. Multipathd has no > >

Re: [dm-devel] [PATCH] multipath-tools tests: fix stringop-overflow build errors with gcc 11

2021-02-10 Thread Benjamin Marzinski
734 | extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) > __THROWNL; > |^~~ > > The reason seems to be a mismatch between the __sigsetjmp() prototype > in and . Until this is fixed in the toolchain, > work around it by inclu

[dm-devel] [PATCH 2/2] multipathd: add recheck_wwid_time option to verify the path wwid

2021-02-08 Thread Benjamin Marzinski
ll disable this option for that device. If recheck_wwid_time is not turned off, multipathd will also automatically recheck the wwid whenever an existing path gets a add event, or is manually re-added with cli_add_path(). Co-developed-by: Chongyun Wu Signed-off-by: Benjamin Marzinski --- libmultipat

[dm-devel] [PATCH 1/2] libmultipath: fix use-after-free in uev_add_path

2021-02-08 Thread Benjamin Marzinski
, uev_add_path() should only continue to access the path if ev_remove_path() didn't succeed. Signed-off-by: Benjamin Marzinski --- multipathd/main.c | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index 425492a9..19679848 100644

[dm-devel] [PATCH 0/2] Handle remapped LUNs better

2021-02-08 Thread Benjamin Marzinski
the existing LUN numbers, all the old paths should have their wwids checked as soon as possible (immediately, if the path is up), since mismatching LUN numbers is a red flag that something has gone wrong. Benjamin Marzinski (2): libmultipath: fix use-after-free in uev_add_path multipathd: add

Re: [dm-devel] [PATCH] multipathd: LUN protection by checking path's wwid change status

2021-02-08 Thread Benjamin Marzinski
I've actually managed to reproduce this issue with the latest code. All it takes is two machines in the same FC zone, with one of them having a FC driver that supports target mode and LIO. To do it: You can grab TGT_WWPN and INIT_WWPN from /sys/class/fc_host/host/port_name On the target machine

Re: [dm-devel] [PATCH 3/3] libmultipath: check return value of udev_device_get_devnum()

2021-02-03 Thread Benjamin Marzinski
On Tue, Feb 02, 2021 at 10:41:31PM +0100, mwi...@suse.com wrote: > From: Martin Wilck > > udev_device_get_devnum() may fail, in which case it returns > makedev(0, 0). > Reviewed-by: Benjamin Marzinski > Signed-off-by: Martin Wilck > --- > libmultipath/discovery.c | 3

Re: [dm-devel] [PATCH 2/3] multipathd: ev_add_path: fail if add_map_with_path() fails

2021-02-03 Thread Benjamin Marzinski
gt; Signed-off-by: Martin Wilck This patch looks fine, but I don't think that there was any risk before. I don't see how you could loop back to rescan with mpp == NULL, which is what would need to happen before you could ever run this code. At any rate Reviewed-by: Benjamin Marzinski > --- > multi

Re: [dm-devel] [PATCH 0/3] consistent behavior of filter_property()

2021-02-03 Thread Benjamin Marzinski
break such use cases, we need to make the > filter_property() test in pathinfo() dependent on DI_BLACKLIST. That > would make a lot of sense, but it'd cause a semantic change. > > Comments welcome. Reviewed-by: Benjamin Marzinski For the set. > > Regards > Martin > >

Re: [dm-devel] [PATCH] multipathd: avoid crash in uevent_cleanup()

2021-02-02 Thread Benjamin Marzinski
; > Signed-off-by: Martin Wilck Assuming that this does resolve the issue, Reviewed-by: Benjamin Marzinski > --- > libmultipath/uevent.c | 7 --- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/libmultipath/uevent.c b/libmultipath/uevent.c > ind

Re: [dm-devel] [PATCH] libmultipath: check if adopt_path() really added current path

2021-02-02 Thread Benjamin Marzinski
o be checked, membership of the > path to be added in mpp->paths. > > Fixes: 2d32d6f ("libmultipath: adopt_paths(): don't bail out on single path > failure") > Signed-off-by: Martin Wilck Reviewed-by: Benjamin Marzinski > --- > > @lixiaokeng, I believe tha

Re: [dm-devel] [PATCH v2 1/3] libmultipath: use 3rd digit as transport_id for expanders

2021-02-02 Thread Benjamin Marzinski
13/expander-9:1/port-9:1:12/expander-9:2/port-9:2:4/end_device-9:2:4/target9:0:29/9:0:29:0/block/sdac > > In that case, we should use the last digit as transport id. > > Signed-off-by: Martin Wilck Reviewed-by: Benjamin Marzinski > --- > libmultipath/discovery.c | 13 ++

Re: [dm-devel] libmultipath: fix NULL dereference in get_be64

2021-02-01 Thread Benjamin Marzinski
On Mon, Feb 01, 2021 at 11:26:36PM -0600, Benjamin Marzinski wrote: > On Mon, Feb 01, 2021 at 04:12:34PM +0100, Martin Wilck wrote: > > On Mon, 2021-02-01 at 22:50 +0800, lixiaokeng wrote: > > > > > > > > > > > > > cli_add_path > > >

Re: [dm-devel] libmultipath: fix NULL dereference in get_be64

2021-02-01 Thread Benjamin Marzinski
On Mon, Feb 01, 2021 at 04:12:34PM +0100, Martin Wilck wrote: > On Mon, 2021-02-01 at 22:50 +0800, lixiaokeng wrote: > > > > > > > > > > cli_add_path > > > >    ->ev_add_path > > > >   ->add_map_with_path > > > > ->adopt_paths > > > >     ->pathinfo > > > >   

Re: [dm-devel] [PATCH 3/3] multipathd: add code to initalize unwinder

2021-02-01 Thread Benjamin Marzinski
necessary symbols resolved early on. > > This implementation simply creates a dummy thread and cancels > it. This way all necessary symbols for thread cancellation > will be loaded, no matter what the C library needs to implement > cancellation. > Reviewed-by: Benjamin Marzinski > Sig

Re: [dm-devel] [PATCH 2/3] libmultipath: sysfs_set_nexus_loss_tmo(): support SAS expanders

2021-02-01 Thread Benjamin Marzinski
artin Wilck Reviewed-by: Benjamin Marzinski > --- > libmultipath/discovery.c | 24 +++- > 1 file changed, 19 insertions(+), 5 deletions(-) > > diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c > index f3ce3f8..7878454 100644 > --- a/lib

Re: [dm-devel] [PATCH 0/3] multipath: fixes for SAS expanders and root FS access

2021-02-01 Thread Benjamin Marzinski
On Thu, Jan 28, 2021 at 09:45:41PM +0100, mwi...@suse.com wrote: > From: Martin Wilck > > Hi Christophe, hi Ben, > > here are 3 patches I'd like to get reviewed before we create a pull > request. The first two are related to complex SAS setups, the second > one is to avoid accessing the root

Re: [dm-devel] [PATCH 1/3] libmultipath: use 3rd digit as transport_id for expanders

2021-02-01 Thread Benjamin Marzinski
On Thu, Jan 28, 2021 at 09:45:42PM +0100, mwi...@suse.com wrote: > From: Martin Wilck > > On SAS expanders, node id's have 3 digits. sysfs paths look like this: > >

Re: [dm-devel] [PATCH 5/6] multipathd: Fix multipathd stopping on shutdown

2021-01-26 Thread Benjamin Marzinski
On Fri, Dec 18, 2020 at 11:31:25PM +, Martin Wilck wrote: > On Fri, 2020-12-18 at 17:06 -0600, Benjamin Marzinski wrote: > > According to man "systemd.special" > > > > "shutdown.target: ... Services that shall be terminated on system > > shutdown sha

Re: [dm-devel] [PATCH] libmpathpersist: fix thread safety of default functions

2021-01-26 Thread Benjamin Marzinski
On Tue, Jan 26, 2021 at 10:04:28AM +, Martin Wilck wrote: > On Mon, 2021-01-25 at 23:31 -0600, Benjamin Marzinski wrote: > > commit a839e39e ("libmpathpersist: factor out initialization and > > teardown") made mpath_presistent_reserve_{in,out} use share variables

Re: [dm-devel] [PATCH] libmpathpersist: fix thread safety of default functions

2021-01-26 Thread Benjamin Marzinski
On Tue, Jan 26, 2021 at 09:36:59AM +, Martin Wilck wrote: > On Mon, 2021-01-25 at 23:31 -0600, Benjamin Marzinski wrote: > > commit a839e39e ("libmpathpersist: factor out initialization and > > teardown") made mpath_presistent_reserve_{in,out} use share variables

[dm-devel] [PATCH] libmpathpersist: fix thread safety of default functions

2021-01-25 Thread Benjamin Marzinski
atch makes mpath_presistent_reserve_{in,out} go back to using local variables for curmp and pathvec, so that multiple threads won't be operating on these variables at the same time. Fixes: a839e39e ("libmpathpersist: factor out initialization and teardown") Signed-off-by: Benjamin Marzinski --- libmpathper

Re: [dm-devel] [PATCH] libmultipath: snprint_devices(): avoid NULL dereference

2021-01-25 Thread Benjamin Marzinski
On Mon, Jan 25, 2021 at 04:23:04PM +0100, mwi...@suse.com wrote: > From: Martin Wilck > > All libudev functions may return NULL. Watch out for it. > > Fixes: d041258 ("libmultipath: snprint_devices(): use udev_enumerate" > Signed-off-by: Martin Wilck Rev

[dm-devel] [PATCH v3 1/1] multipathd: cleanup logging for marginal paths

2021-01-18 Thread Benjamin Marzinski
if they already have a valid state, this caused multipathd to log a message whenever the path state switched to from delayed to pending and then back. Signed-off-by: Benjamin Marzinski --- libmultipath/io_err_stat.c | 7 +++ multipathd/main.c | 25 ++--- 2 files

[dm-devel] [PATCH v3 0/1] Multipath io_err_stat fixes

2021-01-18 Thread Benjamin Marzinski
pointer, since it should always equal _pathvec. 0004-0006 are new patches to deal with io_err_stat issues from Martin's review Benjamin Marzinski (1): multipathd: cleanup logging for marginal paths libmultipath/io_err_stat.c | 7 +++ multipathd/main.c | 25

Re: [dm-devel] [PATCH v2 6/6] multipathd: cleanup logging for marginal paths

2021-01-18 Thread Benjamin Marzinski
On Fri, Jan 15, 2021 at 01:55:09PM +, Martin Wilck wrote: > On Thu, 2021-01-14 at 20:20 -0600, Benjamin Marzinski wrote: > > io_err_stat logged at level 2 whenever it enqueued a path to check, > > which could happen multiple times while a path was marginal.  On the

[dm-devel] [PATCH v2 2/6] multipathd: avoid io_err_stat crash during shutdown

2021-01-14 Thread Benjamin Marzinski
it was set. Signed-off-by: Benjamin Marzinski --- libmultipath/io_err_stat.c | 111 ++--- 1 file changed, 43 insertions(+), 68 deletions(-) diff --git a/libmultipath/io_err_stat.c b/libmultipath/io_err_stat.c index 2e48ee81..feb66469 100644 --- a/libmultipath

[dm-devel] [PATCH v2 4/6] multipathd: use get_monotonic_time() in io_err_stat code

2021-01-14 Thread Benjamin Marzinski
Instead of calling clock_gettime(), and dealing with failure conditions, just call get_monotonic_time(). Signed-off-by: Benjamin Marzinski --- libmultipath/io_err_stat.c | 34 +++--- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/libmultipath

[dm-devel] [PATCH v2 6/6] multipathd: cleanup logging for marginal paths

2021-01-14 Thread Benjamin Marzinski
unexpected happens, but multipathd will always log when a path switches its marginal state. Signed-off-by: Benjamin Marzinski --- libmultipath/io_err_stat.c | 7 +++ multipathd/main.c | 25 ++--- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git

[dm-devel] [PATCH v2 3/6] multipathd: avoid io_err_stat ABBA deadlock

2021-01-14 Thread Benjamin Marzinski
being deleted from io_err_pathvec, without the index being decremented, causing the loop to skip elements. Also, service_paths() could be cancelled while holding the io_err_pathvec_lock, so it should have a cleanup handler. Signed-off-by: Benjamin Marzinski --- libmultipath/io_err_stat.

[dm-devel] [PATCH v2 5/6] multipathd: combine free_io_err_stat_path and destroy_directio_ctx

2021-01-14 Thread Benjamin Marzinski
destroy_directio_ctx() is only called from free_io_err_stat_path(), and free_io_err_stat_path() is very short, so combine them. Signed-off-by: Benjamin Marzinski --- libmultipath/io_err_stat.c | 24 ++-- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git

[dm-devel] [PATCH v2 1/6] libmultipath: make find_err_path_by_dev() static

2021-01-14 Thread Benjamin Marzinski
Signed-off-by: Benjamin Marzinski --- libmultipath/io_err_stat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmultipath/io_err_stat.c b/libmultipath/io_err_stat.c index 5363049d..2e48ee81 100644 --- a/libmultipath/io_err_stat.c +++ b/libmultipath/io_err_stat.c @@ -88,7

[dm-devel] [PATCH v2 0/6] Multipath io_err_stat fixes

2021-01-14 Thread Benjamin Marzinski
pthread_testcancel and use cleanup_mutex instead of cleanup_unlock as suggested by Martin. Also, make tmp_pathvec a constant pointer, since it should always equal _pathvec. 0004-0006 are new patches to deal with io_err_stat issues from Martin's review Benjamin Marzinski (6): libmultipath: make

<    2   3   4   5   6   7   8   9   10   11   >