multipath-tools/0010-ignore-for-clear-mismatch-key.patch

50 lines
2.0 KiB
Diff
Raw Normal View History

2020-11-04 21:19:44 +08:00
From 70ff8a11623a0a0e7677c597b5fb1846149d7de3 Mon Sep 17 00:00:00 2001
2020-01-10 17:13:17 +08:00
From: sunguoshuai <sunguoshuai@huawei.com>
Date: Wed, 23 Jan 2019 02:38:00 -0500
Subject: [PATCH] ignore for clear mismatch key
reason:ignore for clear mismatch key
---
libmpathpersist/mpath_persist.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c
2020-11-04 21:19:44 +08:00
index 557d582..5a8c69d 100644
2020-01-10 17:13:17 +08:00
--- a/libmpathpersist/mpath_persist.c
+++ b/libmpathpersist/mpath_persist.c
2020-11-04 21:19:44 +08:00
@@ -266,7 +266,8 @@ int __mpath_persistent_reserve_out ( int fd, int rq_servact, int rq_scope,
2020-01-10 17:13:17 +08:00
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_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)) {
2020-11-04 21:19:44 +08:00
@@ -283,12 +284,16 @@ int __mpath_persistent_reserve_out ( int fd, int rq_servact, int rq_scope,
2020-01-10 17:13:17 +08:00
uireservation >>= 8;
}
- if (memcmp(paramp->key, uitmp, 8) &&
- memcmp(paramp->sa_key, uitmp, 8)) {
+ /* 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;
+ }
+
- 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)
--
1.8.3.1