d1681e
From 90dc8d7cee42eeacc3214fef8bb45cbffc4c8de5 Mon Sep 17 00:00:00 2001
d1681e
From: N Balachandran <nbalacha@redhat.com>
d1681e
Date: Mon, 19 Feb 2018 09:44:29 +0530
d1681e
Subject: [PATCH 162/180] cluster/dht: Handle single dht child in dht_lookup
d1681e
d1681e
This patch limits itself to only handling the case
d1681e
where no file (data or linkto) exists on the subvol.
d1681e
d1681e
Additional cases to be handled:
d1681e
1. A linkto file was found on the only child subvol. This currently
d1681e
calls dht_lookup_everywhere which eventually deletes it. It can be
d1681e
deleted directly as it will not be pointing to a valid subvol.
d1681e
2. Directory lookups - locking might be unnecessary in some cases.
d1681e
d1681e
upstream patch: https://review.gluster.org/19581
d1681e
d1681e
> Change-Id: I940ba34531f2aaee1d36fd9ca45ecfd46be662a4
d1681e
> BUG: 1546620
d1681e
> Signed-off-by: N Balachandran <nbalacha@redhat.com>
d1681e
d1681e
Change-Id: I1cc1b9866fa18fe825847585e6a9b8c92898951a
d1681e
BUG: 1545570
d1681e
Signed-off-by: N Balachandran <nbalacha@redhat.com>
d1681e
Reviewed-on: https://code.engineering.redhat.com/gerrit/130976
d1681e
Tested-by: RHGS Build Bot <nigelb@redhat.com>
d1681e
Reviewed-by: Shyam Ranganathan <srangana@redhat.com>
d1681e
---
d1681e
 xlators/cluster/dht/src/dht-common.c | 12 ++++++++++++
d1681e
 1 file changed, 12 insertions(+)
d1681e
d1681e
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
d1681e
index 1262732..5641330 100644
d1681e
--- a/xlators/cluster/dht/src/dht-common.c
d1681e
+++ b/xlators/cluster/dht/src/dht-common.c
d1681e
@@ -2352,6 +2352,12 @@ dht_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
d1681e
         }
d1681e
 
d1681e
         if (ENTRY_MISSING (op_ret, op_errno)) {
d1681e
+
d1681e
+                if (1 == conf->subvolume_cnt) {
d1681e
+                        /* No need to lookup again */
d1681e
+                        goto out;
d1681e
+                }
d1681e
+
d1681e
                 gf_msg_debug (this->name, 0,
d1681e
                               "Entry %s missing on subvol %s",
d1681e
                               loc->path, prev->name);
d1681e
@@ -2581,6 +2587,8 @@ dht_lookup (call_frame_t *frame, xlator_t *this,
d1681e
                 local->xattr_req = dict_new ();
d1681e
         }
d1681e
 
d1681e
+        /* Nameless lookup */
d1681e
+
d1681e
         if (gf_uuid_is_null (loc->pargfid) && !gf_uuid_is_null (loc->gfid) &&
d1681e
             !__is_root_gfid (loc->inode->gfid)) {
d1681e
                 local->cached_subvol = NULL;
d1681e
@@ -2598,6 +2606,9 @@ dht_lookup (call_frame_t *frame, xlator_t *this,
d1681e
                 hashed_subvol = dht_subvol_get_hashed (this, loc);
d1681e
         local->hashed_subvol = hashed_subvol;
d1681e
 
d1681e
+
d1681e
+        /* The entry has been looked up before and has an inode_ctx set
d1681e
+         */
d1681e
         if (is_revalidate (loc)) {
d1681e
                 layout = local->layout;
d1681e
                 if (!layout) {
d1681e
@@ -2638,6 +2649,7 @@ dht_lookup (call_frame_t *frame, xlator_t *this,
d1681e
                                 "path %s", conf->xattr_name, loc->path);
d1681e
                         goto err;
d1681e
                 }
d1681e
+
d1681e
                 /* need it in case file is not found on cached file
d1681e
                  * on revalidate path and we may encounter linkto files on
d1681e
                  * with dht_lookup_everywhere*/
d1681e
-- 
d1681e
1.8.3.1
d1681e