Skip to contentSkip to conversation

mpathpersist: Fix Register and Ignore with 0x00 SARK

PATCH In review Benjamin Marzinski 1 participant 2 messages Nov 9, 2020 – Nov 24, 2020 Device mapper

lore
Share & tools
lore

Benjamin Marzinski

author maintainer
#0 lore raw

PATCH 1/1 mpathpersist: Fix Register and Ignore with 0x00 SARK

When the Register and Ignore command is run with sg_persist, if a 0x00 Service Action Reservation Key is given or the --param-sark option is not used at all, sg_persist will clear the registration. mpathpersist will fail with an error. This patch fixes mpathpersist to work like sg_persist in this case.

---
 libmpathpersist/mpath_persist.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
libmpathpersist/mpath_persist.c +2 -2
index 79322e86..703f8e13 100644
@@ -289,8 +289,8 @@ int __mpath_persistent_reserve_out ( int fd, int rq_servact, int rq_scope,
 	put_multipath_config(conf);
 
 	memcpy(&prkey, paramp->sa_key, 8);
-	if (mpp->prkey_source == PRKEY_SOURCE_FILE && prkey &&
-	    ((!get_be64(mpp->reservation_key) &&
+	if (mpp->prkey_source == PRKEY_SOURCE_FILE &&
+	    ((!get_be64(mpp->reservation_key) && prkey &&
 	      rq_servact == MPATH_PROUT_REG_SA) ||
 	     rq_servact == MPATH_PROUT_REG_IGN_SA)) {
 		memcpy(&mpp->reservation_key, paramp->sa_key, 8);
Signature · 6 lines
2.17.2

--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel
author maintainer
#1 lore raw
Quoted 6 lines · Benjamin Marzinski

When the Register and Ignore command is run with sg_persist, if a 0x00 Service Action Reservation Key is given or the --param-sark option is not used at all, sg_persist will clear the registration. mpathpersist will fail with an error. This patch fixes mpathpersist to work like sg_persist in this case.

NACK. This only fixes the case where "reservation_key" is set to "file". It also needlessly clears the key in the prkeys file twice. I'll send a fixed version.

-Ben

Quoted 27 lines
---
 libmpathpersist/mpath_persist.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
libmpathpersist/mpath_persist.c +2 -2
index 79322e86..703f8e13 100644
@@ -289,8 +289,8 @@ int __mpath_persistent_reserve_out ( int fd, int rq_servact, int rq_scope,
 	put_multipath_config(conf);
 
 	memcpy(&prkey, paramp->sa_key, 8);
-	if (mpp->prkey_source == PRKEY_SOURCE_FILE && prkey &&
-	    ((!get_be64(mpp->reservation_key) &&
+	if (mpp->prkey_source == PRKEY_SOURCE_FILE &&
+	    ((!get_be64(mpp->reservation_key) && prkey &&
 	      rq_servact == MPATH_PROUT_REG_SA) ||
 	     rq_servact == MPATH_PROUT_REG_IGN_SA)) {
 		memcpy(&mpp->reservation_key, paramp->sa_key, 8);
Signature · 6 lines
2.17.2

--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel

--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel