From b0b539739fe9b7d75002412a787cfdf4efddbc33 Mon Sep 17 00:00:00 2001 From: Trond Myklebust Date: Mon, 5 May 2008 11:45:41 -0400 Subject: 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 --- fs/nfs/inode.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'fs/nfs/inode.c') 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); } -- cgit v1.2.3 From 3110ff8048fb757b36112b044b384aea9c44d6e4 Mon Sep 17 00:00:00 2001 From: Harvey Harrison Date: Fri, 2 May 2008 13:42:44 -0700 Subject: nfs: replace remaining __FUNCTION__ occurrences __FUNCTION__ is gcc-specific, use __func__ Signed-off-by: Harvey Harrison Cc: Trond Myklebust Cc: "J. Bruce Fields" Signed-off-by: Andrew Morton Signed-off-by: Trond Myklebust --- fs/nfs/inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'fs/nfs/inode.c') diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 2501b864f7c3..421d338c698c 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -1002,7 +1002,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) unsigned long now = jiffies; dfprintk(VFS, "NFS: %s(%s/%ld ct=%d info=0x%x)\n", - __FUNCTION__, inode->i_sb->s_id, inode->i_ino, + __func__, inode->i_sb->s_id, inode->i_ino, atomic_read(&inode->i_count), fattr->valid); if (nfsi->fileid != fattr->fileid) @@ -1126,7 +1126,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) * Big trouble! The inode has become a different object. */ printk(KERN_DEBUG "%s: inode %ld mode changed, %07o to %07o\n", - __FUNCTION__, inode->i_ino, inode->i_mode, fattr->mode); + __func__, inode->i_ino, inode->i_mode, fattr->mode); out_err: /* * No need to worry about unhashing the dentry, as the -- cgit v1.2.3 From 31f31db1a15671513df9cd9fbe56ef45ee1e9a2a Mon Sep 17 00:00:00 2001 From: Jan Blunck Date: Fri, 2 May 2008 13:42:45 -0700 Subject: nfs: path_{get,put}() cleanups Here are some more places where path_{get,put}() can be used instead of dput()/mntput() pair. Signed-off-by: Jan Blunck Cc: Trond Myklebust Cc: "J. Bruce Fields" Signed-off-by: Andrew Morton Signed-off-by: Trond Myklebust --- fs/nfs/inode.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'fs/nfs/inode.c') diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 421d338c698c..596c5d8e86f4 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -541,8 +541,7 @@ static void __put_nfs_open_context(struct nfs_open_context *ctx, int wait) } if (ctx->cred != NULL) put_rpccred(ctx->cred); - dput(ctx->path.dentry); - mntput(ctx->path.mnt); + path_put(&ctx->path); kfree(ctx); } -- cgit v1.2.3