Blob Blame History Raw
From 4eef56dc01a9ab11d56f30dd29e2eb65c82cc01d Mon Sep 17 00:00:00 2001
From: Raghavendra G <rgowdapp@redhat.com>
Date: Wed, 4 Apr 2018 10:03:18 +0530
Subject: [PATCH 250/260] cluster/dht: act as passthrough for renames on single
 child DHT

Various synchronization present in dht_rename while handling
directories and files is necessary only if we have more than only one
child.

> Change-Id: Ie21ad419125504ca2f391b1ae2e5c1d166fee247
> fixes: bz#1563511
> Signed-off-by: Raghavendra G <rgowdapp@redhat.com>

upstream patch: https://review.gluster.org/19817/
Change-Id: Ie21ad419125504ca2f391b1ae2e5c1d166fee247
BUG: 1572087
fixes: bz#1572087
Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/137257
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Nithya Balachandran <nbalacha@redhat.com>
---
 xlators/cluster/dht/src/dht-rename.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/xlators/cluster/dht/src/dht-rename.c b/xlators/cluster/dht/src/dht-rename.c
index ca6b5f4..5a72c1f 100644
--- a/xlators/cluster/dht/src/dht-rename.c
+++ b/xlators/cluster/dht/src/dht-rename.c
@@ -1690,13 +1690,14 @@ int
 dht_rename (call_frame_t *frame, xlator_t *this,
             loc_t *oldloc, loc_t *newloc, dict_t *xdata)
 {
-        xlator_t    *src_cached = NULL;
-        xlator_t    *src_hashed = NULL;
-        xlator_t    *dst_cached = NULL;
-        xlator_t    *dst_hashed = NULL;
-        int          op_errno = -1;
-        int          ret = -1;
-        dht_local_t *local = NULL;
+        xlator_t    *src_cached             = NULL;
+        xlator_t    *src_hashed             = NULL;
+        xlator_t    *dst_cached             = NULL;
+        xlator_t    *dst_hashed             = NULL;
+        int          op_errno               = -1;
+        int          ret                    = -1;
+        dht_local_t *local                  = NULL;
+        dht_conf_t  *conf                   = NULL;
         char         gfid[GF_UUID_BUF_SIZE] = {0};
 
         VALIDATE_OR_GOTO (frame, err);
@@ -1704,6 +1705,13 @@ dht_rename (call_frame_t *frame, xlator_t *this,
         VALIDATE_OR_GOTO (oldloc, err);
         VALIDATE_OR_GOTO (newloc, err);
 
+        conf = this->private;
+
+        if (conf->subvolume_cnt == 1) {
+                default_rename (frame, this, oldloc, newloc, xdata);
+                return 0;
+        }
+
         gf_uuid_unparse(oldloc->inode->gfid, gfid);
 
         src_hashed = dht_subvol_get_hashed (this, oldloc);
-- 
1.8.3.1