From 6f0e5b363c50611c67a263577cb1a7666d2b147a Mon Sep 17 00:00:00 2001
From: Joseph Fernandes <josferna@redhat.com>
Date: Mon, 2 May 2016 16:20:30 +0530
Subject: [PATCH 134/139] tier/detach : During detach check if background fixlayout is done
During detach check if background fixlayout is done, if not done ignore
the case and continue detach.
Backport of http://review.gluster.org/14147
> Change-Id: I5d5cfc0e73d0eb217fdeab54c432dc4af8bc598d
> BUG: 1332136
> Signed-off-by: Joseph Fernandes <josferna@redhat.com>
> Reviewed-on: http://review.gluster.org/14147
> Smoke: Gluster Build System <jenkins@build.gluster.com>
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
> CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
> Reviewed-by: N Balachandran <nbalacha@redhat.com>
> Reviewed-by: Dan Lambright <dlambrig@redhat.com>
>Signed-off-by: Joseph Fernandes <josferna@redhat.com>
Change-Id: I9cef203e3f0adaac33103d93bac41fdaf37d6f2f
BUG: 1332957
Signed-off-by: Joseph Fernandes <josferna@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/73821
Reviewed-by: Dan Lambright <dlambrig@redhat.com>
Tested-by: Dan Lambright <dlambrig@redhat.com>
---
xlators/cluster/dht/src/dht-rebalance.c | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
index f41aa22..abdb8eb 100644
--- a/xlators/cluster/dht/src/dht-rebalance.c
+++ b/xlators/cluster/dht/src/dht-rebalance.c
@@ -3350,7 +3350,20 @@ out:
int
gf_tier_clear_fix_layout (xlator_t *this, loc_t *loc, gf_defrag_info_t *defrag)
{
- int ret = -1;
+ int ret = -1;
+ dict_t *dict = NULL;
+
+ /* Check if background fixlayout is completed. */
+ ret = syncop_getxattr (this, loc, &dict,
+ GF_XATTR_TIER_LAYOUT_FIXED_KEY, NULL, NULL);
+ if (ret) {
+ /* Background fixlayout not complete - nothing to clear*/
+ gf_log (this->name, GF_LOG_WARNING,
+ "Unable to retrieve fixlayout xattr."
+ "Assume background fix layout not complete");
+ ret = 0;
+ goto out;
+ }
ret = syncop_removexattr (this, loc, GF_XATTR_TIER_LAYOUT_FIXED_KEY,
NULL, NULL);
@@ -3364,6 +3377,8 @@ gf_tier_clear_fix_layout (xlator_t *this, loc_t *loc, gf_defrag_info_t *defrag)
}
ret = 0;
out:
+ if (dict)
+ dict_unref (dict);
return ret;
}
--
1.7.1