linux/fs/autofs4
NeilBrown 4d885f90e3 autofs4: avoid taking fs_lock during rcu-walk
->fs_lock protects AUTOFS_INF_EXPIRING.  We need to be sure that once
the flag is set, no new references beneath the dentry are taken.  So
rcu-walk currently needs to take fs_lock before checking the flag.  This
hurts performance.

Change the expiry to a two-stage process.  First set AUTOFS_INF_NO_RCU
which forces any path walk into ref-walk mode, then drop the lock and
call synchronize_rcu().  Once that returns we can be sure no rcu-walk is
active beneath the dentry and we can check reference counts again.

Now during an RCU-walk we can test AUTOFS_INF_EXPIRING without taking
the lock as along as we test AUTOFS_INF_NO_RCU too.  If either are set,
we must abort the RCU-walk If neither are set, we know that refcounts
will be tested again after we finish the RCU-walk so we are safe to
continue.

->fs_lock is still taken in d_manage() to check for a non-trap
directory.  That will be resolved in the next patch.

Signed-off-by: NeilBrown <neilb@suse.de>
Reviewed-by: Ian Kent <raven@themaw.net>
Tested-by: Ian Kent <raven@themaw.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-10-14 02:18:16 +02:00
..
autofs_i.h autofs4: avoid taking fs_lock during rcu-walk 2014-10-14 02:18:16 +02:00
dev-ioctl.c autofs4: allow RCU-walk to walk through autofs4 2014-10-14 02:18:16 +02:00
expire.c autofs4: avoid taking fs_lock during rcu-walk 2014-10-14 02:18:16 +02:00
init.c fs: Limit sys_mount to only request filesystem modules. 2013-03-03 19:36:31 -08:00
inode.c autofs4: fix false positive compile error 2014-07-03 09:21:53 -07:00
Kconfig fs/Kconfig: move autofs, autofs4 out 2009-01-22 13:15:54 +03:00
Makefile autofs4: add miscellaneous device for ioctls 2008-10-16 11:21:39 -07:00
root.c autofs4: allow RCU-walk to walk through autofs4 2014-10-14 02:18:16 +02:00
symlink.c autofs: fix symlinks aren't checked for expiry 2014-01-23 16:36:59 -08:00
waitq.c autofs4: translate pids to the right namespace for the daemon 2014-01-23 16:36:59 -08:00