diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-02 11:38:06 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-02 11:38:06 -0700 |
commit | 15570086b590a69d59183b08a7770e316cca20a7 (patch) | |
tree | 12c1494a59a3786bc99674567aa9b77af40a3698 /fs/dcache.c | |
parent | df3d0bbcdb2cafa23a70223d806655bd37e64a9b (diff) | |
download | linux-15570086b590a69d59183b08a7770e316cca20a7.tar.gz linux-15570086b590a69d59183b08a7770e316cca20a7.tar.bz2 linux-15570086b590a69d59183b08a7770e316cca20a7.zip |
vfs: reimplement d_rcu_to_refcount() using lockref_get_or_lock()
This moves __d_rcu_to_refcount() from <linux/dcache.h> into fs/namei.c
and re-implements it using the lockref infrastructure instead. It also
adds a lot of comments about what is actually going on, because turning
a dentry that was looked up using RCU into a long-lived reference
counted entry is one of the more subtle parts of the rcu walk.
We also used to be _particularly_ subtle in unlazy_walk() where we
re-validate both the dentry and its parent using the same sequence
count. We used to do it by nesting the locks and then verifying the
sequence count just once.
That was silly, because nested locking is expensive, but the sequence
count check is not. So this just re-validates the dentry and the parent
separately, avoiding the nested locking, and making the lockref lookup
possible.
Acked-by: Waiman Long <waiman.long@hp.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/dcache.c')
-rw-r--r-- | fs/dcache.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/dcache.c b/fs/dcache.c index 2d244227999d..96655f4f4574 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -1786,7 +1786,7 @@ static noinline enum slow_d_compare slow_dentry_cmp( * without taking d_lock and checking d_seq sequence count against @seq * returned here. * - * A refcount may be taken on the found dentry with the __d_rcu_to_refcount + * A refcount may be taken on the found dentry with the d_rcu_to_refcount * function. * * Alternatively, __d_lookup_rcu may be called again to look up the child of |