Blame SOURCES/0002-multipathd-fix-missing-persistent-reseravtion-for-ac.patch

e65fa3
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
e65fa3
From: lixiaokeng <lixiaokeng@huawei.com>
e65fa3
Date: Mon, 13 Sep 2021 10:43:14 +0800
e65fa3
Subject: [PATCH] multipathd: fix missing persistent reseravtion for active
e65fa3
 path
e65fa3
e65fa3
There are two paths(sucu as sda and adb) for one LUN. The two
e65fa3
paths log in, but before the two uevents have been processed
e65fa3
(for example there are many uevent), users use multipathd add
e65fa3
path /dev/sda to cause mpatha and use mpathpersist -o -I to
e65fa3
register prkey for mpatha. The add map uevent is after add path
e65fa3
uevent, the the uevent(add sdb) will delay and missing persistent
e65fa3
reseravtion check.
e65fa3
e65fa3
Here, we add persistent reseravtion check in update_map() which
e65fa3
is called ev_add_map().
e65fa3
e65fa3
Signed-off-by: Lixiaokeng <lixiaokeng@huawei.com>
e65fa3
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
e65fa3
---
e65fa3
 multipathd/main.c | 11 +++++++++++
e65fa3
 1 file changed, 11 insertions(+)
e65fa3
e65fa3
diff --git a/multipathd/main.c b/multipathd/main.c
e65fa3
index 3aff241d..1defeaf1 100644
e65fa3
--- a/multipathd/main.c
e65fa3
+++ b/multipathd/main.c
e65fa3
@@ -490,6 +490,8 @@ update_map (struct multipath *mpp, struct vectors *vecs, int new_map)
e65fa3
 {
e65fa3
 	int retries = 3;
e65fa3
 	char *params __attribute__((cleanup(cleanup_charp))) = NULL;
e65fa3
+	struct path *pp;
e65fa3
+	int i;
e65fa3
 
e65fa3
 retry:
e65fa3
 	condlog(4, "%s: updating new map", mpp->alias);
e65fa3
@@ -502,6 +504,15 @@ retry:
e65fa3
 	verify_paths(mpp);
e65fa3
 	mpp->action = ACT_RELOAD;
e65fa3
 
e65fa3
+	if (mpp->prflag) {
e65fa3
+		vector_foreach_slot(mpp->paths, pp, i) {
e65fa3
+			if ((pp->state == PATH_UP)  || (pp->state == PATH_GHOST)) {
e65fa3
+				/* persistent reseravtion check*/
e65fa3
+				mpath_pr_event_handle(pp);
e65fa3
+			}
e65fa3
+		}
e65fa3
+	}
e65fa3
+
e65fa3
 	if (setup_map(mpp, &params, vecs)) {
e65fa3
 		condlog(0, "%s: failed to setup new map in update", mpp->alias);
e65fa3
 		retries = -1;