cb8e9e
From 306faa19df543fd00748e5ff01deba7898d94e89 Mon Sep 17 00:00:00 2001
cb8e9e
From: Ravishankar N <ravishankar@redhat.com>
cb8e9e
Date: Fri, 17 Jul 2015 16:04:01 +0530
cb8e9e
Subject: [PATCH 251/279] dht: send lookup even for fd based operations during rebalance
cb8e9e
cb8e9e
Patch in master: http://review.gluster.org/#/c/11713/
cb8e9e
Patch in release-3.7: http://review.gluster.org/#/c/11744/
cb8e9e
cb8e9e
Problem:
cb8e9e
dht_rebalance_inprogress_task() was not sending lookups to the
cb8e9e
destination subvolume for a file undergoing writes during rebalance. Due to
cb8e9e
this, afr was not able to populate the read_subvol and failed the write
cb8e9e
with EIO.
cb8e9e
cb8e9e
Fix:
cb8e9e
Send lookup for fd based operations as well.
cb8e9e
cb8e9e
Thanks to Raghavendra G for helping with the RCA.
cb8e9e
Change-Id: Ic450f2c72a6e39e53e0d6b458ab3bcaf13309f0b
cb8e9e
BUG: 1243542
cb8e9e
cb8e9e
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
cb8e9e
Change-Id: I24baf32dbf3d3b8aad535f04aa717d719956fa02
cb8e9e
Reviewed-on: https://code.engineering.redhat.com/gerrit/53818
cb8e9e
Reviewed-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
cb8e9e
Tested-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
cb8e9e
---
cb8e9e
 xlators/cluster/dht/src/dht-helper.c |   53 +++++++++++++++++++--------------
cb8e9e
 1 files changed, 30 insertions(+), 23 deletions(-)
cb8e9e
cb8e9e
diff --git a/xlators/cluster/dht/src/dht-helper.c b/xlators/cluster/dht/src/dht-helper.c
cb8e9e
index d8cc61d..2e4a53c 100644
cb8e9e
--- a/xlators/cluster/dht/src/dht-helper.c
cb8e9e
+++ b/xlators/cluster/dht/src/dht-helper.c
cb8e9e
@@ -992,7 +992,8 @@ dht_migration_complete_check_task (void *data)
cb8e9e
                 gf_msg (this->name, GF_LOG_ERROR, -ret,
cb8e9e
                         DHT_MSG_FILE_LOOKUP_FAILED,
cb8e9e
                         "%s: failed to lookup the file on %s",
cb8e9e
-                        tmp_loc.path, this->name);
cb8e9e
+                        tmp_loc.path ? tmp_loc.path : uuid_utoa (tmp_loc.gfid),
cb8e9e
+                        this->name);
cb8e9e
                 local->op_errno = -ret;
cb8e9e
                 ret = -1;
cb8e9e
                 goto out;
cb8e9e
@@ -1012,7 +1013,8 @@ dht_migration_complete_check_task (void *data)
cb8e9e
                         gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
                                 DHT_MSG_GFID_MISMATCH,
cb8e9e
                                 "%s: gfid different on the target file on %s",
cb8e9e
-                                tmp_loc.path, dst_node->name);
cb8e9e
+                                tmp_loc.path ? tmp_loc.path :
cb8e9e
+                                uuid_utoa (tmp_loc.gfid), dst_node->name);
cb8e9e
                 ret = -1;
cb8e9e
                 local->op_errno = EIO;
cb8e9e
                 goto out;
cb8e9e
@@ -1200,28 +1202,34 @@ dht_rebalance_inprogress_task (void *data)
cb8e9e
         local->rebalance.target_node = dst_node;
cb8e9e
 
cb8e9e
         if (local->loc.inode) {
cb8e9e
-                /* lookup on dst */
cb8e9e
-                ret = syncop_lookup (dst_node, &local->loc, &stbuf, NULL,
cb8e9e
-                                     NULL, NULL);
cb8e9e
-                if (ret) {
cb8e9e
-                        gf_msg (this->name, GF_LOG_ERROR, -ret,
cb8e9e
-                                DHT_MSG_FILE_LOOKUP_ON_DST_FAILED,
cb8e9e
-                                "%s: failed to lookup the file on %s",
cb8e9e
-                                local->loc.path, dst_node->name);
cb8e9e
-                        ret = -1;
cb8e9e
-                        goto out;
cb8e9e
-                }
cb8e9e
+                loc_copy (&tmp_loc, &local->loc);
cb8e9e
+        } else {
cb8e9e
+                tmp_loc.inode = inode_ref (inode);
cb8e9e
+                gf_uuid_copy (tmp_loc.gfid, inode->gfid);
cb8e9e
+        }
cb8e9e
 
cb8e9e
-                if (gf_uuid_compare (stbuf.ia_gfid, local->loc.inode->gfid)) {
cb8e9e
-                        gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
-                                DHT_MSG_GFID_MISMATCH,
cb8e9e
-                                "%s: gfid different on the target file on %s",
cb8e9e
-                                local->loc.path, dst_node->name);
cb8e9e
-                        ret = -1;
cb8e9e
-                        goto out;
cb8e9e
-                }
cb8e9e
+        /* lookup on dst */
cb8e9e
+        ret = syncop_lookup (dst_node, &tmp_loc, &stbuf, NULL,
cb8e9e
+                             NULL, NULL);
cb8e9e
+        if (ret) {
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, -ret,
cb8e9e
+                        DHT_MSG_FILE_LOOKUP_ON_DST_FAILED,
cb8e9e
+                        "%s: failed to lookup the file on %s",
cb8e9e
+                        tmp_loc.path ? tmp_loc.path : uuid_utoa (tmp_loc.gfid),
cb8e9e
+                        dst_node->name);
cb8e9e
+                ret = -1;
cb8e9e
+                goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
+        if (gf_uuid_compare (stbuf.ia_gfid, tmp_loc.inode->gfid)) {
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        DHT_MSG_GFID_MISMATCH,
cb8e9e
+                        "%s: gfid different on the target file on %s",
cb8e9e
+                        tmp_loc.path ? tmp_loc.path : uuid_utoa (tmp_loc.gfid),
cb8e9e
+                        dst_node->name);
cb8e9e
+                ret = -1;
cb8e9e
+                goto out;
cb8e9e
+        }
cb8e9e
         ret = 0;
cb8e9e
 
cb8e9e
         if (list_empty (&inode->fd_list))
cb8e9e
@@ -1232,7 +1240,6 @@ dht_rebalance_inprogress_task (void *data)
cb8e9e
          */
cb8e9e
         SYNCTASK_SETID (0, 0);
cb8e9e
 
cb8e9e
-        tmp_loc.inode = inode;
cb8e9e
         inode_path (inode, NULL, &path);
cb8e9e
         if (path)
cb8e9e
                 tmp_loc.path = path;
cb8e9e
@@ -1258,7 +1265,6 @@ dht_rebalance_inprogress_task (void *data)
cb8e9e
                         open_failed = 1;
cb8e9e
                 }
cb8e9e
         }
cb8e9e
-        GF_FREE (path);
cb8e9e
 
cb8e9e
         SYNCTASK_SETID (frame->root->uid, frame->root->gid);
cb8e9e
 
cb8e9e
@@ -1279,6 +1285,7 @@ done:
cb8e9e
 
cb8e9e
         ret = 0;
cb8e9e
 out:
cb8e9e
+        loc_wipe (&tmp_loc);
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
 
cb8e9e
-- 
cb8e9e
1.7.1
cb8e9e