Add 0035-libmpathpersist-fix-memory-leak-in-mpath_prout_rel.patch
Add 0036-libmpathpersist-retry-commands-on-other-paths-in-mpa.patch
Add 0037-libmpathpersist-check-released-key-against-the-reser.patch
Add 0038-multipathd-remove-thread-from-mpath_pr_event_handle.patch
Add 0039-libmpathpersist-remove-uneeded-wrapper-function.patch
Add 0040-libmpathpersist-reduce-log-level-for-persistent-rese.patch
Add 0041-libmpathpersist-remove-pointless-update_map_pr-ret-v.patch
Add 0042-multipathd-use-update_map_pr-in-mpath_pr_event_handl.patch
Add 0043-libmpathpersist-limit-changing-prflag-in-update_map_.patch
Add 0044-multipathd-Don-t-call-update_map_pr-unnecessarily.patch
Add 0045-libmpathpersist-remove-useless-function-send_prout_a.patch
Add 0046-libmpathpersist-redesign-failed-release-workaround.patch
Add 0047-libmpathpersist-fail-the-release-if-all-threads-fail.patch
Add 0048-libmpathpersist-Handle-changing-key-corner-case.patch
Add 0049-libmpathpersist-Handle-REGISTER-AND-IGNORE-changing-.patch
Add 0050-libmultipath-rename-prflag_value-enums.patch
Add 0051-libmpathpersist-use-a-switch-statement-for-prout-com.patch
Add 0052-libmpathpersist-Add-safety-check-for-preempting-on-k.patch
Add 0053-libmpathpersist-remove-update_map_pr-code-for-NULL-p.patch
Add 0054-libmpathpersist-move-update_map_pr-to-multipathd.patch
Add 0055-multipathd-clean-up-update_map_pr-and-mpath_pr_event.patch
Add 0056-libmpathpersist-clean-up-duplicate-function-declarat.patch
Add 0057-multipathd-wrap-setting-and-unsetting-prflag.patch
Add 0058-multipathd-unregister-PR-key-when-path-is-restored-i.patch
Add 0059-libmpathpersist-Fix-up-reservation_key-checking.patch
Add 0060-libmpathpersist-change-how-reservation-conflicts-are.patch
Add 0061-libmpathpersist-Clear-prkey-in-multipathd-before-unr.patch
Add 0062-libmpathpersist-only-clear-the-key-if-we-are-using-t.patch
Add 0063-libmpathpersist-Restore-old-reservation-key-on-failu.patch
Add 0064-libmpathpersist-update-reservation-key-before-checki.patch
Add 0065-libmpathpersist-retry-on-conflicts-in-mpath_prout_co.patch
Add 0066-libmpathpersist-Don-t-always-fail-registrations-for-.patch
Add 0067-libmpathpersist-Don-t-try-release-workaround-for-inv.patch
Add 0068-libmpathpersist-Don-t-fail-RESERVE-commands-unnecess.patch
Add 0069-libmpathpersist-reregister-keys-when-self-preempting.patch
Add 0070-libmpathpersist-handle-updating-key-race-condition.patch
Add 0071-libmpathpersist-handle-preempting-all-registrants-re.patch
Add 0072-libmpathpersist-Fix-REGISTER-AND-IGNORE-while-holdin.patch
Add 0073-libmpathpersist-Handle-RESERVE-with-reservation-held.patch
Add 0074-libmpathpersist-use-check_holding_reservation-in-mpa.patch
Add 0075-libmpathpersist-Fix-unregistering-while-holding-the-.patch
Add 0076-libmpathpersist-Fix-race-between-restoring-a-path-an.patch
Add 0077-multipathd-Fix-tracking-of-old-PR-key.patch
* Fixes RHEL-118720 ("There are many bugs in multipath's persistent
reservation handling [rhel-10]")
Resolves: RHEL-118720
250 lines
7.5 KiB
Diff
250 lines
7.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Benjamin Marzinski <bmarzins@redhat.com>
|
|
Date: Thu, 10 Jul 2025 14:10:58 -0400
|
|
Subject: [PATCH] libmultipath: rename prflag_value enums
|
|
|
|
These will also be used by another variable, so make their name more
|
|
generic.
|
|
|
|
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
|
Reviewed-by: Martin Wilck <mwilck@suse.com>
|
|
---
|
|
libmpathpersist/mpath_persist_int.c | 16 ++++++++--------
|
|
libmpathpersist/mpath_updatepr.c | 8 ++++----
|
|
libmultipath/structs.h | 9 ++++-----
|
|
multipathd/cli_handlers.c | 22 +++++++++++-----------
|
|
multipathd/main.c | 17 ++++++++---------
|
|
5 files changed, 35 insertions(+), 37 deletions(-)
|
|
|
|
diff --git a/libmpathpersist/mpath_persist_int.c b/libmpathpersist/mpath_persist_int.c
|
|
index 19220d7a..d596b5bd 100644
|
|
--- a/libmpathpersist/mpath_persist_int.c
|
|
+++ b/libmpathpersist/mpath_persist_int.c
|
|
@@ -663,10 +663,10 @@ static void set_ignored_key(struct multipath *mpp, uint8_t *key)
|
|
memset(key, 0, 8);
|
|
if (!get_be64(mpp->reservation_key))
|
|
return;
|
|
- if (get_prflag(mpp->alias) == PRFLAG_UNSET)
|
|
+ if (get_prflag(mpp->alias) == PR_UNSET)
|
|
return;
|
|
update_map_pr(mpp, NULL);
|
|
- if (mpp->prflag != PRFLAG_SET)
|
|
+ if (mpp->prflag != PR_SET)
|
|
return;
|
|
memcpy(key, &mpp->reservation_key, 8);
|
|
}
|
|
@@ -767,16 +767,16 @@ int update_map_pr(struct multipath *mpp, struct path *pp)
|
|
struct prin_resp *resp;
|
|
unsigned int i;
|
|
int ret = MPATH_PR_OTHER, isFound;
|
|
- bool was_set = (mpp->prflag == PRFLAG_SET);
|
|
+ bool was_set = (mpp->prflag == PR_SET);
|
|
|
|
/* If pr is explicitly unset, it must be manually set */
|
|
- if (mpp->prflag == PRFLAG_UNSET)
|
|
+ if (mpp->prflag == PR_UNSET)
|
|
return MPATH_PR_SKIP;
|
|
|
|
if (!get_be64(mpp->reservation_key))
|
|
{
|
|
/* Nothing to do. Assuming pr mgmt feature is disabled*/
|
|
- mpp->prflag = PRFLAG_UNSET;
|
|
+ mpp->prflag = PR_UNSET;
|
|
condlog(was_set ? 2 : 4,
|
|
"%s: reservation_key not set in multipath.conf",
|
|
mpp->alias);
|
|
@@ -801,11 +801,11 @@ int update_map_pr(struct multipath *mpp, struct path *pp)
|
|
if (ret != MPATH_PR_SUCCESS )
|
|
{
|
|
if (ret == MPATH_PR_ILLEGAL_REQ)
|
|
- mpp->prflag = PRFLAG_UNSET;
|
|
+ mpp->prflag = PR_UNSET;
|
|
condlog(0,"%s : pr in read keys service action failed Error=%d", mpp->alias, ret);
|
|
goto out;
|
|
}
|
|
- mpp->prflag = PRFLAG_UNSET;
|
|
+ mpp->prflag = PR_UNSET;
|
|
|
|
if (resp->prin_descriptor.prin_readkeys.additional_length == 0 )
|
|
{
|
|
@@ -840,7 +840,7 @@ int update_map_pr(struct multipath *mpp, struct path *pp)
|
|
|
|
if (isFound)
|
|
{
|
|
- mpp->prflag = PRFLAG_SET;
|
|
+ mpp->prflag = PR_SET;
|
|
condlog(was_set ? 3 : 2, "%s: key found. prflag set.", mpp->alias);
|
|
} else
|
|
condlog(was_set ? 1 : 3, "%s: key not found. prflag unset.",
|
|
diff --git a/libmpathpersist/mpath_updatepr.c b/libmpathpersist/mpath_updatepr.c
|
|
index 7cf82f50..c8fbe4a2 100644
|
|
--- a/libmpathpersist/mpath_updatepr.c
|
|
+++ b/libmpathpersist/mpath_updatepr.c
|
|
@@ -84,13 +84,13 @@ int get_prflag(char *mapname)
|
|
snprintf(str, sizeof(str), "getprstatus map %s", mapname);
|
|
reply = do_pr(mapname, str);
|
|
if (!reply)
|
|
- prflag = PRFLAG_UNKNOWN;
|
|
+ prflag = PR_UNKNOWN;
|
|
else if (strncmp(reply, "unset", 5) == 0)
|
|
- prflag = PRFLAG_UNSET;
|
|
+ prflag = PR_UNSET;
|
|
else if (strncmp(reply, "set", 3) == 0)
|
|
- prflag = PRFLAG_SET;
|
|
+ prflag = PR_SET;
|
|
else
|
|
- prflag = PRFLAG_UNKNOWN;
|
|
+ prflag = PR_UNKNOWN;
|
|
|
|
free(reply);
|
|
return prflag;
|
|
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
|
|
index 5dc00fbc..24135aa6 100644
|
|
--- a/libmultipath/structs.h
|
|
+++ b/libmultipath/structs.h
|
|
@@ -406,11 +406,10 @@ struct path {
|
|
|
|
typedef int (pgpolicyfn) (struct multipath *, vector);
|
|
|
|
-
|
|
-enum prflag_value {
|
|
- PRFLAG_UNKNOWN,
|
|
- PRFLAG_UNSET,
|
|
- PRFLAG_SET,
|
|
+enum pr_value {
|
|
+ PR_UNKNOWN,
|
|
+ PR_UNSET,
|
|
+ PR_SET,
|
|
};
|
|
|
|
struct multipath {
|
|
diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
|
|
index 117570e1..8e2e2cea 100644
|
|
--- a/multipathd/cli_handlers.c
|
|
+++ b/multipathd/cli_handlers.c
|
|
@@ -1240,14 +1240,15 @@ cli_shutdown (void * v, struct strbuf *reply, void * data)
|
|
return 0;
|
|
}
|
|
|
|
+static const char *const pr_str[] = {
|
|
+ [PR_UNKNOWN] = "unknown\n",
|
|
+ [PR_UNSET] = "unset\n",
|
|
+ [PR_SET] = "set\n",
|
|
+};
|
|
+
|
|
static int
|
|
cli_getprstatus (void * v, struct strbuf *reply, void * data)
|
|
{
|
|
- static const char * const prflag_str[] = {
|
|
- [PRFLAG_UNKNOWN] = "unknown\n",
|
|
- [PRFLAG_UNSET] = "unset\n",
|
|
- [PRFLAG_SET] = "set\n",
|
|
- };
|
|
struct multipath * mpp;
|
|
struct vectors * vecs = (struct vectors *)data;
|
|
char * param = get_keyparam(v, KEY_MAP);
|
|
@@ -1258,7 +1259,7 @@ cli_getprstatus (void * v, struct strbuf *reply, void * data)
|
|
if (!mpp)
|
|
return -ENODEV;
|
|
|
|
- append_strbuf_str(reply, prflag_str[mpp->prflag]);
|
|
+ append_strbuf_str(reply, pr_str[mpp->prflag]);
|
|
|
|
condlog(3, "%s: reply = %s", param, get_strbuf_str(reply));
|
|
|
|
@@ -1278,12 +1279,11 @@ cli_setprstatus(void * v, struct strbuf *reply, void * data)
|
|
if (!mpp)
|
|
return -ENODEV;
|
|
|
|
- if (mpp->prflag != PRFLAG_SET) {
|
|
- mpp->prflag = PRFLAG_SET;
|
|
+ if (mpp->prflag != PR_SET) {
|
|
+ mpp->prflag = PR_SET;
|
|
condlog(2, "%s: prflag set", param);
|
|
}
|
|
|
|
-
|
|
return 0;
|
|
}
|
|
|
|
@@ -1300,8 +1300,8 @@ cli_unsetprstatus(void * v, struct strbuf *reply, void * data)
|
|
if (!mpp)
|
|
return -ENODEV;
|
|
|
|
- if (mpp->prflag != PRFLAG_UNSET) {
|
|
- mpp->prflag = PRFLAG_UNSET;
|
|
+ if (mpp->prflag != PR_UNSET) {
|
|
+ mpp->prflag = PR_UNSET;
|
|
condlog(2, "%s: prflag unset", param);
|
|
}
|
|
|
|
diff --git a/multipathd/main.c b/multipathd/main.c
|
|
index 4a1b38e9..bd4342a3 100644
|
|
--- a/multipathd/main.c
|
|
+++ b/multipathd/main.c
|
|
@@ -644,7 +644,7 @@ pr_register_active_paths(struct multipath *mpp)
|
|
|
|
vector_foreach_slot (mpp->pg, pgp, i) {
|
|
vector_foreach_slot (pgp->paths, pp, j) {
|
|
- if (mpp->prflag == PRFLAG_UNSET)
|
|
+ if (mpp->prflag == PR_UNSET)
|
|
return;
|
|
if ((pp->state == PATH_UP) || (pp->state == PATH_GHOST))
|
|
mpath_pr_event_handle(pp);
|
|
@@ -1253,7 +1253,7 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map)
|
|
int start_waiter = 0;
|
|
int ret;
|
|
int ro;
|
|
- unsigned char prflag = PRFLAG_UNSET;
|
|
+ unsigned char prflag = PR_UNSET;
|
|
|
|
/*
|
|
* need path UID to go any further
|
|
@@ -1381,8 +1381,7 @@ rescan:
|
|
sync_map_state(mpp);
|
|
|
|
if (retries >= 0) {
|
|
- if ((mpp->prflag == PRFLAG_SET && prflag != PRFLAG_SET) ||
|
|
- start_waiter)
|
|
+ if ((mpp->prflag == PR_SET && prflag != PR_SET) || start_waiter)
|
|
pr_register_active_paths(mpp);
|
|
condlog(2, "%s [%s]: path added to devmap %s",
|
|
pp->dev, pp->dev_t, mpp->alias);
|
|
@@ -2645,7 +2644,7 @@ check_path (struct vectors * vecs, struct path * pp, unsigned int ticks)
|
|
}
|
|
|
|
if (newstate == PATH_UP || newstate == PATH_GHOST) {
|
|
- if (pp->mpp->prflag != PRFLAG_UNSET) {
|
|
+ if (pp->mpp->prflag != PR_UNSET) {
|
|
int prflag = pp->mpp->prflag;
|
|
/*
|
|
* Check Persistent Reservation.
|
|
@@ -2653,8 +2652,8 @@ check_path (struct vectors * vecs, struct path * pp, unsigned int ticks)
|
|
condlog(2, "%s: checking persistent "
|
|
"reservation registration", pp->dev);
|
|
mpath_pr_event_handle(pp);
|
|
- if (pp->mpp->prflag == PRFLAG_SET &&
|
|
- prflag != PRFLAG_SET)
|
|
+ if (pp->mpp->prflag == PR_SET &&
|
|
+ prflag != PR_SET)
|
|
pr_register_active_paths(pp->mpp);
|
|
}
|
|
}
|
|
@@ -3947,14 +3946,14 @@ static void mpath_pr_event_handle(struct path *pp)
|
|
struct prout_param_descriptor *param;
|
|
|
|
if (pp->bus != SYSFS_BUS_SCSI) {
|
|
- mpp->prflag = PRFLAG_UNSET;
|
|
+ mpp->prflag = PR_UNSET;
|
|
return;
|
|
}
|
|
|
|
if (update_map_pr(mpp, pp) != MPATH_PR_SUCCESS)
|
|
return;
|
|
|
|
- if (mpp->prflag != PRFLAG_SET)
|
|
+ if (mpp->prflag != PR_SET)
|
|
return;
|
|
|
|
param = (struct prout_param_descriptor *)calloc(1, sizeof(struct prout_param_descriptor));
|