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

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