diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2019-09-17 23:23:08 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2019-09-17 23:23:08 -0400 |
commit | 41ca19740a0e772eff1f9ba67293649feb836662 (patch) | |
tree | 0bb26f1187e8c6cb5be54af68e3b68a587f8d864 /fs/autofs | |
parent | e509d6e9c1ab54af257d4ed95b30d41e3d786857 (diff) | |
download | linux-41ca19740a0e772eff1f9ba67293649feb836662.tar.gz linux-41ca19740a0e772eff1f9ba67293649feb836662.tar.bz2 linux-41ca19740a0e772eff1f9ba67293649feb836662.zip |
autofs: get rid of pointless checks around ->count handling
* IS_ROOT can't be true for unlink or rmdir victim
* any positive autofs dentry has non-NULL autofs_dentry_ino()
* autofs symlink can't have ->count other than 1
* autofs empty directory can't have ->count other than 1
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/autofs')
-rw-r--r-- | fs/autofs/root.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/fs/autofs/root.c b/fs/autofs/root.c index 2065281ee8b1..7806b110e79d 100644 --- a/fs/autofs/root.c +++ b/fs/autofs/root.c @@ -571,8 +571,7 @@ static int autofs_dir_symlink(struct inode *dir, dget(dentry); atomic_inc(&ino->count); p_ino = autofs_dentry_ino(dentry->d_parent); - if (p_ino && !IS_ROOT(dentry)) - atomic_inc(&p_ino->count); + atomic_inc(&p_ino->count); dir->i_mtime = current_time(dir); @@ -610,11 +609,9 @@ static int autofs_dir_unlink(struct inode *dir, struct dentry *dentry) if (sbi->flags & AUTOFS_SBI_CATATONIC) return -EACCES; - if (atomic_dec_and_test(&ino->count)) { - p_ino = autofs_dentry_ino(dentry->d_parent); - if (p_ino && !IS_ROOT(dentry)) - atomic_dec(&p_ino->count); - } + atomic_dec(&ino->count); + p_ino = autofs_dentry_ino(dentry->d_parent); + atomic_dec(&p_ino->count); dput(ino->dentry); d_inode(dentry)->i_size = 0; @@ -706,11 +703,9 @@ static int autofs_dir_rmdir(struct inode *dir, struct dentry *dentry) if (sbi->version < 5) autofs_clear_leaf_automount_flags(dentry); - if (atomic_dec_and_test(&ino->count)) { - p_ino = autofs_dentry_ino(dentry->d_parent); - if (p_ino && dentry->d_parent != dentry) - atomic_dec(&p_ino->count); - } + atomic_dec(&ino->count); + p_ino = autofs_dentry_ino(dentry->d_parent); + atomic_dec(&p_ino->count); dput(ino->dentry); d_inode(dentry)->i_size = 0; clear_nlink(d_inode(dentry)); @@ -758,8 +753,7 @@ static int autofs_dir_mkdir(struct inode *dir, dget(dentry); atomic_inc(&ino->count); p_ino = autofs_dentry_ino(dentry->d_parent); - if (p_ino && !IS_ROOT(dentry)) - atomic_inc(&p_ino->count); + atomic_inc(&p_ino->count); inc_nlink(dir); dir->i_mtime = current_time(dir); |