Linux Device Mapper development
 help / color / mirror / Atom feed
* [dm-devel] [PATCH] mpathpersist: Fix Register and Ignore with 0x00 SARK
@ 2020-11-09 23:12 Benjamin Marzinski
  2020-11-24  2:50 ` Benjamin Marzinski
  0 siblings, 1 reply; 2+ messages in thread
From: Benjamin Marzinski @ 2020-11-09 23:12 UTC (permalink / raw)
  To: Christophe Varoqui; +Cc: device-mapper development, Martin Wilck

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.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
 libmpathpersist/mpath_persist.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c
index 79322e86..703f8e13 100644
--- a/libmpathpersist/mpath_persist.c
+++ b/libmpathpersist/mpath_persist.c
@@ -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);
-- 
2.17.2

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [dm-devel] [PATCH] mpathpersist: Fix Register and Ignore with 0x00 SARK
  2020-11-09 23:12 [dm-devel] [PATCH] mpathpersist: Fix Register and Ignore with 0x00 SARK Benjamin Marzinski
@ 2020-11-24  2:50 ` Benjamin Marzinski
  0 siblings, 0 replies; 2+ messages in thread
From: Benjamin Marzinski @ 2020-11-24  2:50 UTC (permalink / raw)
  To: Christophe Varoqui; +Cc: device-mapper development, Martin Wilck

On Mon, Nov 09, 2020 at 05:12:42PM -0600, Benjamin Marzinski wrote:
> 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
 
> Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
> ---
>  libmpathpersist/mpath_persist.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c
> index 79322e86..703f8e13 100644
> --- a/libmpathpersist/mpath_persist.c
> +++ b/libmpathpersist/mpath_persist.c
> @@ -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);
> -- 
> 2.17.2
> 
> --
> dm-devel mailing list
> dm-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/dm-devel

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-24  2:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-09 23:12 [dm-devel] [PATCH] mpathpersist: Fix Register and Ignore with 0x00 SARK Benjamin Marzinski
2020-11-24  2:50 ` Benjamin Marzinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox