diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-12-14 17:51:40 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-12-14 17:51:40 -0500 |
commit | 65a0c14954493802de01968a73b849f9fc4b4d1a (patch) | |
tree | 9aed5fb3785615d550feb038470f08dbeb36716f /fs/nfs/dir.c | |
parent | 1f018458b30b0d5c535c94e577aa0acbb92e1395 (diff) |
NFS: nfs_lookup_revalidate should not trust an inode with i_nlink == 0
If the inode has no links, then we should force a new lookup.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/dir.c')
-rw-r--r-- | fs/nfs/dir.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index a46a74654488..d8e58ed3d45c 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -978,10 +978,11 @@ static int nfs_is_exclusive_create(struct inode *dir, unsigned int flags) | |||
978 | * particular file and the "nocto" mount flag is not set. | 978 | * particular file and the "nocto" mount flag is not set. |
979 | * | 979 | * |
980 | */ | 980 | */ |
981 | static inline | 981 | static |
982 | int nfs_lookup_verify_inode(struct inode *inode, unsigned int flags) | 982 | int nfs_lookup_verify_inode(struct inode *inode, unsigned int flags) |
983 | { | 983 | { |
984 | struct nfs_server *server = NFS_SERVER(inode); | 984 | struct nfs_server *server = NFS_SERVER(inode); |
985 | int ret; | ||
985 | 986 | ||
986 | if (IS_AUTOMOUNT(inode)) | 987 | if (IS_AUTOMOUNT(inode)) |
987 | return 0; | 988 | return 0; |
@@ -992,9 +993,13 @@ int nfs_lookup_verify_inode(struct inode *inode, unsigned int flags) | |||
992 | if ((flags & LOOKUP_OPEN) && !(server->flags & NFS_MOUNT_NOCTO) && | 993 | if ((flags & LOOKUP_OPEN) && !(server->flags & NFS_MOUNT_NOCTO) && |
993 | (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode))) | 994 | (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode))) |
994 | goto out_force; | 995 | goto out_force; |
995 | return 0; | 996 | out: |
997 | return (inode->i_nlink == 0) ? -ENOENT : 0; | ||
996 | out_force: | 998 | out_force: |
997 | return __nfs_revalidate_inode(server, inode); | 999 | ret = __nfs_revalidate_inode(server, inode); |
1000 | if (ret != 0) | ||
1001 | return ret; | ||
1002 | goto out; | ||
998 | } | 1003 | } |
999 | 1004 | ||
1000 | /* | 1005 | /* |