summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht
diff options
context:
space:
mode:
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;
}