From 7e3faaf682bf8f35fea9e2b4d930cbb68dae213e Mon Sep 17 00:00:00 2001 From: shishir gowda Date: Fri, 11 Nov 2011 13:41:01 +0530 Subject: cluster/distribute: Trigger selfheal only if rmdir succeeded once A EACCES error also should not trigger a selfheal. Only if rmdir succeeded on any subvol, a selfheal should be triggered Change-Id: Ifebb980f0ebd1548adfd3be975ca52ca44c3f3ab BUG: 3786 Reviewed-on: http://review.gluster.com/716 Reviewed-by: Amar Tumballi Tested-by: Gluster Build System --- xlators/cluster/dht/src/dht-common.c | 8 ++++++-- xlators/cluster/dht/src/dht-common.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'xlators') diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 501bd31e3f5..7a3c3ddd90f 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -3410,8 +3410,9 @@ dht_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->op_errno = op_errno; local->op_ret = -1; - if (op_errno != ENOENT) + if (op_errno != ENOENT && op_errno != EACCES) { local->need_selfheal = 1; + } gf_log (this->name, GF_LOG_DEBUG, "rmdir on %s for %s failed (%s)", @@ -3420,6 +3421,8 @@ dht_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, goto unlock; } + /* Track if rmdir succeeded on atleast one subvol*/ + local->fop_succeeded = 1; dht_iatt_merge (this, &local->preparent, preparent, prev->this); dht_iatt_merge (this, &local->postparent, postparent, prev->this); @@ -3430,7 +3433,7 @@ unlock: this_call_cnt = dht_frame_return (frame); if (is_last_call (this_call_cnt)) { - if (local->need_selfheal) { + if (local->need_selfheal && local->fop_succeeded) { local->layout = dht_layout_get (this, local->loc.inode); @@ -3766,6 +3769,7 @@ dht_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags) local->call_cnt = conf->subvolume_cnt; local->op_ret = 0; + local->fop_succeeded = 0; local->flags = flags; diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h index d79ed955697..8af6dbdcdfd 100644 --- a/xlators/cluster/dht/src/dht-common.h +++ b/xlators/cluster/dht/src/dht-common.h @@ -117,6 +117,7 @@ struct dht_local { int file_count; int dir_count; call_frame_t *main_frame; + int fop_succeeded; struct { fop_mknod_cbk_t linkfile_cbk; struct iatt stbuf; -- cgit