[PATCH v4 07/22] libmultipath: change path_offline to path_sysfs_state

2024-10-08 Thread Benjamin Marzinski
Instead of pp->offline being a binary value, change it to show the actual result of looking at the sysfs state, and rename it to pp->sysfs_state. Also change the function name from path_offline() to path_sysfs_state(). Adapt the tests for pp->offline. This should not change how multipath currently

[PATCH v4 10/22] multipathd: split check_path into two functions

2024-10-08 Thread Benjamin Marzinski
Split out the code that updates a path's state and sets up the next check time into its own function, update_path(). Signed-off-by: Benjamin Marzinski --- multipathd/main.c | 42 ++ 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/multipathd

[PATCH v4 22/22] multipath-tools tests: fix up directio tests

2024-10-08 Thread Benjamin Marzinski
Make the directio tests work with no waiting in the libcheck_pending() and the new libcheck_need_wait() call. Reviewed-by: Martin Wilck Signed-off-by: Benjamin Marzinski --- tests/directio.c | 49 +--- 1 file changed, 46 insertions(+), 3 deletions(-)

[PATCH v4 19/22] libmultipath: add libcheck_need_wait checker function

2024-10-08 Thread Benjamin Marzinski
Add a new optional checker class function, libcheck_need_wait() and a new function to call it, checker_need_wait(). This can be used to see if a path_checker is currently running. This will be used to determine if there are pending checkers that need to be waited for. Signed-off-by: Benjamin Marzi

[PATCH v4 13/22] multipathd: fix "fail path" and "reinstate path" commands

2024-10-08 Thread Benjamin Marzinski
Now that multipathd can drop the vecs lock and sleep in-between when the checker runs and when the path gets updated, it is possible for the user to either fail or reinstate the path in this window. If a path gets manually failed in the window between when the checker starts and the path is update

[PATCH v4 04/22] libmultipath: remove pending wait code from libcheck_check calls

2024-10-08 Thread Benjamin Marzinski
When the tur and directio checkers start an asynchronous checker, they now immediately return with the path in PATH_PENDING, instead of waiting in checker_check(). Instead the wait now happens in checker_get_state(). Additionally, the directio checker now waits for 1 ms, like the tur checker does.

[PATCH v4 17/22] multipathd: remove pointless check

2024-10-08 Thread Benjamin Marzinski
Since we just returned if newstate wasn't PATH_UP or PATH_GHOST, it must obviously be PATH_UP or PATH_GHOST at this point in the code. We don't even wrap all the code for dealing with a path that just came up in this if-block, It's only the persistent resrvation code. Reviewed-by: Martin Wilck Si

[PATCH v4 20/22] libmultipath: don't wait in libcheck_pending

2024-10-08 Thread Benjamin Marzinski
Disable waiting in the libcheck_pending() checker class functions. Instead, they now just check if the checker has already completed. A future patch will re-add waiting outside of libcheck_pending(). Reviewed-by: Martin Wilck Signed-off-by: Benjamin Marzinski --- libmultipath/checkers/directio.

[PATCH v4 18/22] multipathd: fix deferred_failback_tick for reload removes

2024-10-08 Thread Benjamin Marzinski
If reload_and_sync_map() removes the multipath device, deferred_failback_tick() needs to decrement the counter so that it doesn't skip the following device. Reviewed-by: Martin Wilck Signed-off-by: Benjamin Marzinski --- multipathd/main.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deleti

[PATCH v4 15/22] multipathd: simplify checking for followover_should_failback

2024-10-08 Thread Benjamin Marzinski
The code needs to check that pp->pgindex equals pp->mpp->bestpg and that they aren't both 0 (which is an invalid pathgroup id). Since we're already checking that they are equal, we only need to check one of them to see if it's non-zero. Instead of checking if pp->pgindex is non-zero for every path,

[PATCH v4 21/22] multipathd: wait for checkers to complete

2024-10-08 Thread Benjamin Marzinski
Multipath again waits for running checkers to complete. In pathinfo(), mutipath will just wait 1ms if the checker is running. In checkerloop(), if there are running checkers, multipathd will drop the vecs lock and wait for 5ms. The difference it wait times is because multipathd cannot drop the vecs

