From 6e8f7bb6ab457cfee42e405243cf4db82a9a56b8 Mon Sep 17 00:00:00 2001 From: Sanju Rakonde Date: Tue, 30 Oct 2018 16:36:50 +0530 Subject: glusterd: set fsid while performing replace brick While performing the replace-brick operation, we should set fsid value to the new brick. fixes: bz#1637196 Change-Id: I9e9a4962fc0c2f5dff43e4ac11767814a0c0beaf Signed-off-by: Sanju Rakonde --- xlators/mgmt/glusterd/src/glusterd-replace-brick.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'xlators/mgmt/glusterd/src/glusterd-replace-brick.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c index 1248910990f..4c0982e87e2 100644 --- a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c +++ b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c @@ -347,6 +347,9 @@ glusterd_op_perform_replace_brick(glusterd_volinfo_t *volinfo, char *old_brick, int32_t ret = -1; xlator_t *this = NULL; glusterd_conf_t *conf = NULL; + struct statvfs brickstat = { + 0, + }; this = THIS; GF_ASSERT(this); @@ -365,6 +368,21 @@ glusterd_op_perform_replace_brick(glusterd_volinfo_t *volinfo, char *old_brick, if (ret) goto out; + if (!gf_uuid_compare(new_brickinfo->uuid, MY_UUID)) { + ret = sys_statvfs(new_brickinfo->path, &brickstat); + if (ret) { + gf_msg(this->name, GF_LOG_ERROR, errno, GD_MSG_STATVFS_FAILED, + "Failed to fetch disk utilization " + "from the brick (%s:%s). Please check the health of " + "the brick. Error code was %s", + new_brickinfo->hostname, new_brickinfo->path, + strerror(errno)); + + goto out; + } + new_brickinfo->statfs_fsid = brickstat.f_fsid; + } + ret = glusterd_volume_brickinfo_get_by_brick(old_brick, volinfo, &old_brickinfo, _gf_false); if (ret) -- cgit