summaryrefslogtreecommitdiffstats
path: root/health
diff options
context:
space:
mode:
authorMarkos Fountoulakis <44345837+mfundul@users.noreply.github.com>2020-11-28 15:53:12 +0200
committerGitHub <noreply@github.com>2020-11-28 15:53:12 +0200
commit5ffba490e381705750c4e2e3eeda47dee6b3cb3d (patch)
treea32ead1a9109f166a0b43d77b94514ff6e599b6f /health
parent1a548d533ca18c9276a7b62e499ddfc0000437d7 (diff)
Fix race condition in rrdset_first_entry_t() and rrdset_last_entry_t() (#10276)
Diffstat (limited to 'health')
-rw-r--r--health/health.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/health/health.c b/health/health.c
index 1ba644e72c..1c6189ab92 100644
--- a/health/health.c
+++ b/health/health.c
@@ -501,8 +501,10 @@ static inline int rrdcalc_isrunnable(RRDCALC *rc, time_t now, time_t *next_run)
}
int update_every = rc->rrdset->update_every;
- time_t first = rrdset_first_entry_t(rc->rrdset);
- time_t last = rrdset_last_entry_t(rc->rrdset);
+ rrdset_rdlock(rc->rrdset);
+ time_t first = rrdset_first_entry_t_nolock(rc->rrdset);
+ time_t last = rrdset_last_entry_t_nolock(rc->rrdset);
+ rrdset_unlock(rc->rrdset);
if(unlikely(now + update_every < first /* || now - update_every > last */)) {
debug(D_HEALTH