summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorAnand Avati <avati@gluster.com>2009-11-29 09:27:54 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-11-29 09:14:55 -0800
commit357e464ffee8cbed84e0c34727b9226adbdb7bd2 (patch)
tree44bff9cccb7cd4acc2d84b7cd097ca4f4d23bb38 /xlators
parent6c949d9d0ddc3397eac3207c0718743d49bd8707 (diff)
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 <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')
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-data.c3
1 files changed, 3 insertions, 0 deletions
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;