Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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.net
Signed-off-by: Ian 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: Andrew Morton <akpm@linux-foundation.org>

authored by

Ian Kent and committed by
akpm
9ccbac76 f71381fc

+1 -4
+1
fs/autofs/inode.c
··· 20 20 INIT_LIST_HEAD(&ino->expiring); 21 21 ino->last_used = jiffies; 22 22 ino->sbi = sbi; 23 + ino->count = 1; 23 24 } 24 25 return ino; 25 26 }
-4
fs/autofs/root.c
··· 582 582 d_add(dentry, inode); 583 583 584 584 dget(dentry); 585 - ino->count++; 586 585 p_ino = autofs_dentry_ino(dentry->d_parent); 587 586 p_ino->count++; 588 587 ··· 611 612 struct autofs_info *ino = autofs_dentry_ino(dentry); 612 613 struct autofs_info *p_ino; 613 614 614 - ino->count--; 615 615 p_ino = autofs_dentry_ino(dentry->d_parent); 616 616 p_ino->count--; 617 617 dput(ino->dentry); ··· 693 695 if (sbi->version < 5) 694 696 autofs_clear_leaf_automount_flags(dentry); 695 697 696 - ino->count--; 697 698 p_ino = autofs_dentry_ino(dentry->d_parent); 698 699 p_ino->count--; 699 700 dput(ino->dentry); ··· 731 734 autofs_set_leaf_automount_flags(dentry); 732 735 733 736 dget(dentry); 734 - ino->count++; 735 737 p_ino = autofs_dentry_ino(dentry->d_parent); 736 738 p_ino->count++; 737 739 inc_nlink(dir);