summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-self-heal-entry.c
diff options
context:
space:
mode:
authorVikas Gorur <vikas@gluster.com>2009-11-12 08:44:16 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-11-13 02:13:43 -0800
commit26fbaa23cafee4643b7604660762656c4a71684b (patch)
tree90bef7f03cb305dad016439706d46fdd0ed84f62 /xlators/cluster/afr/src/afr-self-heal-entry.c
parent4717e5279e169a36a870a267039e788cf22602a8 (diff)
cluster/afr: Ensure directory contents are in sync during opendir.
The problem: If some files on the first subvolume disappeared without leaving a trace in the entry changelog (this can happen, for example, when an fsck has deleted files or when a hard drive is replaced), those files would never be self-healed even though they would be present on the second subvolume. This is because readdir is sent only to the first subvolume, and since the files don't appear in the directory listing, no lookup would ever be sent on them. This patch fixes this problem by doing a readdir on all the subvolumes during the first opendir on a directory inode. If a discrepancy in the contents is detected, entry self-heal in a special "force merge" mode is triggered on that directory. Signed-off-by: Vikas Gorur <vikas@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 249 (Self heal of a file that does not exist on the first subvolume) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=249
Diffstat (limited to 'xlators/cluster/afr/src/afr-self-heal-entry.c')
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-entry.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-entry.c b/xlators/cluster/afr/src/afr-self-heal-entry.c
index d952865a18f..5c47d887e52 100644
--- a/xlators/cluster/afr/src/afr-self-heal-entry.c
+++ b/xlators/cluster/afr/src/afr-self-heal-entry.c
@@ -2317,6 +2317,11 @@ afr_sh_entry_fix (call_frame_t *frame, xlator_t *this)
sh = &local->self_heal;
priv = this->private;
+ if (sh->forced_merge) {
+ sh->source = -1;
+ goto heal;
+ }
+
afr_sh_build_pending_matrix (priv, sh->pending_matrix, sh->xattr,
priv->child_count, AFR_ENTRY_TRANSACTION);
@@ -2338,12 +2343,14 @@ afr_sh_entry_fix (call_frame_t *frame, xlator_t *this)
priv->child_count);
source = afr_sh_select_source (sh->sources, priv->child_count);
- sh->source = source;
+
+ sh->source = source;
if (sh->background) {
sh->unwind (frame, this);
}
+heal:
afr_sh_entry_sync_prepare (frame, this);
return 0;