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