If the kernel knows that the application doesn't care about the time information, then we can avoid having to flush out writes, and we can avoid revalidating the atime information. OTOH, if the app sets AT_STRICT then we must force a revalidation of the attribute metadata. Signed-off-by: Trond Myklebust <Trond.Myklebust@xxxxxxxxxx> --- fs/nfs/inode.c | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-) diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 67db3a9..76bd229 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -506,9 +506,14 @@ int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat, int flags) { struct inode *inode = dentry->d_inode; - int need_atime = NFS_I(inode)->cache_validity & NFS_INO_INVALID_ATIME; + int force_reval = 0; int err; + force_reval |= (flags & AT_STRICT) != 0; + + if (!(flags & AT_NO_TIMES)) + goto do_revalidate; + /* * Flush out writes to the server in order to update c/mtime. * @@ -531,11 +536,12 @@ int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat, * - NFS never sets MS_NOATIME or MS_NODIRATIME so there is * no point in checking those. */ - if ((mnt->mnt_flags & MNT_NOATIME) || - ((mnt->mnt_flags & MNT_NODIRATIME) && S_ISDIR(inode->i_mode))) - need_atime = 0; + if (!((mnt->mnt_flags & MNT_NOATIME) || + ((mnt->mnt_flags & MNT_NODIRATIME) && S_ISDIR(inode->i_mode)))) + force_reval |= (NFS_I(inode)->cache_validity & NFS_INO_INVALID_ATIME) != 0; - if (need_atime) +do_revalidate: + if (force_reval) err = __nfs_revalidate_inode(NFS_SERVER(inode), inode); else err = nfs_revalidate_inode(NFS_SERVER(inode), inode); -- Trond Myklebust Linux NFS client maintainer NetApp Trond.Myklebust@xxxxxxxxxx www.netapp.com -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html