From 40318205bfcf75c6eee1c4c18f103260a77a7886 Mon Sep 17 00:00:00 2001 From: Sanju Rakonde Date: Mon, 5 Nov 2018 11:28:46 +0530 Subject: glusterd: initialise caps inside #ifdef HAVE_BD_XLATOR block Note: The problem is seen when we disable bd xlator. Problem: When we create a volume, volume info file is having caps value as 15 in nodes which hosts bricks for that volume. Remainig nodes in cluster are not having caps field. When glusterd is restarted, peers are going into rejected state, because of this mismacth in configuration files. Cause: In glusterd_op_create_volume(), we initialise caps value as 15 in the beginning. Later, we check whether brick belongs to the same node or not. If brick doesn't belong to the same node, caps value will be set to 0. If brick belongs to the same node, we will change the caps value inside Solution: If brick doesn't belongs to the same node,caps is set to 0 and if brick belongs to same brick caps value is changed inside #ifdef HAVE_BD_XLATOR block. So, to have the consistency across the cluster, we need to initialise caps value inside #ifdef HAVE_BD_XLATOR block, only when brick belongs to the same node. fixes: bz#1645986 Change-Id: I2648f420b21d6e69e7c38b0f4736d41e0f15a7f5 Signed-off-by: Sanju Rakonde --- xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'xlators') diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c index d65a1f9f977..10a477f7857 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c @@ -2471,7 +2471,6 @@ glusterd_op_create_volume(dict_t *dict, char **op_errstr) if (count) brick = strtok_r(brick_list + 1, " \n", &saveptr); - caps = CAPS_BD | CAPS_THIN | CAPS_OFFLOAD_COPY | CAPS_OFFLOAD_SNAPSHOT; brickid = glusterd_get_next_available_brickid(volinfo); if (brickid < 0) @@ -2521,6 +2520,8 @@ glusterd_op_create_volume(dict_t *dict, char **op_errstr) #ifdef HAVE_BD_XLATOR if (brickinfo->vg[0]) { + caps = CAPS_BD | CAPS_THIN | CAPS_OFFLOAD_COPY | + CAPS_OFFLOAD_SNAPSHOT; ret = glusterd_is_valid_vg(brickinfo, 0, msg); if (ret) { gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_INVALID_VG, "%s", @@ -2535,8 +2536,6 @@ glusterd_op_create_volume(dict_t *dict, char **op_errstr) caps = 0; } #endif - } else { - caps = 0; } cds_list_add_tail(&brickinfo->brick_list, &volinfo->bricks); -- cgit