summaryrefslogtreecommitdiffstats
path: root/fs/autofs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2019-07-27 10:00:33 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2019-07-27 10:00:33 -0400
commitc4931db9b08c18005fb21ab201e7137ba0547df5 (patch)
tree6c6e20e3253187809b0f9ff5cf558522ad62d132 /fs/autofs
parentff09297ec9964b3fe4bade77c92c75fde34fa8e9 (diff)
downloadlinux-stable-c4931db9b08c18005fb21ab201e7137ba0547df5.tar.gz
linux-stable-c4931db9b08c18005fb21ab201e7137ba0547df5.tar.bz2
linux-stable-c4931db9b08c18005fb21ab201e7137ba0547df5.zip
get rid of autofs_info->active_count
autofs_add_active() is always called only once (and on a dentry with freshly allocated ino, at that). autofs_del_active() is never called more than once. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/autofs')
-rw-r--r--fs/autofs/autofs_i.h1
-rw-r--r--fs/autofs/root.c33
2 files changed, 6 insertions, 28 deletions
diff --git a/fs/autofs/autofs_i.h b/fs/autofs/autofs_i.h
index 8c0c11181fad..8bcec8dcabb6 100644
--- a/fs/autofs/autofs_i.h
+++ b/fs/autofs/autofs_i.h
@@ -58,7 +58,6 @@ struct autofs_info {
struct completion expire_complete;
struct list_head active;
- int active_count;
struct list_head expiring;
diff --git a/fs/autofs/root.c b/fs/autofs/root.c
index e646569c75ed..64f974c61068 100644
--- a/fs/autofs/root.c
+++ b/fs/autofs/root.c
@@ -60,38 +60,15 @@ const struct dentry_operations autofs_dentry_operations = {
.d_release = autofs_dentry_release,
};
-static void autofs_add_active(struct dentry *dentry)
-{
- struct autofs_sb_info *sbi = autofs_sbi(dentry->d_sb);
- struct autofs_info *ino;
-
- ino = autofs_dentry_ino(dentry);
- if (ino) {
- spin_lock(&sbi->lookup_lock);
- if (!ino->active_count) {
- if (list_empty(&ino->active))
- list_add(&ino->active, &sbi->active_list);
- }
- ino->active_count++;
- spin_unlock(&sbi->lookup_lock);
- }
-}
-
static void autofs_del_active(struct dentry *dentry)
{
struct autofs_sb_info *sbi = autofs_sbi(dentry->d_sb);
struct autofs_info *ino;
ino = autofs_dentry_ino(dentry);
- if (ino) {
- spin_lock(&sbi->lookup_lock);
- ino->active_count--;
- if (!ino->active_count) {
- if (!list_empty(&ino->active))
- list_del_init(&ino->active);
- }
- spin_unlock(&sbi->lookup_lock);
- }
+ spin_lock(&sbi->lookup_lock);
+ list_del_init(&ino->active);
+ spin_unlock(&sbi->lookup_lock);
}
static int autofs_dir_open(struct inode *inode, struct file *file)
@@ -539,7 +516,9 @@ static struct dentry *autofs_lookup(struct inode *dir,
dentry->d_fsdata = ino;
ino->dentry = dentry;
- autofs_add_active(dentry);
+ spin_lock(&sbi->lookup_lock);
+ list_add(&ino->active, &sbi->active_list);
+ spin_unlock(&sbi->lookup_lock);
}
return NULL;
}