[PATCH v4 01/22] libmultipath: store checker_check() result in checker struct

2024-10-08 Thread Benjamin Marzinski
checker_check() is now a void function that stores the path state in the checker struct. It can be retrieved later using checker_get_state(). Right now, this is called immediately after checker_check(), but in the future, it can be deferred to another time. Reviewed-by: Martin Wilck Signed-off-by

[PATCH v4 05/22] multipath-tools tests: fix up directio tests

2024-10-08 Thread Benjamin Marzinski
Make the directio tests work with libcheck_pending() being separate from libcheck_check Reviewed-by: Martin Wilck Signed-off-by: Benjamin Marzinski --- tests/directio.c | 133 +-- 1 file changed, 82 insertions(+), 51 deletions(-) diff --git a/tests/d

[PATCH v4 14/22] multipathd: update priority once after updating all paths

2024-10-08 Thread Benjamin Marzinski
Instead of updating the path priorities and possibly reloading the multipath device when each path is updated, wait till all paths have been updated, and then go through the multipath devices updating the priorities once, reloading if necessary. Signed-off-by: Benjamin Marzinski --- libmultipath

[PATCH v4 08/22] multipathd: split check_path_state into two functions

2024-10-08 Thread Benjamin Marzinski
check_path_state() is now split into start_path_check(), which calls path_sysfs_state() and if the path is up also calls start_checker(), and get_new_state() which gets the new state from either pp->sysfs_state or get_state(). Reviewed-by: Martin Wilck Signed-off-by: Benjamin Marzinski --- mult

[PATCH v4 09/22] multipathd: rename do_check_path to update_path_state

2024-10-08 Thread Benjamin Marzinski
Move the code that starts the path checker from do_check_path() into check_path(), rename the remainder of do_check_path() to update_path_state() and call that from check_path(). Signed-off-by: Benjamin Marzinski --- multipathd/main.c | 21 +++-- 1 file changed, 11 insertions(+),

[PATCH v4 06/22] libmultipath: split get_state into two functions

2024-10-08 Thread Benjamin Marzinski
get_state() is now split into start_checker(), which runs the checker but doesn't wait for async checkers, and get_state(), which returns the state from the checker, after waiting for async checkers if necessary. Reviewed-by: Martin Wilck Signed-off-by: Benjamin Marzinski --- libmultipath/disco

[PATCH v4 16/22] multipathd: only refresh prios on PATH_UP and PATH_GHOST

2024-10-08 Thread Benjamin Marzinski
The way that multipathd was handling priority refreshes had some issues. Some of the multipath prioritizers can hang when run on a failed path. Multipathd was only skipping paths in PATH_DOWN, but there are other states where the prioritizer is also likely to hang, such as PATH_TIMEOUT, PATH_SHAKY,

[PATCH v4 02/22] libmultipath: add missing checker function prototypes

2024-10-08 Thread Benjamin Marzinski
Reviewed-by: Martin Wilck Signed-off-by: Benjamin Marzinski --- libmultipath/checkers.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libmultipath/checkers.h b/libmultipath/checkers.h index 6e54d8f0..fb1160af 100644 --- a/libmultipath/checkers.h +++ b/libmultipath/checkers.h @@ -188,6 +

[PATCH v4 00/22] path checker refactor and misc fixes

2024-10-08 Thread Benjamin Marzinski
Tis patchset is based on discussions I had with Martin Wilck about my last, partially applied patchset. The first two patches are reposts of patches from my earlier patchset, redone to work with the new libmp_mapinfo() API. They make it possible to add maps by WWID with "multipathd add map". The

[PATCH v4 12/22] multipathd: split check_paths into two functions

2024-10-08 Thread Benjamin Marzinski
Instead of checking and updating each path, the checkerloop now starts the checkers on all the paths in check_paths(), and then goes back and updates all the paths in update_paths(). Since the async checkers use an absolute time to wait for before returning PATH_PENDING, only one checker actually n

[PATCH v4 03/22] libmultipath: split out the code to wait for pending checkers

