diff options
author | Pranith Kumar K <pranithk@gluster.com> | 2010-07-29 00:46:08 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2010-07-28 23:58:09 -0700 |
commit | cadd1256355f4e1a5bd43c3a71dbd6cb97dff66d (patch) | |
tree | 56f0843defafbb985e7e9faa73aa74b453e6268a | |
parent | c9b709917b3d549d544133d51e85dbf9287278d1 (diff) |
fixes for spurious entry self-heal in afr
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 974 (Spurious self-heal?)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=974
-rw-r--r-- | xlators/cluster/afr/src/afr-dir-read.c | 12 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-entry.c | 2 | ||||
-rw-r--r-- | xlators/storage/posix/src/posix.c | 8 |
3 files changed, 17 insertions, 5 deletions
diff --git a/xlators/cluster/afr/src/afr-dir-read.c b/xlators/cluster/afr/src/afr-dir-read.c index 281fc78d3cd..344bdf74ece 100644 --- a/xlators/cluster/afr/src/afr-dir-read.c +++ b/xlators/cluster/afr/src/afr-dir-read.c @@ -69,7 +69,8 @@ afr_examine_dir_sh_unwind (call_frame_t *frame, xlator_t *this) gf_boolean_t -__checksums_differ (uint32_t *checksum, int child_count) +__checksums_differ (uint32_t *checksum, int child_count, + unsigned char *child_up) { int ret = _gf_false; int i = 0; @@ -78,14 +79,16 @@ __checksums_differ (uint32_t *checksum, int child_count) cksum = checksum[0]; - while (i < child_count) { + for (i = 0; i < child_count; i++) { + if (!child_up[i]) + continue; + if (cksum != checksum[i]) { ret = _gf_true; break; } cksum = checksum[i]; - i++; } return ret; @@ -151,7 +154,8 @@ out: if (call_count == 0) { if (__checksums_differ (local->cont.opendir.checksum, - priv->child_count)) { + priv->child_count, + local->child_up)) { sh->need_entry_self_heal = _gf_true; sh->forced_merge = _gf_true; diff --git a/xlators/cluster/afr/src/afr-self-heal-entry.c b/xlators/cluster/afr/src/afr-self-heal-entry.c index dcb8d0d71df..a4bab4208de 100644 --- a/xlators/cluster/afr/src/afr-self-heal-entry.c +++ b/xlators/cluster/afr/src/afr-self-heal-entry.c @@ -616,7 +616,7 @@ afr_sh_entry_expunge_mkdir_cbk (call_frame_t *expunge_frame, void *cookie, xlato frame = expunge_sh->sh_frame; if (op_ret != 0) { - gf_log (this->name, GF_LOG_DEBUG, + gf_log (this->name, GF_LOG_ERROR, "mkdir of /" GF_REPLICATE_TRASH_DIR " failed on %s", priv->children[active_src]->name); diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index da5156709d1..7372596e744 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -3948,6 +3948,7 @@ posix_do_readdir (call_frame_t *frame, xlator_t *this, int entry_path_len = -1; struct posix_private *priv = NULL; struct iatt stbuf = {0, }; + char base_path[PATH_MAX] = {0,}; VALIDATE_OR_GOTO (frame, out); VALIDATE_OR_GOTO (this, out); @@ -3979,6 +3980,9 @@ posix_do_readdir (call_frame_t *frame, xlator_t *this, entry_path_len = real_path_len + NAME_MAX; entry_path = alloca (entry_path_len); + strncpy(base_path, POSIX_BASE_PATH(this), sizeof(base_path)); + base_path[strlen(base_path)] = '/'; + if (!entry_path) { op_errno = errno; gf_log (this->name, GF_LOG_ERROR, @@ -4030,6 +4034,10 @@ posix_do_readdir (call_frame_t *frame, xlator_t *this, break; } + if ((!strcmp(real_path, base_path)) + && (!strcmp(entry->d_name, GF_REPLICATE_TRASH_DIR))) + continue; + this_size = dirent_size (entry); if (this_size + filled > size) { |