From 357e464ffee8cbed84e0c34727b9226adbdb7bd2 Mon Sep 17 00:00:00 2001 From: Anand Avati Date: Sun, 29 Nov 2009 09:27:54 +0000 Subject: afr: fix crash in afr_sh_data_close when active_sink count is 0, the code proceeded into a dangerous loop resulting in a crash while issuing the call or in the callback afr_sh_data_setattr_cbk or afr_sh_data_flush_cbk 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-data.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'xlators/cluster') diff --git a/xlators/cluster/afr/src/afr-self-heal-data.c b/xlators/cluster/afr/src/afr-self-heal-data.c index 7662c1178e0..66a4249022e 100644 --- a/xlators/cluster/afr/src/afr-self-heal-data.c +++ b/xlators/cluster/afr/src/afr-self-heal-data.c @@ -195,6 +195,9 @@ afr_sh_data_close (call_frame_t *frame, xlator_t *this) call_count--; + if (call_count == 0) + return 0; + for (i = 0; i < priv->child_count; i++) { if (sh->sources[i] || !local->child_up[i]) continue; -- cgit