Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 65a0c149 authored by Trond Myklebust's avatar Trond Myklebust
Browse files

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: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 1f018458
Loading
Loading
Loading
Loading
+8 −3
Original line number Original line Diff line number Diff line
@@ -978,10 +978,11 @@ static int nfs_is_exclusive_create(struct inode *dir, unsigned int flags)
 * particular file and the "nocto" mount flag is not set.
 * particular file and the "nocto" mount flag is not set.
 *
 *
 */
 */
static inline
static
int nfs_lookup_verify_inode(struct inode *inode, unsigned int flags)
int nfs_lookup_verify_inode(struct inode *inode, unsigned int flags)
{
{
	struct nfs_server *server = NFS_SERVER(inode);
	struct nfs_server *server = NFS_SERVER(inode);
	int ret;


	if (IS_AUTOMOUNT(inode))
	if (IS_AUTOMOUNT(inode))
		return 0;
		return 0;
@@ -992,9 +993,13 @@ int nfs_lookup_verify_inode(struct inode *inode, unsigned int flags)
	if ((flags & LOOKUP_OPEN) && !(server->flags & NFS_MOUNT_NOCTO) &&
	if ((flags & LOOKUP_OPEN) && !(server->flags & NFS_MOUNT_NOCTO) &&
	    (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)))
	    (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)))
		goto out_force;
		goto out_force;
	return 0;
out:
	return (inode->i_nlink == 0) ? -ENOENT : 0;
out_force:
out_force:
	return __nfs_revalidate_inode(server, inode);
	ret = __nfs_revalidate_inode(server, inode);
	if (ret != 0)
		return ret;
	goto out;
}
}


/*
/*