[PATCH v2 03/32] libmpathpersist: reduce log level for persistent reservation checking

2025-09-08 Thread Benjamin Marzinski
Move logging of minor expected behavior to INFO level. Modify the log level of some messages by whether or not mpp->prflag changed values. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- libmpathpersist/mpath_persist_int.c | 34 +++-- 1 file changed, 22 i

[PATCH v2 23/32] libmpathpersist: change how reservation conflicts are handled

2025-09-08 Thread Benjamin Marzinski
If registering a key on a path fails with a reservation conflict in mpath_prout_reg(), libmpathpersist currently tries to roll back the registration. This code doesn't always make much sense. First, it updates the configured key, but doesn't fix it if it does a rollback. Second, it always rolls the

[PATCH v2 28/32] libmpathpersist: retry on conflicts in mpath_prout_common

2025-09-08 Thread Benjamin Marzinski
mpath_prout_common() just needs to execute a prout command down one path. If it uses a path that was down when the key was changed and has since been restored, but multipathd hasn't noticed yet, that path will still be using the old key. This was causing mpath_prout_common() to fail with MPATH_PR_R

[PATCH v2 24/32] libmpathpersist: Clear prkey in multipathd before unregistering

2025-09-08 Thread Benjamin Marzinski
When you register or switch keys in libmpathpersist, it updates mpp->reservation_key in multipathd before doing the registration. This means that any paths that come online while you are doing the registration get the new key registered. libmpathpersist didn't do this when unregistering a key. This

[PATCH v2 22/32] libmpathpersist: Fix-up reservation_key checking

2025-09-08 Thread Benjamin Marzinski
The reservation key checking in do_mpath_persistent_reserve_out() was slightly wrong. It allowed invalid keys for preempting. It now correctly checks the reservation key for the preempt commands. It also was a little overly strict in some places. Formerly, it only allowed registering from any key

[PATCH v2 13/32] libmultipath: rename prflag_value enums

2025-09-08 Thread Benjamin Marzinski
These will also be used by another variable, so make their name more generic. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- libmpathpersist/mpath_persist_int.c | 16 libmpathpersist/mpath_updatepr.c| 8 libmultipath/structs.h | 9 ++

[PATCH v2 01/32] multipathd: remove thread from mpath_pr_event_handle

2025-09-08 Thread Benjamin Marzinski
mpath_pr_event_handle() creates a separate thread to do the persistent reservation work, but it doesn't take any advantage of the work being done in another thread. Merge mpath_pr_event_handle() and mpath_pr_event_handler_fn() into a single function with no separate thread. Signed-off-by: Benjamin

[PATCH v2 31/32] libmpathpersist: Don't fail RESERVE commands unnecessarily

2025-09-08 Thread Benjamin Marzinski
If you issue a RESERVE to a regular SCSI device that already holds the reservation, it succeeds (and does nothing). If you issue a RESERVE to a multipath device that already holds the reservation, it can fail with a reservation conflict error if you issue the RESERVE to a path that isn't holding th

[PATCH v2 21/32] multipathd: unregister PR key when path is restored if necessary

2025-09-08 Thread Benjamin Marzinski
It is possible that a path was unavailable and either the registered PR key was removed or the registered PR key was changed and then that new key was preempted. In both of these situations, this path will still have a registered key (just not one that matches mpp->reservation_key) but it should no

[PATCH v2 07/32] multipathd: Don't call update_map_pr unnecessarily

2025-09-08 Thread Benjamin Marzinski
None of the calls to update_map_pr() outside of mpath_pr_event_handle() add any benefit. When update_map_pr() is called without a path, it tries to read the pr keys list on each usable path until it succeeds, and then checks the keys to see if they include the configured key. In all cases where up

[PATCH v2 09/32] libmpathpersist: redesign failed release workaround

