summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshishir gowda <shishirng@gluster.com>2011-11-11 13:41:01 +0530
committerVijay Bellur <vijay@gluster.com>2011-11-16 02:08:51 -0800
commit7e3faaf682bf8f35fea9e2b4d930cbb68dae213e (patch)
tree0db2b3f8b6de023fca9faaa410040c75a17c7407
parentd4ff78d02d049335d827f9293a4e931261b5c2bb (diff)
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 <amar@gluster.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
-rw-r--r--xlators/cluster/dht/src/dht-common.c8
-rw-r--r--xlators/cluster/dht/src/dht-common.h1
2 files changed, 7 insertions, 2 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index 501bd31e3..7a3c3ddd9 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 d79ed9556..8af6dbdcd 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;