Blob Blame History Raw
From d765d8885dabbb83baee26bef90b820978ec45cc Mon Sep 17 00:00:00 2001
From: Venky Shankar <vshankar@redhat.com>
Date: Tue, 2 Jun 2015 21:49:13 +0530
Subject: [PATCH 079/101] contrib/timer-wheel: fix deadlock in del_timer()

    Backport of http://review.gluster.org/11050

commit eaf3bfa added mod_timers() and successfully screwed up
del_timer() by incorrectly wrapping it within double lock
blocks.

del_timer() was included before the above commit for the sake of
timer API completion, thankfully noone used it till now.

Change-Id: I07a454a216cf09dbb84777a23630e74a1e7f2830
BUG: 1231026
Signed-off-by: Venky Shankar <vshankar@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/50713
Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
Tested-by: Raghavendra Bhat <raghavendra@redhat.com>
---
 contrib/timer-wheel/timer-wheel.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/contrib/timer-wheel/timer-wheel.c b/contrib/timer-wheel/timer-wheel.c
index df8bb31..d9b2ccd 100644
--- a/contrib/timer-wheel/timer-wheel.c
+++ b/contrib/timer-wheel/timer-wheel.c
@@ -225,7 +225,7 @@ void gf_tw_del_timer (struct tvec_base *base, struct gf_tw_timer_list *timer)
                 if (timer_pending (timer))
                         __gf_tw_detach_timer (timer);
         }
-        pthread_spin_lock (&base->lock);
+        pthread_spin_unlock (&base->lock);
 }
 
 int gf_tw_mod_timer_pending (struct tvec_base *base,
-- 
1.7.1