From c57895242fff0c05a24f99273f25cd793336f08d Mon Sep 17 00:00:00 2001 From: Ravishankar N Date: Thu, 17 Jul 2014 08:30:52 +0000 Subject: glusterd: update volinfo->subvol_count during remove-brick operation. Problem: In glusterd_op_remove_brick(), volinfo->subvol_count was getting updated only if the replica count was reduced due to which subvol_matcher_verify() gave false errors under certain scenarios (see bug description). Fix: updated subvol_count for every remove-brick operation. Change-Id: Id72691e2bda1c624cd7d8cae92f6bf32c101a6d3 BUG: 1120647 Signed-off-by: Ravishankar N Reviewed-on: http://review.gluster.org/8326 Tested-by: Gluster Build System Reviewed-by: Atin Mukherjee Reviewed-by: Kaushal M --- tests/bugs/bug-1120647.t | 17 +++++++++++++++++ xlators/mgmt/glusterd/src/glusterd-brick-ops.c | 4 ++-- 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 tests/bugs/bug-1120647.t diff --git a/tests/bugs/bug-1120647.t b/tests/bugs/bug-1120647.t new file mode 100644 index 00000000000..4670faa79d4 --- /dev/null +++ b/tests/bugs/bug-1120647.t @@ -0,0 +1,17 @@ +#!/bin/bash + +. $(dirname $0)/../include.rc +. $(dirname $0)/../volume.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 replica 2 $H0:$B0/brick{1..4} +TEST $CLI volume start $V0 +TEST $CLI volume remove-brick $V0 $H0:$B0/brick{3..4} start +EXPECT_WITHIN 10 "completed" remove_brick_status_completed_field "$V0 $H0:$B0/brick{3..4}" +TEST $CLI volume remove-brick $V0 $H0:$B0/brick{3..4} commit +TEST $CLI volume remove-brick $V0 replica 1 $H0:$B0/brick2 force + +cleanup; diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c index 089c7d637c9..efaefe7b761 100644 --- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c @@ -2004,6 +2004,8 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr) if (GF_OP_CMD_START == cmd) volinfo->rebal.dict = dict_ref (bricks_dict); + volinfo->subvol_count = (volinfo->brick_count / + volinfo->dist_leaf_count); ret = dict_get_int32 (dict, "replica-count", &replica_count); if (!ret) { gf_log (this->name, GF_LOG_INFO, @@ -2013,8 +2015,6 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr) volinfo->replica_count = replica_count; volinfo->sub_count = replica_count; volinfo->dist_leaf_count = glusterd_get_dist_leaf_count (volinfo); - volinfo->subvol_count = (volinfo->brick_count / - volinfo->dist_leaf_count); if (replica_count == 1) { if (volinfo->type == GF_CLUSTER_TYPE_REPLICATE) { -- cgit