Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

exportfs: use lookup_one_unlocked()

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>

authored by

NeilBrown and committed by
Christian Brauner
ce349003 8668a0df

+1 -3
+1 -3
fs/exportfs/expfs.c
··· 549 549 goto err_result; 550 550 } 551 551 552 - inode_lock(target_dir->d_inode); 553 - nresult = lookup_one(mnt_idmap(mnt), &QSTR(nbuf), target_dir); 552 + nresult = lookup_one_unlocked(mnt_idmap(mnt), &QSTR(nbuf), target_dir); 554 553 if (!IS_ERR(nresult)) { 555 554 if (unlikely(nresult->d_inode != result->d_inode)) { 556 555 dput(nresult); 557 556 nresult = ERR_PTR(-ESTALE); 558 557 } 559 558 } 560 - inode_unlock(target_dir->d_inode); 561 559 /* 562 560 * At this point we are done with the parent, but it's pinned 563 561 * by the child dentry anyway.