summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-self-heal-data.c
diff options
context:
space:
mode:
authorKrutika Dhananjay <kdhananj@redhat.com>2016-02-01 11:46:08 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2016-02-03 22:58:37 -0800
commitb8106d1127f034ffa88b5dd322c23a10e023b9b6 (patch)
treec6eb05975dc788c409044ca795bb962f5d764f24 /xlators/cluster/afr/src/afr-self-heal-data.c
parent11202e6c726f79ddf0e461338d7dce158733122e (diff)
cluster/afr: Fix heal-info slow response while IO is in progress
Now heal-info does an open() on the file being examined so that the client at some point sees open-fd count being > 1 and releases the eager-lock so that heal-info doesn't remain blocked forever until IO completes. Change-Id: Icc478098e2bc7234408728b54d8185102b3540dc BUG: 1297695 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com> Reviewed-on: http://review.gluster.org/13326 Reviewed-by: Ravishankar N <ravishankar@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-self-heal-data.c')
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-data.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-data.c b/xlators/cluster/afr/src/afr-self-heal-data.c
index 45b4c53dbaf..27d2849c158 100644
--- a/xlators/cluster/afr/src/afr-self-heal-data.c
+++ b/xlators/cluster/afr/src/afr-self-heal-data.c
@@ -798,31 +798,32 @@ out:
}
-static fd_t *
-afr_selfheal_data_open (xlator_t *this, inode_t *inode)
+int
+afr_selfheal_data_open (xlator_t *this, inode_t *inode, fd_t **fd)
{
- loc_t loc = {0,};
- int ret = 0;
- fd_t *fd = NULL;
+ int ret = 0;
+ fd_t *fd_tmp = NULL;
+ loc_t loc = {0,};
- fd = fd_create (inode, 0);
- if (!fd)
- return NULL;
+ fd_tmp = fd_create (inode, 0);
+ if (!fd_tmp)
+ return -ENOMEM;
loc.inode = inode_ref (inode);
gf_uuid_copy (loc.gfid, inode->gfid);
- ret = syncop_open (this, &loc, O_RDWR|O_LARGEFILE, fd, NULL, NULL);
- if (ret) {
- fd_unref (fd);
- fd = NULL;
+ ret = syncop_open (this, &loc, O_RDWR|O_LARGEFILE, fd_tmp, NULL, NULL);
+ if (ret < 0) {
+ fd_unref (fd_tmp);
+ loc_wipe (&loc);
+ goto out;
} else {
- fd_bind (fd);
+ fd_bind (fd_tmp);
}
- loc_wipe (&loc);
-
- return fd;
+ *fd = fd_tmp;
+out:
+ return ret;
}
int
@@ -835,9 +836,9 @@ afr_selfheal_data (call_frame_t *frame, xlator_t *this, inode_t *inode)
priv = this->private;
- fd = afr_selfheal_data_open (this, inode);
+ ret = afr_selfheal_data_open (this, inode, &fd);
if (!fd) {
- gf_msg_debug (this->name, 0, "%s: Failed to open",
+ gf_msg_debug (this->name, -ret, "%s: Failed to open",
uuid_utoa (inode->gfid));
return -EIO;
}