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