Commit fd7eaee2 authored by Linus Torvalds's avatar Linus Torvalds

Fix a very theoretical race between the new RCU lookup and

concurrent renames in another directory.

I doubt this can be triggered in practice, and the fix is
a bit heavy-handed, but let's see if numbers can show that
the simple fix doesn't show any real lock contention.
parent 3b8c61c9
......@@ -342,8 +342,18 @@ static struct dentry * real_lookup(struct dentry * parent, struct qstr * name, i
*
* FIXME! This could use version numbering or similar to
* avoid unnecessary cache lookups.
*
* The "dcache_lock" is purely to protect the RCU list walker
* from concurrent renames at this point (we mustn't get false
* negatives from the RCU list walk here, unlike the optimistic
* fast walk).
*
* We really should do a sequence number thing to avoid this
* all.
*/
spin_lock(&dcache_lock);
result = d_lookup(parent, name);
spin_unlock(&dcache_lock);
if (!result) {
struct dentry * dentry = d_alloc(parent, name);
result = ERR_PTR(-ENOMEM);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment