From a367d4c6965e1f0da36f17ab6c5fdbd37925ebdd Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Fri, 12 Jun 2015 12:31:19 +0200 Subject: upcall: prevent busy loop in reaper thread http://review.gluster.org/10342 introduced a cleanup thread for expired client entries. When enabling the 'features.cache-invalidation' volume option, the brick process starts to run in a busy-loop. Obviously this is not intentional, and a process occupying 100% of the cycles on a CPU or core is not wanted. Change-Id: I453c612d72001f4d8bbecdd5ac07aaed75b43914 BUG: 1200267 Signed-off-by: Niels de Vos Reviewed-on: http://review.gluster.org/11198 Reviewed-by: soumya k Reviewed-by: Kaleb KEITHLEY Tested-by: Gluster Build System --- xlators/features/upcall/src/upcall-internal.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'xlators/features/upcall/src/upcall-internal.c') diff --git a/xlators/features/upcall/src/upcall-internal.c b/xlators/features/upcall/src/upcall-internal.c index 3b6186ea943..007a8f854bf 100644 --- a/xlators/features/upcall/src/upcall-internal.c +++ b/xlators/features/upcall/src/upcall-internal.c @@ -397,6 +397,7 @@ upcall_reaper_thread (void *data) upcall_inode_ctx_t *inode_ctx = NULL; upcall_inode_ctx_t *tmp = NULL; xlator_t *this = NULL; + time_t timeout = 0; this = (xlator_t *)data; GF_ASSERT (this); @@ -429,6 +430,10 @@ upcall_reaper_thread (void *data) } UNLOCK (&priv->inode_ctx_lk); } + + /* don't do a very busy loop */ + timeout = get_cache_invalidation_timeout (this); + sleep (timeout / 2); } return NULL; -- cgit