]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
exportfs: use lookup_one_unlocked()
authorNeilBrown <neil@brown.name>
Sun, 8 Jun 2025 23:09:36 +0000 (09:09 +1000)
committerChristian Brauner <brauner@kernel.org>
Wed, 11 Jun 2025 11:44:15 +0000 (13:44 +0200)
rather than locking the directory and using lookup_one(), just use
lookup_one_unlocked().  This keeps locking code centralised.

Signed-off-by: NeilBrown <neil@brown.name>
Link: https://lore.kernel.org/20250608230952.20539-5-neil@brown.name
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/exportfs/expfs.c

index cdefea17986a92773523665623fb9aa4399df39f..d3e55de4a2a2afe60ec06822ef436f29832dd6a8 100644 (file)
@@ -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.