summaryrefslogtreecommitdiffstats
path: root/xlators/performance/io-cache/src/io-cache.c
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2009-12-02 00:13:04 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-12-02 01:01:39 -0800
commit8de5abce794b1d0e50f7ef77d6fdd63b2c788c42 (patch)
treeaa7206ab90be1293e78e10035eab47114a728179 /xlators/performance/io-cache/src/io-cache.c
parent38e228b87af308f54c7b5cfe73cce08a14213afb (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/io-cache.c')
-rw-r--r--xlators/performance/io-cache/src/io-cache.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c
index fc38ac8..ba170c3 100644
--- a/xlators/performance/io-cache/src/io-cache.c
+++ b/xlators/performance/io-cache/src/io-cache.c
@@ -192,19 +192,21 @@ ioc_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
inode_ctx_get (inode, this, &tmp_ioc_inode);
ioc_inode = (ioc_inode_t *)(long)tmp_ioc_inode;
if (ioc_inode) {
+ ioc_inode_lock (ioc_inode);
+ {
+ if (ioc_inode->mtime == 0) {
+ ioc_inode->mtime = stbuf->st_mtime;
+ }
+ }
+ ioc_inode_unlock (ioc_inode);
+
cache_still_valid = ioc_cache_still_valid (ioc_inode,
stbuf);
if (!cache_still_valid) {
ioc_inode_flush (ioc_inode);
}
- /* update the time-stamp of revalidation */
- ioc_inode_lock (ioc_inode);
- {
- gettimeofday (&ioc_inode->tv, NULL);
- }
- ioc_inode_unlock (ioc_inode);
-
+
ioc_table_lock (ioc_inode->table);
{
list_move_tail (&ioc_inode->inode_lru,
@@ -534,6 +536,11 @@ ioc_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
weight = ioc_get_priority (table, path);
ioc_inode = ioc_inode_update (table, inode, weight);
+ ioc_inode_lock (ioc_inode);
+ {
+ ioc_inode->mtime = buf->st_mtime;
+ }
+ ioc_inode_unlock (ioc_inode);
inode_ctx_put (fd->inode, this,
(uint64_t)(long)ioc_inode);