• NeilBrown's avatar
    NFS: revalidate "." etc correctly on "open". · 57567073
    NeilBrown authored
    commit b688741cb06695312f18b730653d6611e1bad28d upstream.
    
    For correct close-to-open semantics, NFS must validate
    the change attribute of a directory (or file) on open.
    
    Since commit ecf3d1f1 ("vfs: kill FS_REVAL_DOT by adding a
    d_weak_revalidate dentry op"), open() of "." or a path ending ".." is
    not revalidated reliably (except when that direct is a mount point).
    
    Prior to that commit, "." was revalidated using nfs_lookup_revalidate()
    which checks the LOOKUP_OPEN flag and forces revalidation if the flag is
    set.
    Since that commit, nfs_weak_revalidate() is used for NFSv3 (which
    ignores the flags) and nothing is used for NFSv4.
    
    This is fixed by using nfs_lookup_verify_inode() in
    nfs_weak_revalidate().  This does the revalidation exactly when needed.
    Also, add a definition of .d_weak_revalidate for NFSv4.
    
    The incorrect behavior is easily demonstrated by running "echo *" in
    some non-mountpoint NFS directory while watching network traffic.
    Without this patch, "echo *" sometimes doesn't produce any traffic.
    With the patch it always does.
    
    Fixes: ecf3d1f1 ("vfs: kill FS_REVAL_DOT by adding a d_weak_revalidate dentry op")
    Signed-off-by: 's avatarNeilBrown <neilb@suse.com>
    Signed-off-by: 's avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
    Signed-off-by: 's avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    57567073
Name
Last commit
Last update
..
blocklayout Loading commit data...
filelayout Loading commit data...
flexfilelayout Loading commit data...
Kconfig Loading commit data...
Makefile Loading commit data...
cache_lib.c Loading commit data...
cache_lib.h Loading commit data...
callback.c Loading commit data...
callback.h Loading commit data...
callback_proc.c Loading commit data...
callback_xdr.c Loading commit data...
client.c Loading commit data...
delegation.c Loading commit data...
delegation.h Loading commit data...
dir.c Loading commit data...
direct.c Loading commit data...
dns_resolve.c Loading commit data...
dns_resolve.h Loading commit data...
export.c Loading commit data...
file.c Loading commit data...
fscache-index.c Loading commit data...
fscache.c Loading commit data...
fscache.h Loading commit data...
getroot.c Loading commit data...
inode.c Loading commit data...
internal.h Loading commit data...
io.c Loading commit data...
iostat.h Loading commit data...
mount_clnt.c Loading commit data...
namespace.c Loading commit data...
netns.h Loading commit data...
nfs.h Loading commit data...
nfs2super.c Loading commit data...
nfs2xdr.c Loading commit data...
nfs3_fs.h Loading commit data...
nfs3acl.c Loading commit data...
nfs3client.c Loading commit data...
nfs3proc.c Loading commit data...
nfs3super.c Loading commit data...
nfs3xdr.c Loading commit data...
nfs42.h Loading commit data...
nfs42proc.c Loading commit data...
nfs42xdr.c Loading commit data...
nfs4_fs.h Loading commit data...
nfs4client.c Loading commit data...
nfs4file.c Loading commit data...
nfs4getroot.c Loading commit data...
nfs4idmap.c Loading commit data...
nfs4idmap.h Loading commit data...
nfs4namespace.c Loading commit data...
nfs4proc.c Loading commit data...
nfs4renewd.c Loading commit data...
nfs4session.c Loading commit data...
nfs4session.h Loading commit data...
nfs4state.c Loading commit data...
nfs4super.c Loading commit data...
nfs4sysctl.c Loading commit data...
nfs4trace.c Loading commit data...
nfs4trace.h Loading commit data...
nfs4xdr.c Loading commit data...
nfsroot.c Loading commit data...
nfstrace.c Loading commit data...
nfstrace.h Loading commit data...
pagelist.c Loading commit data...
pnfs.c Loading commit data...
pnfs.h Loading commit data...
pnfs_dev.c Loading commit data...
pnfs_nfs.c Loading commit data...
proc.c Loading commit data...
read.c Loading commit data...
super.c Loading commit data...
symlink.c Loading commit data...
sysctl.c Loading commit data...
unlink.c Loading commit data...
write.c Loading commit data...