From dcfd0f4ee8c3c405f768cbb79219c0c5fa071a56 Mon Sep 17 00:00:00 2001 From: Brian Foster Date: Mon, 2 Apr 2012 09:56:42 -0400 Subject: md-cache: fix time comparison to support 0 timeout The time comparison currently causes caching when the current time matches the timeout. This causes caching to occur even when the timeout parameter is set to 0. Fix the condition to support the no caching scenario. A longer term approach is to use gettimeofday() for more accurate granularity, but this apparently fixes a known bug. Change-Id: I6552c5961743edb22a1aec2e6a3a6e041d0647b2 BUG: 809193 Signed-off-by: Brian Foster Reviewed-on: http://review.gluster.com/3066 Tested-by: Gluster Build System Reviewed-by: Jeff Darcy --- xlators/performance/md-cache/src/md-cache.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'xlators/performance') diff --git a/xlators/performance/md-cache/src/md-cache.c b/xlators/performance/md-cache/src/md-cache.c index 13396a44e..dd161ce84 100644 --- a/xlators/performance/md-cache/src/md-cache.c +++ b/xlators/performance/md-cache/src/md-cache.c @@ -315,7 +315,7 @@ is_md_cache_iatt_valid (xlator_t *this, struct md_cache *mdc) LOCK (&mdc->lock); { - if (now > (mdc->ia_time + conf->timeout)) + if (now >= (mdc->ia_time + conf->timeout)) ret = _gf_false; } UNLOCK (&mdc->lock); @@ -337,7 +337,7 @@ is_md_cache_xatt_valid (xlator_t *this, struct md_cache *mdc) LOCK (&mdc->lock); { - if (now > (mdc->xa_time + conf->timeout)) + if (now >= (mdc->xa_time + conf->timeout)) ret = _gf_false; } UNLOCK (&mdc->lock); -- cgit