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

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