summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaghavendra G <rgowdapp@redhat.com>2015-02-26 22:50:25 +0530
committerRaghavendra G <rgowdapp@redhat.com>2015-03-03 20:51:42 -0800
commitef061b67f1b80c147c1959b896f7c9bdff01af96 (patch)
tree870baf6de36dc65f1c8aed0fd865b4cca8903a22
parent95d5e60afb29aedc29909340e7564d54a6a247c2 (diff)
cluster/dht: Fixes to should_fix_layout logic
* With recent introduction of locking in self-heal codepath, fix layout was not allowed to progress during remove-brick. This patch fixes the issue. * dht_should_fix_layout also considers "dir-spread-count" option if set, to determine whether we should proceed with fix-layout or not. Change-Id: Icd96986f7af705744131d62e7f1456114ac1ee53 BUG: 1196615 Signed-off-by: Raghavendra G <rgowdapp@redhat.com> Reviewed-on: http://review.gluster.org/9764 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> Reviewed-by: N Balachandran <nbalacha@redhat.com>
-rw-r--r--xlators/cluster/dht/src/dht-selfheal.c44
1 files changed, 38 insertions, 6 deletions
diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c
index f4b0ceeade8..1583ee5c602 100644
--- a/xlators/cluster/dht/src/dht-selfheal.c
+++ b/xlators/cluster/dht/src/dht-selfheal.c
@@ -380,15 +380,41 @@ dht_layout_span (dht_layout_t *layout)
return count;
}
+int
+dht_decommissioned_bricks_in_layout (xlator_t *this, dht_layout_t *layout)
+{
+ dht_conf_t *conf = NULL;
+ int count = 0, i = 0, j = 0;
+
+ if ((this == NULL) || (layout == NULL))
+ goto out;
+
+ conf = this->private;
+
+ for (i = 0; i < layout->cnt; i++) {
+ for (j = 0; j < conf->subvolume_cnt; j++) {
+ if (conf->decommissioned_bricks[j] &&
+ conf->decommissioned_bricks[j]
+ == layout->list[i].xlator) {
+ count++;
+ }
+ }
+ }
+
+out:
+ return count;
+}
+
gf_boolean_t
dht_should_fix_layout (call_frame_t *frame, dht_layout_t **inmem,
dht_layout_t **ondisk)
{
- gf_boolean_t fixit = _gf_true;
- dht_local_t *local = NULL;
- int layout_span = 0;
- int ret = 0;
- dht_conf_t *conf = NULL;
+ gf_boolean_t fixit = _gf_true;
+ dht_local_t *local = NULL;
+ int layout_span = 0, decommissioned_bricks = 0;
+ int spread_count = 0;
+ int ret = 0;
+ dht_conf_t *conf = NULL;
conf = frame->this->private;
@@ -418,7 +444,13 @@ dht_should_fix_layout (call_frame_t *frame, dht_layout_t **inmem,
layout_span = dht_layout_span (*ondisk);
- if (layout_span == conf->subvolume_cnt)
+ decommissioned_bricks = dht_decommissioned_bricks_in_layout (frame->this,
+ *ondisk);
+ spread_count = conf->dir_spread_cnt ? conf->dir_spread_cnt
+ : conf->subvolume_cnt;
+
+ if ((decommissioned_bricks == 0) && (layout_span
+ == spread_count))
fixit = _gf_false;
out: