Blame SOURCES/0049-mpathpersist-update-prkeys-file-on-changing-registra.patch

b7337d
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
b7337d
From: Benjamin Marzinski <bmarzins@redhat.com>
b7337d
Date: Mon, 23 Nov 2020 20:45:50 -0600
b7337d
Subject: [PATCH] mpathpersist: update prkeys file on changing registrations
b7337d
b7337d
When the "reservation_key" option is set to "file" and Register command
b7337d
is run with both the current Reservation Key and a new Service Action
b7337d
Reservation Key, mpathpersist will change the registration, but will not
b7337d
update the prkeys file. This means that future paths that come online
b7337d
will not be able to register, since multipathd is still using the old
b7337d
reservation key. Fix this.
b7337d
b7337d
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
b7337d
---
b7337d
 libmpathpersist/mpath_persist.c | 7 ++++---
b7337d
 1 file changed, 4 insertions(+), 3 deletions(-)
b7337d
b7337d
diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c
b7337d
index aa196008..a01dfb0b 100644
b7337d
--- a/libmpathpersist/mpath_persist.c
b7337d
+++ b/libmpathpersist/mpath_persist.c
b7337d
@@ -307,9 +307,10 @@ int __mpath_persistent_reserve_out ( int fd, int rq_servact, int rq_scope,
b7337d
 
b7337d
 	memcpy(&prkey, paramp->sa_key, 8);
b7337d
 	if (mpp->prkey_source == PRKEY_SOURCE_FILE && prkey &&
b7337d
-	    ((!get_be64(mpp->reservation_key) &&
b7337d
-	      rq_servact == MPATH_PROUT_REG_SA) ||
b7337d
-	     rq_servact == MPATH_PROUT_REG_IGN_SA)) {
b7337d
+	    (rq_servact == MPATH_PROUT_REG_IGN_SA ||
b7337d
+	     (rq_servact == MPATH_PROUT_REG_SA &&
b7337d
+	      (!get_be64(mpp->reservation_key) ||
b7337d
+	       memcmp(paramp->key, &mpp->reservation_key, 8) == 0)))) {
b7337d
 		memcpy(&mpp->reservation_key, paramp->sa_key, 8);
b7337d
 		if (update_prkey_flags(alias, get_be64(mpp->reservation_key),
b7337d
 				       paramp->sa_flags)) {
b7337d
-- 
b7337d
2.17.2
b7337d