diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-05-05 17:45:41 +0200 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-05-16 18:43:21 +0200 |
commit | b0b539739fe9b7d75002412a787cfdf4efddbc33 (patch) | |
tree | 0b20f42bb8cdef9bba26c7ca0e4afe883e5c9c25 /fs/nfs | |
parent | Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/... (diff) | |
download | linux-b0b539739fe9b7d75002412a787cfdf4efddbc33.tar.xz linux-b0b539739fe9b7d75002412a787cfdf4efddbc33.zip |
NFS: Ensure that 'noac' and/or 'actimeo=0' turn off attribute caching
Both the 'noac' and 'actimeo=0' mount options should ensure that attributes
are not cached, however a bug in nfs_attribute_timeout() means that
currently, the attributes may in fact get cached for up to one jiffy. This
has been seen to cause corruption in some applications.
The reason for the bug is that the time_in_range() test returns 'true' as
long as the current time lies between nfsi->read_cache_jiffies and
nfsi->read_cache_jiffies + nfsi->attrtimeo. In other words, if jiffies
equals nfsi->read_cache_jiffies, then we still cache the attribute data.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/inode.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 5cb3345eb694..2501b864f7c3 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -707,6 +707,13 @@ int nfs_attribute_timeout(struct inode *inode) if (nfs_have_delegation(inode, FMODE_READ)) return 0; + /* + * Special case: if the attribute timeout is set to 0, then always + * treat the cache as having expired (unless holding + * a delegation). + */ + if (nfsi->attrtimeo == 0) + return 1; return !time_in_range(jiffies, nfsi->read_cache_jiffies, nfsi->read_cache_jiffies + nfsi->attrtimeo); } |