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