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