summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshishir gowda <shishirng@gluster.com>2011-11-11 13:27:13 +0530
committerVijay Bellur <vijay@gluster.com>2011-11-11 01:57:05 -0800
commit0cb2ac3521468cd37ac9e4a67db6e8b29725cf77 (patch)
tree5089f1f186f190852ea4c5ec892078a6a4b4d25b
parentf72fb71e8cd0c95d761e70def39ea02b702ffe7c (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: I1dd39db830e9396b1dc6d6edbaa6de6ea83e9070 BUG: 3786 Reviewed-on: http://review.gluster.com/715 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amar@gluster.com>
-rw-r--r--xlators/cluster/dht/src/dht-common.c9
-rw-r--r--xlators/cluster/dht/src/dht-common.h1
2 files changed, 7 insertions, 3 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index cd8233897cd..65bfc3d1b10 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -4271,8 +4271,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)",
@@ -4280,7 +4281,8 @@ dht_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
strerror (op_errno));
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);
@@ -4291,7 +4293,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);
@@ -4637,6 +4639,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;
ret = loc_copy (&local->loc, loc);
if (ret == -1) {
diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h
index c9e4e926101..01e35da02c5 100644
--- a/xlators/cluster/dht/src/dht-common.h
+++ b/xlators/cluster/dht/src/dht-common.h
@@ -96,6 +96,7 @@ struct dht_local {
char need_selfheal;
int file_count;
int dir_count;
+ int fop_succeeded;
call_frame_t *main_frame;
struct {
fop_mknod_cbk_t linkfile_cbk;