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