From 7be4f21f257f23d8e4f2fd57aefa8736cae4cdbf Mon Sep 17 00:00:00 2001 From: Kinglong Mee Date: Sat, 29 Sep 2018 11:45:11 +0800 Subject: md-cache: extends xa_time when previous attributes equals cached attributes Some operations like read/write only update iatt and ia_time, without any operion request xattrs from glusterfsd, the xa_time is timeout before ia_time always. This patch updates xa_time when update ia_ttime. Change-Id: I77e3984f38c1c4dbebfde9729b8117fbacde9674 Updates: bz#1634220 Signed-off-by: Kinglong Mee --- xlators/performance/md-cache/src/md-cache.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'xlators/performance/md-cache') diff --git a/xlators/performance/md-cache/src/md-cache.c b/xlators/performance/md-cache/src/md-cache.c index 685745b956a..ed89c18322f 100644 --- a/xlators/performance/md-cache/src/md-cache.c +++ b/xlators/performance/md-cache/src/md-cache.c @@ -468,6 +468,7 @@ mdc_inode_iatt_set_validate(xlator_t *this, inode_t *inode, struct iatt *prebuf, struct md_cache *mdc = NULL; uint32_t rollover = 0; uint64_t gen = 0; + gf_boolean_t update_xa_time = _gf_false; mdc = mdc_inode_prep(this, inode); if (!mdc) { @@ -527,11 +528,10 @@ mdc_inode_iatt_set_validate(xlator_t *this, inode_t *inode, struct iatt *prebuf, * TODO: writev returns with a NULL iatt due to * performance/write-behind, causing invalidation on writes. */ - if (IA_ISREG(inode->ia_type) && - ((iatt->ia_mtime != mdc->md_mtime) || - (iatt->ia_mtime_nsec != mdc->md_mtime_nsec) || - (iatt->ia_ctime != mdc->md_ctime) || - (iatt->ia_ctime_nsec != mdc->md_ctime_nsec))) + if ((iatt->ia_mtime != mdc->md_mtime) || + (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_ctime_nsec != mdc->md_ctime_nsec) || (prebuf->ia_mtime != mdc->md_mtime) || @@ -542,8 +542,12 @@ mdc_inode_iatt_set_validate(xlator_t *this, inode_t *inode, struct iatt *prebuf, " invalidate the inode(%s)", uuid_utoa(inode->gfid)); - inode_invalidate(inode); + if (IA_ISREG(inode->ia_type)) + inode_invalidate(inode); + } else { + update_xa_time = _gf_true; } + } if ((mdc->gen_rollover == rollover) && ((incident_time > mdc->generation) && @@ -551,9 +555,13 @@ mdc_inode_iatt_set_validate(xlator_t *this, inode_t *inode, struct iatt *prebuf, mdc_from_iatt(mdc, iatt); mdc->generation = incident_time; mdc->valid = _gf_true; - if (update_time) + if (update_time) { time(&mdc->ia_time); + if (mdc->xa_time && update_xa_time) + time(&mdc->xa_time); + } + gf_msg_callingfn( "md-cache", GF_LOG_TRACE, 0, MD_CACHE_MSG_CACHE_UPDATE, "Updated iatt(%s)" -- cgit