[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180216173033.GJ25201@hirez.programming.kicks-ass.net>
Date: Fri, 16 Feb 2018 18:30:33 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: John Ogness <john.ogness@...utronix.de>
Cc: linux-fsdevel@...r.kernel.org, Al Viro <viro@...iv.linux.org.uk>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Christoph Hellwig <hch@....de>,
Thomas Gleixner <tglx@...utronix.de>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
linux-kernel@...r.kernel.org,
Paul McKenney <paulmck@...ux.vnet.ibm.com>
Subject: Re: [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.
Powered by blists - more mailing lists