From 0fed7e7f0aad9973900c89434f736797d9ace2bd Mon Sep 17 00:00:00 2001 From: Ashish Pandey Date: Tue, 20 Sep 2016 12:32:28 +0530 Subject: 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 Reviewed-on: http://review.gluster.org/15543 NetBSD-regression: NetBSD Build System Reviewed-by: Pranith Kumar Karampuri Reviewed-by: Xavier Hernandez CentOS-regression: Gluster Build System Smoke: Gluster Build System --- xlators/cluster/ec/src/ec.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'xlators/cluster/ec/src/ec.c') diff --git a/xlators/cluster/ec/src/ec.c b/xlators/cluster/ec/src/ec.c index dff5a784b2b..e10de4e38aa 100644 --- a/xlators/cluster/ec/src/ec.c +++ b/xlators/cluster/ec/src/ec.c @@ -806,13 +806,11 @@ ec_handle_heal_commands (call_frame_t *frame, xlator_t *this, loc_t *loc, if (!name || strcmp (name, GF_HEAL_INFO)) return -1; - dict_rsp = dict_new (); - if (dict_rsp == NULL) - goto out; + op_errno = -ec_get_heal_info (this, loc, &dict_rsp); + if (op_errno <= 0) { + op_errno = op_ret = 0; + } - if (dict_set_str (dict_rsp, "heal-info", "heal") == 0) - op_ret = 0; -out: STACK_UNWIND_STRICT (getxattr, frame, op_ret, op_errno, dict_rsp, NULL); if (dict_rsp) dict_unref (dict_rsp); -- cgit