Blob Blame History Raw
From 91e0dfb0aec0a2812f3396fe796050f21ee7722a Mon Sep 17 00:00:00 2001
From: Nithya Balachandran <nbalacha@dhcp35-62.lab.eng.blr.redhat.com>
Date: Wed, 11 Jan 2017 16:03:08 +0530
Subject: [PATCH 268/270] cluster/dht: Incorrect migration checks in fsync

Fixed the order of the migration phase checks
in dht_fsync_cbk. Phase1 should never be hit if op_ret
is non zero.

Upstream patches:
master: http://review.gluster.org/16350
release-3.8: http://review.gluster.org/#/c/16374/

Change-Id: Ie0179abcd70bd72cfc785fc87d9aef7293576f8d
BUG: 1410406
Signed-off-by: N Balachandran <nbalacha@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/94726
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
 xlators/cluster/dht/src/dht-inode-read.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/xlators/cluster/dht/src/dht-inode-read.c b/xlators/cluster/dht/src/dht-inode-read.c
index 549f1b9..8abf0d5 100644
--- a/xlators/cluster/dht/src/dht-inode-read.c
+++ b/xlators/cluster/dht/src/dht-inode-read.c
@@ -839,6 +839,12 @@ dht_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret,
         dht_set_local_rebalance (this, local, NULL, prebuf,
                                  postbuf, xdata);
 
+        if ((op_ret == -1) || IS_DHT_MIGRATION_PHASE2 (postbuf)) {
+                ret = dht_rebalance_complete_check (this, frame);
+                if (!ret)
+                        return 0;
+        }
+
         /* Check if the rebalance phase1 is true */
         if (IS_DHT_MIGRATION_PHASE1 (postbuf)) {
 
@@ -860,11 +866,6 @@ dht_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret,
                 }
         }
 
-        if (IS_DHT_MIGRATION_PHASE2 (postbuf)) {
-                ret = dht_rebalance_complete_check (this, frame);
-                if (!ret)
-                        return 0;
-        }
 
 out:
         DHT_STRIP_PHASE1_FLAGS (postbuf);
-- 
2.9.3