diff options
author | Ravishankar N <ravishankar@redhat.com> | 2014-09-14 13:46:33 +0000 |
---|---|---|
committer | Niels de Vos <ndevos@redhat.com> | 2014-09-23 01:16:57 -0700 |
commit | 6470b905e2e9e5e3f7a6b1541358b9607efa4b74 (patch) | |
tree | fe62e371ddad5c0cce8e14c5e98839d294933600 /heal | |
parent | da1657d6841e6bd74074f5a60ed29cf3a97fbff4 (diff) |
heal:Do not ignore return value of syncop_getxattr()
Problem:
In glfs-heal.c, we are currently ignoring the return value of
syncop_getxattr() in glfsh_process_entries(). This can cause random characters
to be printed in the heal-info command when stale entries are present in
indices/xattrop directory.
Fix:
Check and purge stale entries instead of printing them, depending on the 'ret'
value of syncop_getxattr().
Change-Id: I6c87f3ab3fecde48cdbf7578a85782a1d2f1d55b
BUG: 1141558
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
Reviewed-on: http://review.gluster.org/8711
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Diffstat (limited to 'heal')
-rw-r--r-- | heal/src/glfs-heal.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/heal/src/glfs-heal.c b/heal/src/glfs-heal.c index 8240e7b7569..78716ad64da 100644 --- a/heal/src/glfs-heal.c +++ b/heal/src/glfs-heal.c @@ -141,11 +141,12 @@ _is_possibly_healing (dict_t *xattr_rsp) return _gf_false; } -#define RESET_ENTRIES(loc, shf, ope, rsp, grsp) \ +#define RESET_ENTRIES(loc, shf, ope, pth, rsp, grsp) \ do { \ loc_wipe (&loc); \ shf = 0; \ ope = 0; \ + pth = NULL; \ if (rsp) { \ dict_unref (rsp); \ rsp = NULL; \ @@ -216,7 +217,7 @@ glfsh_process_entries (xlator_t *xl, loc_t *parentloc, gf_dirent_t *entries, (strcmp (entry->d_name, "..") == 0)) continue; - RESET_ENTRIES (entry_loc, sh_failed, op_errno, xattr_rsp, + RESET_ENTRIES (entry_loc, sh_failed, op_errno, path, xattr_rsp, getxattr_rsp); ret = _set_self_heal_vxattrs (xattr_req); @@ -248,10 +249,16 @@ glfsh_process_entries (xlator_t *xl, loc_t *parentloc, gf_dirent_t *entries, ret = syncop_getxattr (xl, &entry_loc, &getxattr_rsp, GFID_TO_PATH_KEY); + if (ret < 0) { + op_errno = errno; + if (op_errno == ENOENT || op_errno == ESTALE) + glfsh_remove_stale_index (xl, parentloc, + entry->d_name); + continue; + } ret = dict_get_str (getxattr_rsp, GFID_TO_PATH_KEY, &path); - (*num_entries)++; if (_is_possibly_healing (xattr_rsp)) { printf ("%s - Possibly undergoing heal\n", @@ -262,7 +269,8 @@ glfsh_process_entries (xlator_t *xl, loc_t *parentloc, gf_dirent_t *entries, } ret = 0; out: - RESET_ENTRIES (entry_loc, sh_failed, op_errno, xattr_rsp, getxattr_rsp); + RESET_ENTRIES (entry_loc, sh_failed, op_errno, path, xattr_rsp, + getxattr_rsp); return ret; } |