2024-10-08 Thread Benjamin Marzinski
This patch adds a new optional symbol for the dynamic path checker libraries, libcheck_pending. This is currently unused, but can be called on pending checkers to check if they've completed and return their value. The "tur" and "directio" checkers are the only ones which can return PATH_PENDING. Th

[PATCH v4 11/22] multipathd: split handle_uninitialized_path into two functions

2024-10-08 Thread Benjamin Marzinski
Split handle_uninitialized_path() into check_uninitialized_path, which handles udev retriggers for INIT_MISSING_UDEV paths and starts the path checker for INIT_FAILED and INIT_NEW paths, and update_uninitialized_path() which gets the path checker result and reruns pathinfo if the path is up. Signe

[PATCH] multipath-tools: update comments in hwtable

2024-10-08 Thread Xose Vazquez Perez
Update description of Alletra NVMe. Cc: Martin Wilck Cc: Benjamin Marzinski Cc: Christophe Varoqui Cc: DM-DEVEL ML Signed-off-by: Xose Vazquez Perez --- libmultipath/hwtable.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libmultipath/hwtable.c b/libmultipath/hwtable.

Re: [PATCH v2 19/22] libmultipath: add libcheck_need_wait checker function

2024-10-08 Thread Benjamin Marzinski
On Thu, Oct 03, 2024 at 11:15:21PM +0200, Martin Wilck wrote: > On Thu, 2024-09-12 at 17:49 -0400, Benjamin Marzinski wrote: > > Add a new optional checker class function, libcheck_need_wait() and a > > new function to call it, checker_need_wait(). This can be used to see > > if > > a path_checker

Re: [PATCH v2 14/22] multipathd: update priority once after updating all paths

2024-10-08 Thread Benjamin Marzinski
On Thu, Oct 03, 2024 at 11:00:20PM +0200, Martin Wilck wrote: > On Thu, 2024-09-12 at 17:49 -0400, Benjamin Marzinski wrote: > > Instead of updating the path priorities and possibly reloading the > > multipath device when each path is updated, wait till all paths > > have been updated, and then go

Re: [PATCH v2 12/22] multipathd: split check_paths into two functions

2024-10-08 Thread Benjamin Marzinski
On Thu, Oct 03, 2024 at 10:41:20PM +0200, Martin Wilck wrote: > On Thu, 2024-09-12 at 17:49 -0400, Benjamin Marzinski wrote: > > Instead of checking and updating each path, the checkerloop now > > starts > > the checkers on all the paths in check_paths(), and then goes back > > and > > updates all

Re: [PATCH v2 10/22] multipathd: split check_path into two functions

2024-10-08 Thread Benjamin Marzinski
On Thu, Oct 03, 2024 at 10:23:57PM +0200, Martin Wilck wrote: > On Thu, 2024-09-12 at 17:49 -0400, Benjamin Marzinski wrote: > > Split out the code that updates a path's state and sets up the next > > check time into its own function, update_path(). > > > > Signed-off-by: Benjamin Marzinski > > -

Re: [PATCH v2 09/22] multipathd: split do_checker_path

2024-10-08 Thread Benjamin Marzinski
On Thu, Oct 03, 2024 at 10:23:51PM +0200, Martin Wilck wrote: > Nit: the subject should refer to "do_check_path". > Also, the word "split" is somewhat confusing as you've been using it > for actually splitting one function into two elsewhere in this set. > > Perhaps just call the patch "rename do

Re: [RFC PATCH] dm-inlinecrypt: add target for inline block device encryption

2024-10-08 Thread Christoph Hellwig
On Mon, Oct 07, 2024 at 10:25:56AM +0200, Milan Broz wrote: > I am talking from the security point of view. Now, dm-crypt does not trust > storage devices. Storage devices will never see plaintext (or key). > With inline crypto, it needs to see both. With inline crypto as implemented right now the

Re: [PATCH] dm: fix a crash if blk_alloc_disk fails

2024-10-08 Thread Nitesh Shetty
On 07/10/24 01:38PM, Mikulas Patocka wrote: Hi Here I'm submitting a patch for this bug. Mikulas From: Mikulas Patocka If blk_alloc_disk fails, the variable md->disk is set to an error value. cleanup_mapped_device will see that md->disk is non-NULL and it will attempt to access it, causing