summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiels de Vos <ndevos@redhat.com>2015-06-12 12:31:19 +0200
committerNiels de Vos <ndevos@redhat.com>2015-06-14 03:20:57 -0700
commita367d4c6965e1f0da36f17ab6c5fdbd37925ebdd (patch)
treeed5fe26600fb744c68e21fe9c82ddca4d23807b8
parentcdda561c0a1f4c8050f664a444fe8b88d17e3b10 (diff)
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 <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/11198 Reviewed-by: soumya k <skoduri@redhat.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
-rw-r--r--xlators/features/upcall/src/upcall-internal.c5
1 files changed, 5 insertions, 0 deletions
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;