diff options
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 (patch) | |
tree | 5e8cda90d34d2589612f16c2aa88319ec31a2a19 /fs/autofs/root.c | |
parent | c4931db9b08c18005fb21ab201e7137ba0547df5 (diff) |
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>
Diffstat (limited to 'fs/autofs/root.c')
-rw-r--r-- | fs/autofs/root.c | 13 |
1 files 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, | |||
504 | if (!autofs_oz_mode(sbi) && !IS_ROOT(dentry->d_parent)) | 504 | if (!autofs_oz_mode(sbi) && !IS_ROOT(dentry->d_parent)) |
505 | return ERR_PTR(-ENOENT); | 505 | return ERR_PTR(-ENOENT); |
506 | 506 | ||
507 | /* Mark entries in the root as mount triggers */ | ||
508 | if (IS_ROOT(dentry->d_parent) && | ||
509 | autofs_type_indirect(sbi->type)) | ||
510 | __managed_dentry_set_managed(dentry); | ||
511 | |||
512 | ino = autofs_new_ino(sbi); | 507 | ino = autofs_new_ino(sbi); |
513 | if (!ino) | 508 | if (!ino) |
514 | return ERR_PTR(-ENOMEM); | 509 | return ERR_PTR(-ENOMEM); |
515 | 510 | ||
511 | spin_lock(&sbi->lookup_lock); | ||
512 | spin_lock(&dentry->d_lock); | ||
513 | /* Mark entries in the root as mount triggers */ | ||
514 | if (IS_ROOT(dentry->d_parent) && | ||
515 | autofs_type_indirect(sbi->type)) | ||
516 | __managed_dentry_set_managed(dentry); | ||
516 | dentry->d_fsdata = ino; | 517 | dentry->d_fsdata = ino; |
517 | ino->dentry = dentry; | 518 | ino->dentry = dentry; |
518 | 519 | ||
519 | spin_lock(&sbi->lookup_lock); | ||
520 | list_add(&ino->active, &sbi->active_list); | 520 | list_add(&ino->active, &sbi->active_list); |
521 | spin_unlock(&sbi->lookup_lock); | 521 | spin_unlock(&sbi->lookup_lock); |
522 | spin_unlock(&dentry->d_lock); | ||
522 | } | 523 | } |
523 | return NULL; | 524 | return NULL; |
524 | } | 525 | } |