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
..
2014-10-09 02:39:04 -04:00
2014-08-08 15:57:24 -07:00
2014-08-08 15:57:20 -07:00
2014-06-04 16:53:53 -07:00
2014-10-09 02:38:57 -04:00
2014-08-07 14:40:09 -04:00
2014-09-26 08:10:34 -07:00
2014-01-25 03:14:05 -05:00
2014-10-09 22:25:46 -04:00
2014-07-31 15:52:51 +03:00
2014-10-09 13:06:14 +02:00
2014-09-26 21:17:52 -04:00
2014-09-24 13:31:50 -04:00
2014-08-07 14:40:09 -04:00
2013-10-24 23:34:54 -04:00
2013-10-24 23:34:54 -04:00
2014-08-07 14:40:08 -04:00
2014-05-06 17:39:42 -04:00
2014-04-01 23:19:08 -04:00
2014-08-26 09:35:56 +02:00
2013-11-09 00:16:31 -05:00
2014-08-27 11:17:48 +02:00