aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2007-09-28 17:11:45 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2007-10-09 17:19:03 -0400
commitc4812998398d9cbce8646494704c52297359ede0 (patch)
tree8c7b786779b03d1960c25800a7a27a10f8318e99 /fs
parent57fa76f2da05d0fee597b26bbc1f05242252beab (diff)
NFS: Fix atime revalidation in readdir()
NFSv3 will correctly update atime on a readdir call, so there is no need to set the NFS_INO_INVALID_ATIME flag unless the call to nfs_refresh_inode() fails. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/dir.c6
-rw-r--r--fs/nfs/inode.c7
-rw-r--r--fs/nfs/nfs3proc.c3
-rw-r--r--fs/nfs/nfs4proc.c3
-rw-r--r--fs/nfs/proc.c2
5 files changed, 15 insertions, 6 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 9f8ec3c3e6a7..07df192e23a0 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -200,9 +200,6 @@ int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page *page)
200 desc->timestamp = timestamp; 200 desc->timestamp = timestamp;
201 desc->timestamp_valid = 1; 201 desc->timestamp_valid = 1;
202 SetPageUptodate(page); 202 SetPageUptodate(page);
203 spin_lock(&inode->i_lock);
204 NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ATIME;
205 spin_unlock(&inode->i_lock);
206 /* Ensure consistent page alignment of the data. 203 /* Ensure consistent page alignment of the data.
207 * Note: assumes we have exclusive access to this mapping either 204 * Note: assumes we have exclusive access to this mapping either
208 * through inode->i_mutex or some other mechanism. 205 * through inode->i_mutex or some other mechanism.
@@ -490,9 +487,6 @@ int uncached_readdir(nfs_readdir_descriptor_t *desc, void *dirent,
490 page, 487 page,
491 NFS_SERVER(inode)->dtsize, 488 NFS_SERVER(inode)->dtsize,
492 desc->plus); 489 desc->plus);
493 spin_lock(&inode->i_lock);
494 NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ATIME;
495 spin_unlock(&inode->i_lock);
496 desc->page = page; 490 desc->page = page;
497 desc->ptr = kmap(page); /* matching kunmap in nfs_do_filldir */ 491 desc->ptr = kmap(page); /* matching kunmap in nfs_do_filldir */
498 if (desc->error >= 0) { 492 if (desc->error >= 0) {
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index cd57f795229e..e37faa3a7bac 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -156,6 +156,13 @@ static void nfs_zap_acl_cache(struct inode *inode)
156 spin_unlock(&inode->i_lock); 156 spin_unlock(&inode->i_lock);
157} 157}
158 158
159void nfs_invalidate_atime(struct inode *inode)
160{
161 spin_lock(&inode->i_lock);
162 NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ATIME;
163 spin_unlock(&inode->i_lock);
164}
165
159/* 166/*
160 * Invalidate, but do not unhash, the inode. 167 * Invalidate, but do not unhash, the inode.
161 * NB: must be called with inode->i_lock held! 168 * NB: must be called with inode->i_lock held!
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
index c7ca5d70870b..0ae263cdedc6 100644
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -607,6 +607,9 @@ nfs3_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
607 607
608 nfs_fattr_init(&dir_attr); 608 nfs_fattr_init(&dir_attr);
609 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); 609 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
610
611 nfs_invalidate_atime(dir);
612
610 nfs_refresh_inode(dir, &dir_attr); 613 nfs_refresh_inode(dir, &dir_attr);
611 dprintk("NFS reply readdir: %d\n", status); 614 dprintk("NFS reply readdir: %d\n", status);
612 return status; 615 return status;
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 871c102d9bdf..9c27a6ed1a62 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -2197,6 +2197,9 @@ static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
2197 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); 2197 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
2198 if (status == 0) 2198 if (status == 0)
2199 memcpy(NFS_COOKIEVERF(dir), res.verifier.data, NFS4_VERIFIER_SIZE); 2199 memcpy(NFS_COOKIEVERF(dir), res.verifier.data, NFS4_VERIFIER_SIZE);
2200
2201 nfs_invalidate_atime(dir);
2202
2200 dprintk("%s: returns %d\n", __FUNCTION__, status); 2203 dprintk("%s: returns %d\n", __FUNCTION__, status);
2201 return status; 2204 return status;
2202} 2205}
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c
index 845cdde1d8b7..cfc4130f2aec 100644
--- a/fs/nfs/proc.c
+++ b/fs/nfs/proc.c
@@ -476,6 +476,8 @@ nfs_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
476 dprintk("NFS call readdir %d\n", (unsigned int)cookie); 476 dprintk("NFS call readdir %d\n", (unsigned int)cookie);
477 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); 477 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
478 478
479 nfs_invalidate_atime(dir);
480
479 dprintk("NFS reply readdir: %d\n", status); 481 dprintk("NFS reply readdir: %d\n", status);
480 return status; 482 return status;
481} 483}