|
|
74b1de |
From 9be255f76c78fcbbda1e3a72eb2e99d3aface53e Mon Sep 17 00:00:00 2001
|
|
|
74b1de |
From: Sanju Rakonde <srakonde@redhat.com>
|
|
|
74b1de |
Date: Wed, 16 Oct 2019 23:26:03 +0530
|
|
|
74b1de |
Subject: [PATCH 322/335] glusterd: display correct rebalance data size after
|
|
|
74b1de |
glusterd restart
|
|
|
74b1de |
|
|
|
74b1de |
Problem: After completion of rebalance, if glusterd is restarted,
|
|
|
74b1de |
rebalance status displays wrong rebalance data size in its output.
|
|
|
74b1de |
|
|
|
74b1de |
Cause: While glusterd restoring the information from /var/lib/glusterd/
|
|
|
74b1de |
into its memory, glusterd fetches rebalance_data from
|
|
|
74b1de |
/var/lib/glusterd/vols/volname/node_state.info. This value is
|
|
|
74b1de |
converted into an integer using atoi(), which is returning
|
|
|
74b1de |
incorrect value for larger values.
|
|
|
74b1de |
|
|
|
74b1de |
Solution: use sscanf() instead of atoi() to convert string to
|
|
|
74b1de |
integer(in this case it is unsigned long)
|
|
|
74b1de |
|
|
|
74b1de |
> upstream patch: https://review.gluster.org/#/c/glusterfs/+/23560/
|
|
|
74b1de |
> fixes: bz#1762438
|
|
|
74b1de |
> Change-Id: Icbdb096919612b4a1d6fb0e315f09d38900abf4e
|
|
|
74b1de |
> Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
|
|
|
74b1de |
|
|
|
74b1de |
BUG: 1761486
|
|
|
74b1de |
Change-Id: Icbdb096919612b4a1d6fb0e315f09d38900abf4e
|
|
|
74b1de |
Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
|
|
|
74b1de |
Reviewed-on: https://code.engineering.redhat.com/gerrit/185752
|
|
|
74b1de |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
74b1de |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
74b1de |
---
|
|
|
74b1de |
xlators/mgmt/glusterd/src/glusterd-store.c | 10 +++++-----
|
|
|
74b1de |
1 file changed, 5 insertions(+), 5 deletions(-)
|
|
|
74b1de |
|
|
|
74b1de |
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c
|
|
|
74b1de |
index 8a10eb8..b3b5ee9 100644
|
|
|
74b1de |
--- a/xlators/mgmt/glusterd/src/glusterd-store.c
|
|
|
74b1de |
+++ b/xlators/mgmt/glusterd/src/glusterd-store.c
|
|
|
74b1de |
@@ -2974,19 +2974,19 @@ glusterd_store_retrieve_node_state(glusterd_volinfo_t *volinfo)
|
|
|
74b1de |
volinfo->rebal.op = atoi(value);
|
|
|
74b1de |
} else if (!strncmp(key, GLUSTERD_STORE_KEY_VOL_DEFRAG_REB_FILES,
|
|
|
74b1de |
SLEN(GLUSTERD_STORE_KEY_VOL_DEFRAG_REB_FILES))) {
|
|
|
74b1de |
- volinfo->rebal.rebalance_files = atoi(value);
|
|
|
74b1de |
+ sscanf(value, "%" PRIu64, &volinfo->rebal.rebalance_files);
|
|
|
74b1de |
} else if (!strncmp(key, GLUSTERD_STORE_KEY_VOL_DEFRAG_SIZE,
|
|
|
74b1de |
SLEN(GLUSTERD_STORE_KEY_VOL_DEFRAG_SIZE))) {
|
|
|
74b1de |
- volinfo->rebal.rebalance_data = atoi(value);
|
|
|
74b1de |
+ sscanf(value, "%" PRIu64, &volinfo->rebal.rebalance_data);
|
|
|
74b1de |
} else if (!strncmp(key, GLUSTERD_STORE_KEY_VOL_DEFRAG_SCANNED,
|
|
|
74b1de |
SLEN(GLUSTERD_STORE_KEY_VOL_DEFRAG_SCANNED))) {
|
|
|
74b1de |
- volinfo->rebal.lookedup_files = atoi(value);
|
|
|
74b1de |
+ sscanf(value, "%" PRIu64, &volinfo->rebal.lookedup_files);
|
|
|
74b1de |
} else if (!strncmp(key, GLUSTERD_STORE_KEY_VOL_DEFRAG_FAILURES,
|
|
|
74b1de |
SLEN(GLUSTERD_STORE_KEY_VOL_DEFRAG_FAILURES))) {
|
|
|
74b1de |
- volinfo->rebal.rebalance_failures = atoi(value);
|
|
|
74b1de |
+ sscanf(value, "%" PRIu64, &volinfo->rebal.rebalance_failures);
|
|
|
74b1de |
} else if (!strncmp(key, GLUSTERD_STORE_KEY_VOL_DEFRAG_SKIPPED,
|
|
|
74b1de |
SLEN(GLUSTERD_STORE_KEY_VOL_DEFRAG_SKIPPED))) {
|
|
|
74b1de |
- volinfo->rebal.skipped_files = atoi(value);
|
|
|
74b1de |
+ sscanf(value, "%" PRIu64, &volinfo->rebal.skipped_files);
|
|
|
74b1de |
} else if (!strncmp(key, GLUSTERD_STORE_KEY_VOL_DEFRAG_RUN_TIME,
|
|
|
74b1de |
SLEN(GLUSTERD_STORE_KEY_VOL_DEFRAG_RUN_TIME))) {
|
|
|
74b1de |
volinfo->rebal.rebalance_time = atoi(value);
|
|
|
74b1de |
--
|
|
|
74b1de |
1.8.3.1
|
|
|
74b1de |
|