mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 16:44:58 +02:00
smb/server: use lookup_one_unlocked()
In process_query_dir_entries(), instead of locking the directory, performing a lookup, then unlocking, we can simply call lookup_one_unlocked(). That takes locks the directory only when needed. This removes the only users of lock_dir() and unlock_dir() so they can be removed. Signed-off-by: NeilBrown <neil@brown.name> Acked-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
parent
89be9a83cc
commit
09f124b287
|
|
@ -4108,20 +4108,6 @@ struct smb2_query_dir_private {
|
|||
int info_level;
|
||||
};
|
||||
|
||||
static void lock_dir(struct ksmbd_file *dir_fp)
|
||||
{
|
||||
struct dentry *dir = dir_fp->filp->f_path.dentry;
|
||||
|
||||
inode_lock_nested(d_inode(dir), I_MUTEX_PARENT);
|
||||
}
|
||||
|
||||
static void unlock_dir(struct ksmbd_file *dir_fp)
|
||||
{
|
||||
struct dentry *dir = dir_fp->filp->f_path.dentry;
|
||||
|
||||
inode_unlock(d_inode(dir));
|
||||
}
|
||||
|
||||
static int process_query_dir_entries(struct smb2_query_dir_private *priv)
|
||||
{
|
||||
struct mnt_idmap *idmap = file_mnt_idmap(priv->dir_fp->filp);
|
||||
|
|
@ -4136,12 +4122,10 @@ static int process_query_dir_entries(struct smb2_query_dir_private *priv)
|
|||
if (dentry_name(priv->d_info, priv->info_level))
|
||||
return -EINVAL;
|
||||
|
||||
lock_dir(priv->dir_fp);
|
||||
dent = lookup_one(idmap,
|
||||
&QSTR_LEN(priv->d_info->name,
|
||||
priv->d_info->name_len),
|
||||
priv->dir_fp->filp->f_path.dentry);
|
||||
unlock_dir(priv->dir_fp);
|
||||
dent = lookup_one_unlocked(idmap,
|
||||
&QSTR_LEN(priv->d_info->name,
|
||||
priv->d_info->name_len),
|
||||
priv->dir_fp->filp->f_path.dentry);
|
||||
|
||||
if (IS_ERR(dent)) {
|
||||
ksmbd_debug(SMB, "Cannot lookup `%s' [%ld]\n",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user