From: Al Viro Date: Wed, 18 Sep 2019 03:28:08 +0000 (-0400) Subject: autofs_dir_rmdir(): check ino->count for deciding whether it's empty... X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=c3aed16680cd0c0e5abf1bfc0dc1338e6a41b29f;p=linux.git autofs_dir_rmdir(): check ino->count for deciding whether it's empty... Signed-off-by: Al Viro --- diff --git a/fs/autofs/root.c b/fs/autofs/root.c index 7806b110e79d5..ae1d112b6f649 100644 --- a/fs/autofs/root.c +++ b/fs/autofs/root.c @@ -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);