device-mapper-multipath/0103-multipathd-make-flush_map-delete-maps-like-the-multi.patch
Benjamin Marzinski dbdf7ab1ce device-mapper-multipath-0.8.7-26
Add 0100-libmultipath-avoid-temporarily-enabling-queueing-on-.patch
Add 0101-multipathd-Make-sure-to-disable-queueing-if-recovery.patch
  * Fixes RHEL-17234 ("RHEL9 dm-multipath no_path_retry [retry number]
    is
    undone if paths are later lost for an open map.")
Add 0102-multipathd-remove-nopath-flushing-code-from-flush_ma.patch
Add 0103-multipathd-make-flush_map-delete-maps-like-the-multi.patch
Add 0104-multipathd-disable-queueing-when-removing-unknown-ma.patch
  * Fixes RHEL-4998 ("When remove external lun from host, rescan lun
    status
    will cause the OS hang and no response")
Resolves: RHEL-4998
Resolves: RHEL-17234
2024-01-05 10:35:33 -05:00

40 lines
1.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Thu, 7 Dec 2023 11:23:18 -0500
Subject: [PATCH] multipathd: make flush_map() delete maps like the multipath
command
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 --git a/multipathd/main.c b/multipathd/main.c
index 1b5f82e7..3eeca82f 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -695,7 +695,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;