summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorVenky Shankar <vshankar@redhat.com>2015-06-04 08:50:48 +0530
committerRaghavendra Bhat <raghavendra@redhat.com>2015-07-09 03:13:25 -0700
commit2874ee4d65185a607f1f646fc88ba8eb400aaa9a (patch)
tree3f4e47fbf09c2505e5ef7558d9fbb8ffcc684148 /contrib
parent291aba1f1ba33831569acd879e3357c1fd01a5c8 (diff)
features/bitrot: cleanup, v2
Backport of http://review.gluster.org/11148 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: 1226666 Signed-off-by: Venky Shankar <vshankar@redhat.com> Reviewed-on: http://review.gluster.org/11540 Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'contrib')
-rw-r--r--contrib/timer-wheel/timer-wheel.c10
-rw-r--r--contrib/timer-wheel/timer-wheel.h2
2 files changed, 9 insertions, 3 deletions
diff --git a/contrib/timer-wheel/timer-wheel.c b/contrib/timer-wheel/timer-wheel.c
index d9b2ccd..013c0f2 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,
diff --git a/contrib/timer-wheel/timer-wheel.h b/contrib/timer-wheel/timer-wheel.h
index c52f2fc..faa941a 100644
--- a/contrib/timer-wheel/timer-wheel.h
+++ b/contrib/timer-wheel/timer-wheel.h
@@ -66,7 +66,7 @@ struct gf_tw_timer_list {
struct tvec_base *gf_tw_init_timers ();
int gf_tw_cleanup_timers (struct tvec_base *);
void gf_tw_add_timer (struct tvec_base *, struct gf_tw_timer_list *);
-void gf_tw_del_timer (struct tvec_base *, struct gf_tw_timer_list *);
+int gf_tw_del_timer (struct tvec_base *, struct gf_tw_timer_list *);
int gf_tw_mod_timer_pending (struct tvec_base *,
struct gf_tw_timer_list *, unsigned long);