mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
autofs_lookup(): hold ->d_lock over playing with ->d_flags
... as well as setting ->d_fsdata, etc. Make all of that atomic. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
c4931db9b0
commit
5f68056ca5
1 changed files with 7 additions and 6 deletions
|
@ -504,21 +504,22 @@ static struct dentry *autofs_lookup(struct inode *dir,
|
||||||
if (!autofs_oz_mode(sbi) && !IS_ROOT(dentry->d_parent))
|
if (!autofs_oz_mode(sbi) && !IS_ROOT(dentry->d_parent))
|
||||||
return ERR_PTR(-ENOENT);
|
return ERR_PTR(-ENOENT);
|
||||||
|
|
||||||
/* Mark entries in the root as mount triggers */
|
|
||||||
if (IS_ROOT(dentry->d_parent) &&
|
|
||||||
autofs_type_indirect(sbi->type))
|
|
||||||
__managed_dentry_set_managed(dentry);
|
|
||||||
|
|
||||||
ino = autofs_new_ino(sbi);
|
ino = autofs_new_ino(sbi);
|
||||||
if (!ino)
|
if (!ino)
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
|
spin_lock(&sbi->lookup_lock);
|
||||||
|
spin_lock(&dentry->d_lock);
|
||||||
|
/* Mark entries in the root as mount triggers */
|
||||||
|
if (IS_ROOT(dentry->d_parent) &&
|
||||||
|
autofs_type_indirect(sbi->type))
|
||||||
|
__managed_dentry_set_managed(dentry);
|
||||||
dentry->d_fsdata = ino;
|
dentry->d_fsdata = ino;
|
||||||
ino->dentry = dentry;
|
ino->dentry = dentry;
|
||||||
|
|
||||||
spin_lock(&sbi->lookup_lock);
|
|
||||||
list_add(&ino->active, &sbi->active_list);
|
list_add(&ino->active, &sbi->active_list);
|
||||||
spin_unlock(&sbi->lookup_lock);
|
spin_unlock(&sbi->lookup_lock);
|
||||||
|
spin_unlock(&dentry->d_lock);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue