autofs_dir_rmdir(): check ino->count for deciding whether it's empty...
authorAl Viro <viro@zeniv.linux.org.uk>
Wed, 18 Sep 2019 03:28:08 +0000 (23:28 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Wed, 18 Sep 2019 03:28:08 +0000 (23:28 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/autofs/root.c

index 7806b11..ae1d112 100644 (file)
@@ -691,11 +691,10 @@ static int autofs_dir_rmdir(struct inode *dir, struct dentry *dentry)
        if (sbi->flags & AUTOFS_SBI_CATATONIC)
                return -EACCES;
 
-       spin_lock(&sbi->lookup_lock);
-       if (!simple_empty(dentry)) {
-               spin_unlock(&sbi->lookup_lock);
+       if (atomic_read(&ino->count) != 1)
                return -ENOTEMPTY;
-       }
+
+       spin_lock(&sbi->lookup_lock);
        __autofs_add_expiring(dentry);
        d_drop(dentry);
        spin_unlock(&sbi->lookup_lock);