diff options
author | Raghavendra G <raghavendra@gluster.com> | 2009-12-02 00:13:04 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-12-02 01:01:39 -0800 |
commit | 8de5abce794b1d0e50f7ef77d6fdd63b2c788c42 (patch) | |
tree | aa7206ab90be1293e78e10035eab47114a728179 /xlators/performance/io-cache/src/page.c | |
parent | 38e228b87af308f54c7b5cfe73cce08a14213afb (diff) |
performance/io-cache: don't use stat got in read_cbk if it is zero-filled.
- translators like io-cache, read-ahead return a zero-filled stbuf in
readv_cbk and usage of zero filled stat for cache validation is not
correct.
Signed-off-by: Raghavendra G <raghavendra@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 376 (server-side io-cache is preventing client-side io-cache from working)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=376
Diffstat (limited to 'xlators/performance/io-cache/src/page.c')
-rw-r--r-- | xlators/performance/io-cache/src/page.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/xlators/performance/io-cache/src/page.c b/xlators/performance/io-cache/src/page.c index 9db42bca1..b3833fff0 100644 --- a/xlators/performance/io-cache/src/page.c +++ b/xlators/performance/io-cache/src/page.c @@ -334,6 +334,7 @@ ioc_fault_cbk (call_frame_t *frame, void *cookie, xlator_t *this, size_t page_size = 0; ioc_waitq_t *waitq = NULL; size_t iobref_page_size = 0; + char zero_filled = 0; local = frame->local; offset = local->pending_offset; @@ -343,22 +344,26 @@ ioc_fault_cbk (call_frame_t *frame, void *cookie, xlator_t *this, trav_offset = offset; payload_size = op_ret; + zero_filled = ((op_ret >=0) + && (stbuf->st_mtime == 0)); + + ioc_inode_lock (ioc_inode); { - if (op_ret == -1 || - (op_ret >= 0 && - !ioc_cache_still_valid(ioc_inode, stbuf))) { + if (op_ret == -1 || + !(zero_filled || + ioc_cache_still_valid(ioc_inode, stbuf))) { gf_log (ioc_inode->table->xl->name, GF_LOG_TRACE, "cache for inode(%p) is invalid. flushing " "all pages", ioc_inode); destroy_size = __ioc_inode_flush (ioc_inode); - } - - if (op_ret >= 0) - ioc_inode->mtime = stbuf->st_mtime; - + } + + if ((op_ret >= 0) && !zero_filled) + ioc_inode->mtime = stbuf->st_mtime; + gettimeofday (&ioc_inode->tv, NULL); - + if (op_ret < 0) { /* error, readv returned -1 */ page = ioc_page_get (ioc_inode, offset); |