summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src
diff options
context:
space:
mode:
authorAshish Pandey <aspandey@redhat.com>2016-09-20 12:32:28 +0530
committerXavier Hernandez <xhernandez@datalab.es>2016-10-11 02:29:27 -0700
commit0fed7e7f0aad9973900c89434f736797d9ace2bd (patch)
treeb7e02dfd5c6e21a29b5fe122bf911b10c42a611c /xlators/cluster/afr/src
parent85e959052148ec481823d55c8b91cdee36da2b43 (diff)
cluster/ec: Implement heal info with lock
Problem: Currently heal info command prints all the files/directories if the index for the file/directory is present in .glusterfs/indices folder. After implementing patch http://review.gluster.org/#/c/13733/ indices of the file which is going through update fop will also be present in .glusterfs/indices even if the fop is successful on all the brick. At this time if heal info command is being used, it will also display this file which is actually healthy and does not require any heal. Solution: Take lock on a file corresponding to the indices and inspect xattrs to decide if the file needs heal or not. Change-Id: I6361e2813ece369be12d02e74816df4eddb81cfa BUG: 1366815 Signed-off-by: Ashish Pandey <aspandey@redhat.com> Reviewed-on: http://review.gluster.org/15543 NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Reviewed-by: Xavier Hernandez <xhernandez@datalab.es> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/cluster/afr/src')
-rw-r--r--xlators/cluster/afr/src/afr-self-heald.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heald.c b/xlators/cluster/afr/src/afr-self-heald.c
index 8a3a5521409..e1a40521709 100644
--- a/xlators/cluster/afr/src/afr-self-heald.c
+++ b/xlators/cluster/afr/src/afr-self-heald.c
@@ -153,22 +153,11 @@ unlock:
inode_t *
afr_shd_inode_find (xlator_t *this, xlator_t *subvol, uuid_t gfid)
{
- int ret = 0;
- uint64_t val = IA_INVAL;
- loc_t loc = {0, };
+ int ret = 0;
+ uint64_t val = IA_INVAL;
dict_t *xdata = NULL;
dict_t *rsp_dict = NULL;
- inode_t *inode = NULL;
- struct iatt iatt = {0, };
-
- inode = inode_find (this->itable, gfid);
- if (inode)
- goto out;
-
- loc.inode = inode_new (this->itable);
- if (!loc.inode)
- goto out;
- gf_uuid_copy (loc.gfid, gfid);
+ inode_t *inode = NULL;
xdata = dict_new ();
if (!xdata)
@@ -178,7 +167,8 @@ afr_shd_inode_find (xlator_t *this, xlator_t *subvol, uuid_t gfid)
if (ret)
goto out;
- ret = syncop_lookup (subvol, &loc, &iatt, NULL, xdata, &rsp_dict);
+ ret = syncop_inode_find (this, subvol, gfid, &inode,
+ xdata, &rsp_dict);
if (ret < 0)
goto out;
@@ -188,15 +178,16 @@ afr_shd_inode_find (xlator_t *this, xlator_t *subvol, uuid_t gfid)
if (ret)
goto out;
}
-
- inode = inode_link (loc.inode, NULL, NULL, &iatt);
ret = inode_ctx_set2 (inode, subvol, 0, &val);
out:
+ if (ret && inode) {
+ inode_unref (inode);
+ inode = NULL;
+ }
if (xdata)
dict_unref (xdata);
if (rsp_dict)
dict_unref (rsp_dict);
- loc_wipe (&loc);
return inode;
}