multipath-tools/0009-fix-change-reservation-key-to-uint8-for-memcmp.patch

45 lines
1.5 KiB
Diff
Raw Normal View History

2024-02-05 16:52:45 +08:00
From a7e2e9405183dc9066b62a03a333c23a4af2f410 Mon Sep 17 00:00:00 2001
2021-11-23 21:49:34 +08:00
From: sunguoshuai <sunguoshuai@huawei.com>
Date: Wed, 23 Jan 2019 02:21:31 -0500
2024-02-05 16:52:45 +08:00
Subject: [PATCH] fix change reservation key to uint8 for memcmp
2021-11-23 21:49:34 +08:00
reason:fix change reservation key to uint8 for memcmp
---
2024-02-05 16:52:45 +08:00
libmpathpersist/mpath_persist_int.c | 13 +++++++++++--
2021-11-23 21:49:34 +08:00
1 file changed, 11 insertions(+), 2 deletions(-)
2024-02-05 16:52:45 +08:00
diff --git a/libmpathpersist/mpath_persist_int.c b/libmpathpersist/mpath_persist_int.c
index 178c2f5..d88499a 100644
--- a/libmpathpersist/mpath_persist_int.c
+++ b/libmpathpersist/mpath_persist_int.c
@@ -657,6 +657,9 @@ int do_mpath_persistent_reserve_out(vector curmp, vector pathvec, int fd,
2021-11-23 21:49:34 +08:00
int ret;
uint64_t prkey;
struct config *conf;
+ uint8_t uitmp[8] = {0};
+ uint64_t uireservation = {0};
+ int j;
ret = mpath_get_map(curmp, pathvec, fd, &alias, &mpp);
if (ret != MPATH_PR_SUCCESS)
2024-02-05 16:52:45 +08:00
@@ -683,8 +686,14 @@ int do_mpath_persistent_reserve_out(vector curmp, vector pathvec, int fd,
2021-11-23 21:49:34 +08:00
}
}
- if (memcmp(paramp->key, &mpp->reservation_key, 8) &&
- memcmp(paramp->sa_key, &mpp->reservation_key, 8) &&
+ uireservation = get_be64(mpp->reservation_key);
+ for (j = 7; j >= 0; --j) {
+ uitmp[j] = (uireservation & 0xff);
+ uireservation >>= 8;
+ }
+
+ if (memcmp(paramp->key, uitmp, 8) &&
+ memcmp(paramp->sa_key, uitmp, 8) &&
(prkey || rq_servact != MPATH_PROUT_REG_IGN_SA)) {
condlog(0, "%s: configured reservation key doesn't match: 0x%" PRIx64, alias, get_be64(mpp->reservation_key));
ret = MPATH_PR_SYNTAX_ERROR;
--
2024-02-05 16:52:45 +08:00
2.33.0
2021-11-23 21:49:34 +08:00