From d129d4eea33aae5db24dba17adcb04e9d4829817 Mon Sep 17 00:00:00 2001 From: Atin Mukherjee Date: Mon, 11 Apr 2016 16:07:40 +0530 Subject: glusterd: populate brickinfo->real_path conditionally glusterd_brickinfo_new_from_brick () is called from multiple places and one of them is glusterd_brick_rpc_notify where its very well possible that an underlying brick's file system has crashed and a disconnect event has been received. In this case glusterd tries to build the brickinfo from the brickid in the RPC request, however the same fails as glusterd_brickinfo_new_from_brick () fails from realpath. Fix is to skip populating real_path if its a disconnect event. Change-Id: I9d9149c64a9cf2247abb731f219c1b1eef037960 BUG: 1325841 Signed-off-by: Atin Mukherjee Reviewed-on: http://review.gluster.org/13965 Smoke: Gluster Build System CentOS-regression: Gluster Build System NetBSD-regression: NetBSD Build System Reviewed-by: Jeff Darcy --- xlators/mgmt/glusterd/src/glusterd-brick-ops.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-brick-ops.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c index 920f7f05623..b6d9703591c 100644 --- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c @@ -1034,7 +1034,8 @@ __glusterd_handle_remove_brick (rpcsvc_request_t *req) " %s", i, brick); ret = glusterd_volume_brickinfo_get_by_brick(brick, volinfo, - &brickinfo); + &brickinfo, + _gf_true); if (ret) { snprintf (err_str, sizeof (err_str), "Incorrect brick " @@ -1274,7 +1275,8 @@ glusterd_op_perform_add_bricks (glusterd_volinfo_t *volinfo, int32_t count, if (brickid < 0) goto out; while ( i <= count) { - ret = glusterd_brickinfo_new_from_brick (brick, &brickinfo); + ret = glusterd_brickinfo_new_from_brick (brick, &brickinfo, + _gf_true); if (ret) goto out; @@ -1381,7 +1383,8 @@ glusterd_op_perform_add_bricks (glusterd_volinfo_t *volinfo, int32_t count, while (i <= count) { ret = glusterd_volume_brickinfo_get_by_brick (brick, volinfo, - &brickinfo); + &brickinfo, + _gf_true); if (ret) goto out; #ifdef HAVE_BD_XLATOR @@ -1484,7 +1487,8 @@ glusterd_op_perform_remove_brick (glusterd_volinfo_t *volinfo, char *brick, GF_ASSERT (priv); ret = glusterd_volume_brickinfo_get_by_brick (brick, volinfo, - &brickinfo); + &brickinfo, + _gf_true); if (ret) goto out; @@ -1699,7 +1703,8 @@ glusterd_op_stage_add_brick (dict_t *dict, char **op_errstr, dict_t *rsp_dict) } - ret = glusterd_brickinfo_new_from_brick (brick, &brickinfo); + ret = glusterd_brickinfo_new_from_brick (brick, &brickinfo, + _gf_true); if (ret) { gf_msg (THIS->name, GF_LOG_ERROR, 0, GD_MSG_BRICK_NOT_FOUND, @@ -1822,7 +1827,8 @@ glusterd_remove_brick_validate_bricks (gf1_op_commands cmd, int32_t brick_count, ret = glusterd_volume_brickinfo_get_by_brick(brick, volinfo, - &brickinfo); + &brickinfo, + _gf_true); if (ret) { snprintf (msg, sizeof (msg), "Incorrect brick " "%s for volume %s", brick, volinfo->volname); -- cgit