From 7ca78f7a6466a0f2ff19caff526f6560b5275f69 Mon Sep 17 00:00:00 2001 From: Krutika Dhananjay Date: Mon, 8 Jun 2015 11:36:12 +0530 Subject: cluster/afr: Do not attempt entry self-heal if the last lookup on entry failed on src Test bug-948686.t was causing shd to dump core due to gfid being NULL. This was due to the volume being stopped while index heal's in progress, causing afr_selfheal_unlocked_lookup_on() to fail sometimes on the src brick with ENOTCONN. And when afr_selfheal_newentry_mark() copies the gfid off the src iatt, it essentially copies null gfid. This was causing the assertion as part of xattrop in protocol/client to fail. Change-Id: I237a0d6b1849e4c48d7645a2cc16d9bc1441ef95 BUG: 1229172 Signed-off-by: Krutika Dhananjay Reviewed-on: http://review.gluster.org/11119 Tested-by: Gluster Build System Reviewed-by: Pranith Kumar Karampuri Reviewed-by: Vijay Bellur --- xlators/cluster/afr/src/afr-self-heal-entry.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'xlators/cluster/afr/src/afr-self-heal-entry.c') diff --git a/xlators/cluster/afr/src/afr-self-heal-entry.c b/xlators/cluster/afr/src/afr-self-heal-entry.c index 4c092f19a79..b78bfa99f20 100644 --- a/xlators/cluster/afr/src/afr-self-heal-entry.c +++ b/xlators/cluster/afr/src/afr-self-heal-entry.c @@ -176,6 +176,13 @@ __afr_selfheal_heal_dirent (call_frame_t *frame, xlator_t *this, fd_t *fd, if (!replies[source].valid) return -EIO; + /* Skip healing this entry if the last lookup on it failed for reasons + * other than ENOENT. + */ + if ((replies[source].op_ret < 0) && + (replies[source].op_errno != ENOENT)) + return -replies[source].op_errno; + for (i = 0; i < priv->child_count; i++) { if (!healed_sinks[i]) continue; @@ -183,7 +190,7 @@ __afr_selfheal_heal_dirent (call_frame_t *frame, xlator_t *this, fd_t *fd, replies[source].op_errno == ENOENT) { ret = afr_selfheal_entry_delete (this, fd->inode, name, inode, i, replies); - } else { + } else { if (!gf_uuid_compare (replies[i].poststat.ia_gfid, replies[source].poststat.ia_gfid)) continue; @@ -191,7 +198,7 @@ __afr_selfheal_heal_dirent (call_frame_t *frame, xlator_t *this, fd_t *fd, ret = afr_selfheal_recreate_entry (this, i, source, fd->inode, name, inode, replies, newentry); - } + } if (ret < 0) break; } -- cgit