author: Al Viro <viro@zeniv.linux.org.uk> 2019-07-27 10:03:14 -0400
committer: Al Viro <viro@zeniv.linux.org.uk> 2019-07-27 10:03:14 -0400
commit: 5f68056ca50fdd3954a93ae66fea7452abddb66f
parent: c4931db9b08c18005fb21ab201e7137ba0547df5
Commit Summary:
Diffstat:
1 file changed, 7 insertions, 6 deletions
diff --git a/fs/autofs/root.c b/fs/autofs/root.c
index 64f974c61068..29abafc0ce31 100644
--- a/fs/autofs/root.c
+++ b/fs/autofs/root.c
@@ -504,21 +504,22 @@ static struct dentry *autofs_lookup(struct inode *dir,
if (!autofs_oz_mode(sbi) && !IS_ROOT(dentry->d_parent))
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);
if (!ino)
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;
ino->dentry = dentry;
- spin_lock(&sbi->lookup_lock);
list_add(&ino->active, &sbi->active_list);
spin_unlock(&sbi->lookup_lock);
+ spin_unlock(&dentry->d_lock);
}
return NULL;
}