summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSanju Rakonde <srakonde@redhat.com>2019-02-04 15:07:14 +0530
committerAtin Mukherjee <amukherj@redhat.com>2019-02-05 14:40:25 +0000
commit90922d20f55e26b23bfab0fbc4e179e305c38037 (patch)
tree912264bbf362649b6f5dce9bdb43f19e897f726a
parenta9b51f2d1fd3a8be6496b62b989b6838b542936b (diff)
glusterd: get-state command should not fail if any brick is gone badv7dev
Problem: get-state command will error out, if any of the underlying brick(s) of volume(s) in the cluster go bad. It is expected that get-state command should not error out, but should generate an output successfully. Solution: In glusterd_get_state(), a statfs call is made on the brick path for every bricks of the volumes to calculate the total and free memory available. If any of statfs call fails on any brick, we should not error out and should report total memory and free memory of that brick as 0. This patch also handles a statfs failure scenario in glusterd_store_retrieve_bricks(). fixes: bz#1672205 Change-Id: Ia9e8a1d8843b65949d72fd6809bd21d39b31ad83 Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c9
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-store.c3
2 files changed, 7 insertions, 5 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index 614d34db670..f754b52e6fe 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -5779,12 +5779,13 @@ glusterd_get_state(rpcsvc_request_t *req, dict_t *dict)
if (ret) {
gf_msg(this->name, GF_LOG_ERROR, errno, GD_MSG_FILE_OP_FAILED,
"statfs error: %s ", strerror(errno));
- goto out;
+ memfree = 0;
+ memtotal = 0;
+ } else {
+ memfree = brickstat.f_bfree * brickstat.f_bsize;
+ memtotal = brickstat.f_blocks * brickstat.f_bsize;
}
- memfree = brickstat.f_bfree * brickstat.f_bsize;
- memtotal = brickstat.f_blocks * brickstat.f_bsize;
-
fprintf(fp, "Volume%d.Brick%d.spacefree: %" PRIu64 "Bytes\n",
count_bkp, count, memfree);
fprintf(fp, "Volume%d.Brick%d.spacetotal: %" PRIu64 "Bytes\n",
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c
index 124ca2741af..22190ef4195 100644
--- a/xlators/mgmt/glusterd/src/glusterd-store.c
+++ b/xlators/mgmt/glusterd/src/glusterd-store.c
@@ -2878,8 +2878,9 @@ glusterd_store_retrieve_bricks(glusterd_volinfo_t *volinfo)
brickinfo->path);
/* No need for treating it as an error, lets continue
with just a message */
+ } else {
+ brickinfo->statfs_fsid = brickstat.f_fsid;
}
- brickinfo->statfs_fsid = brickstat.f_fsid;
}
cds_list_add_tail(&brickinfo->brick_list, &volinfo->bricks);