From ea93dd6397b79842c1d8e5189ff217201c002a8d Mon Sep 17 00:00:00 2001 From: Anand Avati Date: Sun, 6 Dec 2009 04:45:17 +0000 Subject: 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 Signed-off-by: Anand V. Avati 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 --- xlators/cluster/afr/src/afr-self-heal-common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'xlators/cluster/afr') diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c index ef36be145..a0e19210a 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; -- cgit