[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191022145053.GY26530@ZenIV.linux.org.uk>
Date: Tue, 22 Oct 2019 15:50:53 +0100
From: Al Viro <viro@...iv.linux.org.uk>
To: Ritesh Harjani <riteshh@...ux.ibm.com>
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
wugyuan@...ibm.com, jlayton@...nel.org, hsiangkao@....com,
Jan Kara <jack@...e.cz>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH RESEND 1/1] vfs: Really check for inode ptr in lookup_fast
On Tue, Oct 22, 2019 at 03:37:36PM +0100, Al Viro wrote:
> I'm somewhat tempted to make __d_set_inode_and_type() do smp_store_release()
> for setting ->d_flags and __d_entry_type() - smp_load_acquire(); that would
> be pretty much free for x86 (as well as sparc, s390 and itanic) and reasonably
> cheap on ppc and arm64. How badly would e.g. SMP arm suffer from the below
> (completely untested)?
PS: if we really go that way, we'd probably want __d_is_negative(), to be
used only under ->d_lock or with ->d_seq validation.
d_is_negative() callers in fs/dcache.c (all under ->d_lock) as well as
the RCU-side one in lookup_fast() (->d_seq validated) would you that.
Another fun place is do_unlinkat() - there we want to reorder
inode = dentry->d_inode;
if (d_is_negative(dentry))
goto slashes;
As it were, the same race here can lead to unbalanced iput(), if you
hit the window just right.
Powered by blists - more mailing lists