summaryrefslogtreecommitdiffstats
path: root/xlators/cluster
diff options
context:
space:
mode:
authorAnand Avati <avati@gluster.com>2009-12-01 20:06:18 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-12-01 17:52:54 -0800
commit0a6b3ce3bf4acd994cb67c9c79b7c03909443bdd (patch)
tree87915ce95cc0ba400c6630d89b86c564ae9669ab /xlators/cluster
parentdc16ba6f79726e9c42d2309947ad805978375b8c (diff)
afr: remove memcpy of @local contents in afr_local_copy
copy out members which are needed. memcpy of full local causes a copy of pointers without references and results in various corruption errors Signed-off-by: Anand V. Avati <avati@blackhole.gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 170 (Auto-heal fails on files that are open()-ed/mmap()-ed) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=170
Diffstat (limited to 'xlators/cluster')
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-common.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c
index 721f69a8d20..7a888657d7f 100644
--- a/xlators/cluster/afr/src/afr-self-heal-common.c
+++ b/xlators/cluster/afr/src/afr-self-heal-common.c
@@ -1387,15 +1387,29 @@ afr_self_heal_missing_entries (call_frame_t *frame, xlator_t *this)
afr_local_t *afr_local_copy (afr_local_t *l, xlator_t *this)
{
afr_private_t *priv = NULL;
- afr_local_t *lc = NULL;
+ afr_local_t *lc = NULL;
+ afr_self_heal_t *sh = NULL;
+ afr_self_heal_t *shc = NULL;
- priv = this->private;
- lc = CALLOC (1, sizeof (afr_local_t));
+ priv = this->private;
-// memcpy (lc, l, sizeof (afr_local_t));
+ sh = &l->self_heal;
- lc->self_heal = l->self_heal;
+ lc = CALLOC (1, sizeof (afr_local_t));
+ shc = &lc->self_heal;
+
+ shc->unwind = sh->unwind;
+ shc->need_data_self_heal = sh->need_data_self_heal;
+ shc->need_metadata_self_heal = sh->need_metadata_self_heal;
+ shc->need_entry_self_heal = sh->need_entry_self_heal;
+ shc->forced_merge = sh->forced_merge;
+ shc->healing_fd_opened = sh->healing_fd_opened;
+ shc->data_lock_held = sh->data_lock_held;
+ if (sh->healing_fd)
+ shc->healing_fd = fd_ref (sh->healing_fd);
+ shc->background = sh->background;
+ shc->mode = sh->mode;
if (l->loc.path)
loc_copy (&lc->loc, &l->loc);
@@ -1404,9 +1418,10 @@ afr_local_t *afr_local_copy (afr_local_t *l, xlator_t *this)
if (l->xattr_req)
lc->xattr_req = dict_copy_with_ref (l->xattr_req, NULL);
- lc->cont.lookup.inode = l->cont.lookup.inode;
-// if (l->cont.lookup.xattr)
-// lc->cont.lookup.xattr = dict_copy_with_ref (l->cont.lookup.xattr, NULL);
+ if (l->cont.lookup.inode)
+ lc->cont.lookup.inode = inode_ref (l->cont.lookup.inode);
+ if (l->cont.lookup.xattr)
+ lc->cont.lookup.xattr = dict_copy_with_ref (l->cont.lookup.xattr, NULL);
return lc;
}