summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-common.c
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2014-08-13 11:11:17 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2014-08-22 02:31:57 -0700
commit3b70b160a46b22b77a8ad1897440ec1346795a0f (patch)
tree5aa5047d58491c5fd6f97e5eab9e59df359608a9 /xlators/cluster/afr/src/afr-common.c
parent60f12dfbc87818831a65ac80ad8ba2fe166a29e2 (diff)
cluster/afr: Perform gfid heal inside locks.
Problem: Allowing lookup with 'gfid-req' will lead to assigning gfid at posix layer. When two mounts perform lookup in parallel that can lead to both bricks getting different gfids leading to gfid-mismatch/EIO for the lookup. Fix: Perform gfid heal inside lock. BUG: 1129529 Change-Id: I20c6c5e25ee27eeb906bff2f4c8ad0da18d00090 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/8512 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-common.c')
-rw-r--r--xlators/cluster/afr/src/afr-common.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index 8fc202512f1..cc7df9a3ea6 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -1443,7 +1443,8 @@ afr_lookup_selfheal_wrap (void *opaque)
local = frame->local;
this = frame->this;
- afr_selfheal_name (frame->this, local->loc.pargfid, local->loc.name);
+ afr_selfheal_name (frame->this, local->loc.pargfid, local->loc.name,
+ &local->cont.lookup.gfid_req);
afr_replies_wipe (local, this->private);
@@ -1477,6 +1478,10 @@ afr_lookup_entry_heal (call_frame_t *frame, xlator_t *this)
if (!replies[i].valid)
continue;
+ if ((replies[i].op_ret == -1) &&
+ (replies[i].op_errno == ENODATA))
+ need_heal = _gf_true;
+
if (first == -1) {
first = i;
continue;
@@ -1842,8 +1847,12 @@ afr_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xattr_req)
afr_local_t *local = NULL;
int32_t op_errno = 0;
int event = 0;
+ void *gfid_req = NULL;
+ int ret = 0;
- if (!loc->parent) {
+ if (!loc->parent && uuid_is_null (loc->pargfid)) {
+ if (xattr_req)
+ dict_del (xattr_req, "gfid-req");
afr_discover (frame, this, loc, xattr_req);
return 0;
}
@@ -1870,10 +1879,16 @@ afr_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xattr_req)
local->inode = inode_ref (loc->inode);
- if (xattr_req)
+ if (xattr_req) {
/* If xattr_req was null, afr_lookup_xattr_req_prepare() will
allocate one for us */
+ ret = dict_get_ptr (xattr_req, "gfid-req", &gfid_req);
+ if (ret == 0) {
+ uuid_copy (local->cont.lookup.gfid_req, gfid_req);
+ dict_del (xattr_req, "gfid-req");
+ }
local->xattr_req = dict_ref (xattr_req);
+ }
afr_read_subvol_get (loc->parent, this, NULL, &event,
AFR_DATA_TRANSACTION);