summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht
diff options
context:
space:
mode:
authorJoseph Fernandes <josferna@redhat.com>2016-05-02 16:20:30 +0530
committerDan Lambright <dlambrig@redhat.com>2016-05-06 05:46:55 -0700
commitabd27041ebcb3c6ee897ad253fc248e3bb1823e6 (patch)
treef740ded67c46aeb1f239dd86b97248cbf4b08897 /xlators/cluster/dht
parent4b2b9a971e09b0c17018f4a5dd24fa7d64e94bf5 (diff)
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. 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>
Diffstat (limited to 'xlators/cluster/dht')
-rw-r--r--xlators/cluster/dht/src/dht-rebalance.c17
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 d4ca6e0c2b5..0a84f2a74c2 100644
--- a/xlators/cluster/dht/src/dht-rebalance.c
+++ b/xlators/cluster/dht/src/dht-rebalance.c
@@ -3388,7 +3388,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);
@@ -3402,6 +3415,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;
}