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