2025-09-08 Thread Benjamin Marzinski
The workaround for releasing a reservation held by a failed path (clearing all persistent reservation data and then reregistering all the keys) has several problems. It requires devices that support the READ FULL STATUS command and are capable of specifying TransportIDs with REGISTRATION commands (

[PATCH v2 32/32] libmpathpersist: reregister keys when self preempting

2025-09-08 Thread Benjamin Marzinski
When a SCSI device preempts its own reservation key, it will remove the registered keys from all other devices with that reservation key, but retain its registered key (and possibly acquire the reservation). If a multipath device preempts its own reservation key, it will also remove the registered

[PATCH v2 15/32] libmpathpersist: Add safety check for preempting on key change

2025-09-08 Thread Benjamin Marzinski
When a reservation key is changed from one non-zero value to another, libmpathpersist checks if the old key is still holding the reservation, and preempts it if it is. This was only safe if two nodes never share the same key. If a node uses the same key as another node that is holding the reservati

[PATCH v2 12/32] libmpathpersist: Handle REGISTER AND IGNORE changing key corner case

2025-09-08 Thread Benjamin Marzinski
When you use REGISTER to change the reservation key of a registered multipath device, where the path holding the reservation is down, libmpathpersist will PREEMPT the failed path to move the reservation to a usable path, so the reservation key will be updated. However, when you use REGISTER AND IGN

[PATCH v2 02/32] libmpathpersist: remove uneeded wrapper function.

2025-09-08 Thread Benjamin Marzinski
mpath_send_prin_activepath() just calls prin_do_scsi_ioctl() with exactly the same arguments that it is passed, and returns the same return. remove it. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- libmpathpersist/mpath_persist_int.c | 14 +- 1 file changed, 1 inse

[PATCH v2 20/32] multipathd: wrap setting and unsetting prflag

2025-09-08 Thread Benjamin Marzinski
When prflag is unset, prhold and sa_flags should also be unset. A future patch will add another variable to be set when prflag is set. Wrap all these actions in set_pr() and unset_pr(). Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- multipathd/cli_handlers.c | 10 -- mu

[PATCH v2 10/32] libmpathpersist: fail the release if all threads fail

2025-09-08 Thread Benjamin Marzinski
If none of the threads succeeds in issuing the release, simply return failure, instead of trying the workaround. Signed-off-by: Benjamin Marzinski --- libmpathpersist/mpath_persist_int.c | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/libmpathpersist/mpath_per

[PATCH v2 06/32] libmpathpersist: limit changing prflag in update_map_pr

2025-09-08 Thread Benjamin Marzinski
Do not unset mpp->prflag in update_map_pr() unless the device doesn't support persistent reservations or it successfully reads the registered keys and discovers that the device's key is not there. Also, nothing in the libmpathpersist ever returns MPATH_PR_SENSE_INVALID_OP. It instead returns MPATH_

[PATCH v2 14/32] libmpathpersist: use a switch statement for prout command finalizing

2025-09-08 Thread Benjamin Marzinski
Change the code at the end of do_mpath_persistent_reserve_out() to use a switch statement instead of multiple if statements. A future patch will add more actions here, and a switch statement looks cleaner. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- libmpathpersist/mpath_per

[PATCH v2 17/32] libmpathpersist: move update_map_pr to multipathd

2025-09-08 Thread Benjamin Marzinski
multipathd is now the only program that calls update_map_pr(), so move it there, and make it static. There are no other code changes. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- libmpathpersist/libmpathpersist.version | 1 - libmpathpersist/mpath_persist_int.c | 83

[PATCH v2 04/32] libmpathpersist: remove pointless update_map_pr ret value code

2025-09-08 Thread Benjamin Marzinski
Don't set ret to MPATH_PR_SUCCESS, after the code just made sure that it was already set to MPATH_PR_SUCCESS. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- libmpathpersist/mpath_persist_int.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libmpathpersist/mpath_persist_in

[PATCH v2 08/32] libmpathpersist: remove useless function send_prout_activepath

2025-09-08 Thread Benjamin Marzinski
send_prout_activepath() creates a single separate thread that just calls prout_do_scsi_ioctl() and it doesn't take any advantage of the work being done in another thread. Remove the function and call prout_do_scsi_ioctl() directly. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck ---

[PATCH 1/1] dm-vdo: Refactor VDO_ASSERT usage in start_restoring_volume functions

2025-09-08 Thread Ivan Abramov
There's an incorrect VDO_ASSERT macro usage in start_restoring volume_index() and start_restoring_volume_sub_index(), since assert's return value is not used anywhere. Thus, use VDO_ASSERT_LOG_ONLY macro in such cases. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off

Re: deadlock when swapping to encrypted swapfile

2025-09-08 Thread Mikulas Patocka
On Mon, 8 Sep 2025, Robert Beckett wrote: > Hi, > > While testing resiliency of encrypted swap using dmcrypt we encounter easily > reproducible deadlocks. > The setup is a simple 1GB encrypted swap file [1] with a little mem chewer > program [2] to consume all ram. > > Usually the first run

[PATCH] dm-integrity: limit MAX_TAG_SIZE to 255

2025-09-08 Thread Mikulas Patocka
MAX_TAG_SIZE was 0x1a8 and it may be truncated in the "bi->metadata_size = ic->tag_size" assignment. We need to limit it to 255. Signed-off-by: Mikulas Patocka --- drivers/md/dm-integrity.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: linux-2.6/drivers/md/dm-integrity.c

Re: [PATCH 1/2] libmultipath: fix missing return value check in snprint_devices()

2025-09-08 Thread Benjamin Marzinski
On Fri, Sep 05, 2025 at 11:07:13PM +0200, Martin Wilck wrote: > Coverity scan defect #488155. > Your fix looks fine, but the code I see right above it isn't. We should not be returning a positive number here if things went wrong. Looking at the udev_enumerate_new() code, we should be safe always

Re: [PATCH 1/1] dm-integrity: Remove unreachable code in dm_integrity_ctr()

2025-09-08 Thread Mikulas Patocka
Hi What if someone changes it to a larger type later? I think that if this branch doesn't do any harm and if it protects us from memory errors introduced by future changes, we may let it be there. But I found another bug when looking at this - the user may set tag size up to MAX_TAG_SIZE (that

[PATCH v2 4/7] dm-integrity: allocate the recalculate buffer with kmalloc

2025-09-08 Thread Mikulas Patocka
Allocate the recalculate buffer with kmalloc rather than vmalloc. This will be needed later, for the simplification of the asynchronous hash interface. Signed-off-by: Mikulas Patocka --- drivers/md/dm-integrity.c |8 1 file changed, 4 insertions(+), 4 deletions(-) Index: linux-2.6/

[PATCH v2 5/7] dm-integrity: add the "offset" argument

2025-09-08 Thread Mikulas Patocka
Make sure that the "data" argument passed to integrity_sector_checksum is always page-aligned and add an "offset" argument that specifies the offset from the start of the page. This will enable us to use the asynchronous hash interface later. Signed-off-by: Mikulas Patocka --- drivers/md/dm-inte

[PATCH v2 6/7] dm-integrity: rename internal_hash

2025-09-08 Thread Mikulas Patocka
Rename "internal_hash" to "internal_shash" and introduce a boolean value "internal_hash". Signed-off-by: Mikulas Patocka --- drivers/md/dm-integrity.c | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) Index: linux-2.6/drivers/md/dm-integrity.c

[PATCH v2 3/7] dm-integrity: introduce integrity_kmap and integrity_kunmap

2025-09-08 Thread Mikulas Patocka
This abstraction will be used later, for the asynchronous hash interface. Signed-off-by: Mikulas Patocka --- drivers/md/dm-integrity.c | 37 + 1 file changed, 17 insertions(+), 20 deletions(-) Index: linux-2.6/drivers/md/dm-integrity.c =

[PATCH v2 0/7] dm-integrity: asynchronous hash support

2025-09-08 Thread Mikulas Patocka
Hi These patches add asynchronous hash support to dm-integrity. Harald, please test them, I will commit them if they work for you. Mikulas

[PATCH v2 1/7] dm-integrity: use internal variable for digestsize

2025-09-08 Thread Mikulas Patocka
Instead of calling digestsize() each time the digestsize for the internal hash is needed, store the digestsize in a new field internal_hash_digestsize within struct dm_integrity_c once and use this value when needed. Signed-off-by: Harald Freudenberger Signed-off-by: Mikulas Patocka --- drivers