Skip to content

Commit

Permalink
kernfs: dont call d_splice_alias() under kernfs node lock
Browse files Browse the repository at this point in the history
The call to d_splice_alias() in kernfs_iop_lookup() doesn't depend on
any kernfs node so there's no reason to hold the kernfs node lock when
calling it.

Reviewed-by: Miklos Szeredi <[email protected]>
Signed-off-by: Ian Kent <[email protected]>
Link: https://lore.kernel.org/r/162642772000.63632.10672683419693513226.stgit@web.messagingengine.com
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
raven-au authored and gregkh committed Jul 27, 2021
1 parent 47b5c64 commit df6192f
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions fs/kernfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,6 @@ static struct dentry *kernfs_iop_lookup(struct inode *dir,
struct dentry *dentry,
unsigned int flags)
{
struct dentry *ret;
struct kernfs_node *parent = dir->i_private;
struct kernfs_node *kn;
struct inode *inode = NULL;
Expand All @@ -1120,11 +1119,10 @@ static struct dentry *kernfs_iop_lookup(struct inode *dir,
/* Needed only for negative dentry validation */
if (!inode)
kernfs_set_rev(parent, dentry);
/* instantiate and hash (possibly negative) dentry */
ret = d_splice_alias(inode, dentry);
up_read(&kernfs_rwsem);

return ret;
/* instantiate and hash (possibly negative) dentry */
return d_splice_alias(inode, dentry);
}

static int kernfs_iop_mkdir(struct user_namespace *mnt_userns,
Expand Down

0 comments on commit df6192f

Please sign in to comment.