diff options
author | Niels de Vos <ndevos@redhat.com> | 2015-06-14 12:35:02 +0200 |
---|---|---|
committer | Niels de Vos <ndevos@redhat.com> | 2015-06-15 02:29:07 -0700 |
commit | a6ce8584c63c6aabfc2a559b3d4bb946f7ca1a58 (patch) | |
tree | ce88618f08d5495bebbc96d1807b983cefbd7e62 /xlators/features/upcall/src/upcall-internal.c | |
parent | eca453865a1df9b9b15b57ee47d844c94db4b7ba (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.
Cherry picked from commit a367d4c6965e1f0da36f17ab6c5fdbd37925ebdd)\:
> 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>
Change-Id: I453c612d72001f4d8bbecdd5ac07aaed75b43914
BUG: 1231516
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: http://review.gluster.org/11211
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: soumya k <skoduri@redhat.com>
Diffstat (limited to 'xlators/features/upcall/src/upcall-internal.c')
-rw-r--r-- | xlators/features/upcall/src/upcall-internal.c | 5 |
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 e13097c57c6..cd4abb6bbbc 100644 --- a/xlators/features/upcall/src/upcall-internal.c +++ b/xlators/features/upcall/src/upcall-internal.c @@ -402,6 +402,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); @@ -434,6 +435,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; |