Re: [PATCH 4/5] exportfs: use lookup_one_unlocked()

Jeff Layton <[email protected]>
Newsgroups gmane.comp.file-systems.ecryptfs.general,gmane.linux.file-systems,gmane.comp.file-systems.coda.general,gmane.linux.nfs,gmane.linux.file-systems.union,gmane.linux.kernel
Message-ID <[email protected]>
On Mon, 2025-06-09 at 09:09 +1000, NeilBrown wrote:
> rather than locking the directory and using lookup_one(), just use
> lookup_one_unlocked().  This keeps locking code centralised.
> 
> Signed-off-by: NeilBrown <[email protected]>
> ---
>  fs/exportfs/expfs.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c
> index cdefea17986a..d3e55de4a2a2 100644
> --- a/fs/exportfs/expfs.c
> +++ b/fs/exportfs/expfs.c
> @@ -549,15 +549,13 @@ exportfs_decode_fh_raw(struct vfsmount *mnt, struct fid *fid, int fh_len,
>  			goto err_result;
>  		}
>  
> -		inode_lock(target_dir->d_inode);
> -		nresult = lookup_one(mnt_idmap(mnt), &QSTR(nbuf), target_dir);
> +		nresult = lookup_one_unlocked(mnt_idmap(mnt), &QSTR(nbuf), target_dir);
>  		if (!IS_ERR(nresult)) {
>  			if (unlikely(nresult->d_inode != result->d_inode)) {
>  				dput(nresult);
>  				nresult = ERR_PTR(-ESTALE);
>  			}
>  		}
> -		inode_unlock(target_dir->d_inode);
>  		/*
>  		 * At this point we are done with the parent, but it's pinned
>  		 * by the child dentry anyway.

Reviewed-by: Jeff Layton <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.