autofs4: fix indirect mount pending expire race
authorIan Kent <raven@themaw.net>
Thu, 24 Jul 2008 04:30:26 +0000 (21:30 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 24 Jul 2008 17:47:32 +0000 (10:47 -0700)
commit97e7449a7ad883bf9f516fc970778d75999c7843
tree903f6de243847eb12d1a372b271b15046ecdc774
parent26e81b3142f1ba497d4cd0365c13661684b784ce
autofs4: fix indirect mount pending expire race

The selection of a dentry for expiration and the setting of the
AUTOFS_INF_EXPIRING flag isn't done atomically which can lead to lookups
walking into an expiring mount.

What happens is that an expire is initiated by the daemon and a dentry is
selected for expire but, since there is no lock held between the selection
and setting of the expiring flag, a process may find the flag clear and
continue walking into the mount tree at the same time the daemon attempts
the expire it.

Signed-off-by: Ian Kent <raven@themaw.net>
Reviewed-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/autofs4/autofs_i.h
fs/autofs4/expire.c
fs/autofs4/root.c