lkml.org 
[lkml]   [2018]   [Feb]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/4] fs/dcache: Avoid the try_lock loop in d_delete()
On Fri, Feb 16, 2018 at 04:09:32PM +0100, John Ogness wrote:
>
> inode = dentry->d_inode;
> rcu_read_lock(); <- Protects d_inode from being freed,
> i.e. dentry->d_inode is a valid pointer
> even after dentry->d_lock is dropped
> unlock(dentry->d_lock);
> lock(inode->i_lock);
> lock(dentry->d_lock);
> rcu_read_unlock();

So that is entirely tricky, typically we have to have a lookup _after_
rcu_read_lock().

Here, we rely on not being able to call dentry_free() while we hold
d_lock, which ensure dentry must be valid in the freshly started
rcu-section.

And I suppose that same ensures dentry->d_ionde stays alive. But this
needs a comment at least.

\
 
 \ /
  Last update: 2018-02-16 18:31    [W:0.082 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site