Commit 9ccbac76 authored by Ian Kent's avatar Ian Kent Committed by akpm

autofs: make dentry info count consistent

If an autofs dentry is a mount root directory there's no ->mkdir() call to
set its count to one.

To make the dentry info count consistent for all autofs dentries set count
to one when the dentry info struct is allocated.

Link: https://lkml.kernel.org/r/165724458671.30914.2902424437132835325.stgit@donald.themaw.netSigned-off-by: default avatarIan Kent <raven@themaw.net>
Cc: Al Viro <viro@ZenIV.linux.org.uk>
Cc: David Howells <dhowells@redhat.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent f71381fc
...@@ -20,6 +20,7 @@ struct autofs_info *autofs_new_ino(struct autofs_sb_info *sbi) ...@@ -20,6 +20,7 @@ struct autofs_info *autofs_new_ino(struct autofs_sb_info *sbi)
INIT_LIST_HEAD(&ino->expiring); INIT_LIST_HEAD(&ino->expiring);
ino->last_used = jiffies; ino->last_used = jiffies;
ino->sbi = sbi; ino->sbi = sbi;
ino->count = 1;
} }
return ino; return ino;
} }
......
...@@ -582,7 +582,6 @@ static int autofs_dir_symlink(struct user_namespace *mnt_userns, ...@@ -582,7 +582,6 @@ static int autofs_dir_symlink(struct user_namespace *mnt_userns,
d_add(dentry, inode); d_add(dentry, inode);
dget(dentry); dget(dentry);
ino->count++;
p_ino = autofs_dentry_ino(dentry->d_parent); p_ino = autofs_dentry_ino(dentry->d_parent);
p_ino->count++; p_ino->count++;
...@@ -612,7 +611,6 @@ static int autofs_dir_unlink(struct inode *dir, struct dentry *dentry) ...@@ -612,7 +611,6 @@ static int autofs_dir_unlink(struct inode *dir, struct dentry *dentry)
struct autofs_info *ino = autofs_dentry_ino(dentry); struct autofs_info *ino = autofs_dentry_ino(dentry);
struct autofs_info *p_ino; struct autofs_info *p_ino;
ino->count--;
p_ino = autofs_dentry_ino(dentry->d_parent); p_ino = autofs_dentry_ino(dentry->d_parent);
p_ino->count--; p_ino->count--;
dput(ino->dentry); dput(ino->dentry);
...@@ -695,7 +693,6 @@ static int autofs_dir_rmdir(struct inode *dir, struct dentry *dentry) ...@@ -695,7 +693,6 @@ static int autofs_dir_rmdir(struct inode *dir, struct dentry *dentry)
if (sbi->version < 5) if (sbi->version < 5)
autofs_clear_leaf_automount_flags(dentry); autofs_clear_leaf_automount_flags(dentry);
ino->count--;
p_ino = autofs_dentry_ino(dentry->d_parent); p_ino = autofs_dentry_ino(dentry->d_parent);
p_ino->count--; p_ino->count--;
dput(ino->dentry); dput(ino->dentry);
...@@ -734,7 +731,6 @@ static int autofs_dir_mkdir(struct user_namespace *mnt_userns, ...@@ -734,7 +731,6 @@ static int autofs_dir_mkdir(struct user_namespace *mnt_userns,
autofs_set_leaf_automount_flags(dentry); autofs_set_leaf_automount_flags(dentry);
dget(dentry); dget(dentry);
ino->count++;
p_ino = autofs_dentry_ino(dentry->d_parent); p_ino = autofs_dentry_ino(dentry->d_parent);
p_ino->count++; p_ino->count++;
inc_nlink(dir); inc_nlink(dir);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment