74b1de
From 92aadb6a5eeec75edf7f5a11a0ebd861dd85ca6b Mon Sep 17 00:00:00 2001
74b1de
From: N Balachandran <nbalacha@redhat.com>
74b1de
Date: Mon, 20 May 2019 15:23:42 +0530
74b1de
Subject: [PATCH 148/169] cluster/dht: Lookup all files when processing
74b1de
 directory
74b1de
74b1de
A rebalance process currently only looks up files
74b1de
that it is supposed to migrate. This could cause issues
74b1de
when lookup-optimize is enabled as the dir layout can be
74b1de
updated with the commit hash before all files are looked up.
74b1de
This is expecially problematic if one of the rebalance processes
74b1de
fails to complete as clients will try to access files whose
74b1de
linkto files might not have been created.
74b1de
Each process will now lookup every file in the directory it is
74b1de
processing.
74b1de
Pros: Less likely that files will be inaccessible.
74b1de
Cons: More lookup requests sent to the bricks and a potential
74b1de
performance hit.
74b1de
Note: this does not handle races such as when a layout is updated on disk
74b1de
just as the create fop is sent by the client.
74b1de
74b1de
upstream : https://review.gluster.org/#/c/glusterfs/+/22746/
74b1de
74b1de
>Change-Id: I22b55846effc08d3b827c3af9335229335f67fb8
74b1de
>fixes: bz#1711764
74b1de
74b1de
BUG#1714124
74b1de
74b1de
Change-Id: Ica6a9459befe53957f080001a2dda525b3b14d1c
74b1de
Signed-off-by: N Balachandran <nbalacha@redhat.com>
74b1de
Reviewed-on: https://code.engineering.redhat.com/gerrit/172080
74b1de
Tested-by: RHGS Build Bot <nigelb@redhat.com>
74b1de
Reviewed-by: Mohit Agrawal <moagrawa@redhat.com>
74b1de
---
74b1de
 xlators/cluster/dht/src/dht-rebalance.c | 12 ++++++------
74b1de
 1 file changed, 6 insertions(+), 6 deletions(-)
74b1de
74b1de
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
74b1de
index efbe8a4..559f046 100644
74b1de
--- a/xlators/cluster/dht/src/dht-rebalance.c
74b1de
+++ b/xlators/cluster/dht/src/dht-rebalance.c
74b1de
@@ -2741,12 +2741,6 @@ gf_defrag_migrate_single_file(void *opaque)
74b1de
         goto out;
74b1de
     }
74b1de
 
74b1de
-    if (!gf_defrag_should_i_migrate(this, rebal_entry->local_subvol_index,
74b1de
-                                    entry->d_stat.ia_gfid)) {
74b1de
-        gf_msg_debug(this->name, 0, "Don't migrate %s ", entry_loc.path);
74b1de
-        goto out;
74b1de
-    }
74b1de
-
74b1de
     gf_uuid_copy(entry_loc.gfid, entry->d_stat.ia_gfid);
74b1de
 
74b1de
     gf_uuid_copy(entry_loc.pargfid, loc->gfid);
74b1de
@@ -2772,6 +2766,12 @@ gf_defrag_migrate_single_file(void *opaque)
74b1de
         goto out;
74b1de
     }
74b1de
 
74b1de
+    if (!gf_defrag_should_i_migrate(this, rebal_entry->local_subvol_index,
74b1de
+                                    entry->d_stat.ia_gfid)) {
74b1de
+        gf_msg_debug(this->name, 0, "Don't migrate %s ", entry_loc.path);
74b1de
+        goto out;
74b1de
+    }
74b1de
+
74b1de
     iatt_ptr = &iat;;
74b1de
 
74b1de
     hashed_subvol = dht_subvol_get_hashed(this, &entry_loc);
74b1de
-- 
74b1de
1.8.3.1
74b1de