diff options
author | Venky Shankar <vshankar@redhat.com> | 2015-06-04 08:50:48 +0530 |
---|---|---|
committer | Raghavendra Bhat <raghavendra@redhat.com> | 2015-06-25 04:45:19 -0700 |
commit | 6ab37f0cb4fd8313dab93360a41acbaf422f39b5 (patch) | |
tree | 7ecc921307f5fd083e1ef5f37d1728ecca9140f2 /contrib/timer-wheel/timer-wheel.c | |
parent | 367049879e149e2cd3ec3ba96de7f495a30de180 (diff) |
features/bitrot: cleanup, v2
This patch uses "cleanup, v1" infrastrcuture to cleanup scrubber
(data structures, threads, timers, etc..) on brick disconnection.
Signer is not cleaned up yet: probably would be done as part of
another patch.
Change-Id: I78a92b8a7f02b2f39078aa9a5a6b101fc499fd70
BUG: 1231619
Signed-off-by: Venky Shankar <vshankar@redhat.com>
Reviewed-on: http://review.gluster.org/11148
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
Diffstat (limited to 'contrib/timer-wheel/timer-wheel.c')
-rw-r--r-- | contrib/timer-wheel/timer-wheel.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/contrib/timer-wheel/timer-wheel.c b/contrib/timer-wheel/timer-wheel.c index d9b2ccdc68a..013c0f278a1 100644 --- a/contrib/timer-wheel/timer-wheel.c +++ b/contrib/timer-wheel/timer-wheel.c @@ -218,14 +218,20 @@ void gf_tw_add_timer (struct tvec_base *base, struct gf_tw_timer_list *timer) /** * Remove a timer from the timer wheel */ -void gf_tw_del_timer (struct tvec_base *base, struct gf_tw_timer_list *timer) +int gf_tw_del_timer (struct tvec_base *base, struct gf_tw_timer_list *timer) { + int ret = 0; + pthread_spin_lock (&base->lock); { - if (timer_pending (timer)) + if (timer_pending (timer)) { + ret = 1; __gf_tw_detach_timer (timer); + } } pthread_spin_unlock (&base->lock); + + return ret; } int gf_tw_mod_timer_pending (struct tvec_base *base, |