[PATCH 5/6] ignore for clear mismatch key

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The mpathpersist -I and -G does not work.
Here we fix that.

Signed-off-by: Jianbing Jiao <jiaojianbing@xxxxxxxxxx>
Signed-off-by: Lixiaokeng <lixiaokeng@xxxxxxxxxx>
---
 libmpathpersist/mpath_persist.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c
index 02d173dc..95018ae5 100644
--- a/libmpathpersist/mpath_persist.c
+++ b/libmpathpersist/mpath_persist.c
@@ -265,8 +265,10 @@ int __mpath_persistent_reserve_out ( int fd, int rq_servact, int rq_scope,
 	memcpy(&prkey, paramp->sa_key, 8);
 	if (mpp->prkey_source == PRKEY_SOURCE_FILE && prkey &&
 	    ((!get_be64(mpp->reservation_key) &&
-	      rq_servact == MPATH_PROUT_REG_SA) ||
-	     rq_servact == MPATH_PROUT_REG_IGN_SA)) {
+	    rq_servact == MPATH_PROUT_REG_SA) ||
+	    rq_servact == MPATH_PROUT_REG_IGN_SA ||
+	    (!memcmp(paramp->key, &mpp->reservation_key, 8) &&
+	    rq_servact == MPATH_PROUT_REG_SA))) {
 		memcpy(&mpp->reservation_key, paramp->sa_key, 8);
 		if (update_prkey_flags(alias, get_be64(mpp->reservation_key),
 				       paramp->sa_flags)) {
@@ -282,12 +284,14 @@ int __mpath_persistent_reserve_out ( int fd, int rq_servact, int rq_scope,
 		uitmp[j] = (uireservation & 0xff);
 		uireservation >>= 8;
 	}
-
-	if (memcmp(paramp->key, uitmp, 8) &&
-	    memcmp(paramp->sa_key, uitmp, 8)) {
-		condlog(0, "%s: configured reservation key doesn't match: 0x%" PRIx64, alias, get_be64(mpp->reservation_key));
-		ret = MPATH_PR_SYNTAX_ERROR;
-		goto out1;
+	/* pass -I option */
+	if (rq_servact != MPATH_PROUT_REG_IGN_SA) {
+		if (memcmp(paramp->key, uitmp, 8) &&
+		    memcmp(paramp->sa_key, uitmp, 8)) {
+			condlog(0, "%s: configured reservation key doesn't match: 0x%" PRIx64, alias, get_be64(mpp->reservation_key));
+			ret = MPATH_PR_SYNTAX_ERROR;
+			goto out1;
+		}
 	}

 	switch(rq_servact)
--

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




[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux