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