summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorAshish Pandey <aspandey@redhat.com>2016-09-20 12:32:28 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2016-10-13 07:35:46 -0700
commit2f287ccec79ac8c3b0d808da4db0d661c99fa856 (patch)
tree4fd3d9ec3da5043ec1ca3cf2bbf50132439ef792 /libglusterfs
parentb07c5324161f2fda22d5903db61b9711cf949229 (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. >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> >Signed-off-by: Ashish Pandey <aspandey@redhat.com> Change-Id: I6361e2813ece369be12d02e74816df4eddb81cfa BUG: 1383913 Signed-off-by: Ashish Pandey <aspandey@redhat.com> Reviewed-on: http://review.gluster.org/15627 Smoke: Gluster Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Xavier Hernandez <xhernandez@datalab.es>
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/syncop-utils.c35
-rw-r--r--libglusterfs/src/syncop-utils.h4
2 files changed, 39 insertions, 0 deletions
diff --git a/libglusterfs/src/syncop-utils.c b/libglusterfs/src/syncop-utils.c
index 8f25db237f5..8c25dd1773a 100644
--- a/libglusterfs/src/syncop-utils.c
+++ b/libglusterfs/src/syncop-utils.c
@@ -591,3 +591,38 @@ out:
return ret;
}
+
+int
+syncop_inode_find (xlator_t *this, xlator_t *subvol,
+ uuid_t gfid, inode_t **inode,
+ dict_t *xdata, dict_t **rsp_dict)
+{
+ int ret = 0;
+ loc_t loc = {0, };
+ struct iatt iatt = {0, };
+ *inode = NULL;
+
+ *inode = inode_find (this->itable, gfid);
+ if (*inode)
+ goto out;
+
+ loc.inode = inode_new (this->itable);
+ if (!loc.inode) {
+ ret = -ENOMEM;
+ goto out;
+ }
+ gf_uuid_copy (loc.gfid, gfid);
+
+ ret = syncop_lookup (subvol, &loc, &iatt, NULL, xdata, rsp_dict);
+ if (ret < 0)
+ goto out;
+
+ *inode = inode_link (loc.inode, NULL, NULL, &iatt);
+ if (!*inode) {
+ ret = -ENOMEM;
+ goto out;
+ }
+out:
+ loc_wipe (&loc);
+ return ret;
+}
diff --git a/libglusterfs/src/syncop-utils.h b/libglusterfs/src/syncop-utils.h
index 3968d758c6e..4761371c120 100644
--- a/libglusterfs/src/syncop-utils.h
+++ b/libglusterfs/src/syncop-utils.h
@@ -43,4 +43,8 @@ syncop_ftw_throttle (xlator_t *subvol, loc_t *loc, int pid, void *data,
int (*fn) (xlator_t *subvol, gf_dirent_t *entry,
loc_t *parent, void *data),
int count, int sleep_time);
+int
+syncop_inode_find (xlator_t *this, xlator_t *subvol,
+ uuid_t gfid, inode_t **inode,
+ dict_t *xdata, dict_t **rsp_dict);
#endif /* _SYNCOP_H */