summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiels de Vos <ndevos@redhat.com>2014-11-15 23:30:31 +0100
committerVijay Bellur <vbellur@redhat.com>2014-11-19 23:01:27 -0800
commit33800b332ec7aa70fa14809c1030cfabaddc02a0 (patch)
tree18274e775a1b81fe5271deb09874526d97a67010
parent83a4cdaa1972a16603e19916e093674b60680bb0 (diff)
md-cache: check mtime_nsec and ctime_nsec fields for changes too
When md-cache checks for an updated mtime/ctime in order to see if it should request a cache invalidation, it only looks at the whole-second "mtime" and "ctime" fields. If a file was modified a fraction of a second after the time of the cached data, md-cache won't notice the change. BUG: 1164506 Change-Id: Ieb7baa46f84489d2d7ea8d60a7fb2595564eb955 Original-author: Philip Spencer <pspencer@fields.utoronto.ca> Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/9131 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Xavier Hernandez <xhernandez@datalab.es> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
-rw-r--r--xlators/performance/md-cache/src/md-cache.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/xlators/performance/md-cache/src/md-cache.c b/xlators/performance/md-cache/src/md-cache.c
index ae7d06d92f3..a890accbb34 100644
--- a/xlators/performance/md-cache/src/md-cache.c
+++ b/xlators/performance/md-cache/src/md-cache.c
@@ -411,9 +411,13 @@ mdc_inode_iatt_set_validate(xlator_t *this, inode_t *inode, struct iatt *prebuf,
*/
if (IA_ISREG(inode->ia_type) &&
((iatt->ia_mtime != mdc->md_mtime) ||
- (iatt->ia_ctime != mdc->md_ctime)))
+ (iatt->ia_mtime_nsec != mdc->md_mtime_nsec) ||
+ (iatt->ia_ctime != mdc->md_ctime) ||
+ (iatt->ia_ctime_nsec != mdc->md_ctime_nsec)))
if (!prebuf || (prebuf->ia_ctime != mdc->md_ctime) ||
- (prebuf->ia_mtime != mdc->md_mtime))
+ (prebuf->ia_ctime_nsec != mdc->md_ctime_nsec) ||
+ (prebuf->ia_mtime != mdc->md_mtime) ||
+ (prebuf->ia_mtime_nsec != mdc->md_mtime_nsec))
inode_invalidate(inode);
mdc_from_iatt (mdc, iatt);