diff mbox series

[v2,02/18] multipathd: make flush_map() delete maps like the multipath command

Message ID 20240103175643.18438-3-bmarzins@redhat.com (mailing list archive)
State Not Applicable, archived
Delegated to: christophe varoqui
Headers show
Series change how multipathd deletes maps plus cleanups | expand

Commit Message

Benjamin Marzinski Jan. 3, 2024, 5:56 p.m. UTC
When the multipath command tries to delete a multipath device, it first
disables queueing and then suspends the device to force the IOs to get
flushed. Then it attempts to delete the device and any kpartx
partitions.  multipathd, on the other hand, simply tries to delete the
device and kpartx partitions, without disabling queueing or suspending.
If there are no paths but there is outstanding IO, multipathd will hang
trying to delete the last kpartx device. This is because it must be the
last opener of the multipath device (multipath won't try to delete the
device if it has any openers besides the kpartx devices) and the kernel
will not allow the last opener of a block device to close until all the
outstanding IO is flushed.  This hang can be avoided if multipathd calls
dm_suspend_and_flush_map() like the multipath command does, instead of
dm_flush_map().

Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
 multipathd/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/multipathd/main.c b/multipathd/main.c
index 4a7e0ba1..6b66a5ee 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -788,7 +788,7 @@  sync_maps_state(vector mpvec)
 int
 flush_map(struct multipath * mpp, struct vectors * vecs)
 {
-	int r = dm_flush_map(mpp->alias);
+	int r = dm_suspend_and_flush_map(mpp->alias, 0);
 	if (r) {
 		condlog(0, "%s: can't flush", mpp->alias);
 		return r;