summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnand Avati <avati@gluster.com>2009-12-06 04:45:17 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-12-06 02:30:32 -0800
commitea93dd6397b79842c1d8e5189ff217201c002a8d (patch)
tree985e6ee77c593567573de050abb33cc5980dd61f
parent7a3c372c7a8a3ad7d481f94a899fd4333d146634 (diff)
afr: fix fd ref leak in self-heal
sh->healing_fd should be ref'ed only when healing_fd_opened is not set 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
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-common.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c
index ef36be14521..a0e19210ae7 100644
--- a/xlators/cluster/afr/src/afr-self-heal-common.c
+++ b/xlators/cluster/afr/src/afr-self-heal-common.c
@@ -1413,8 +1413,10 @@ afr_local_t *afr_local_copy (afr_local_t *l, xlator_t *this)
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)
+ if (sh->healing_fd && !sh->healing_fd_opened)
shc->healing_fd = fd_ref (sh->healing_fd);
+ else
+ shc->healing_fd = sh->healing_fd;
shc->background = sh->background;
shc->mode = sh->mode;