Re: [RFC][PATCH 02/10] fs: Avoid looking at i_count without i_lock held

From: Peter Zijlstra
Date: Fri Feb 24 2017 - 12:06:32 EST


On Fri, Feb 24, 2017 at 08:56:06AM -0800, Linus Torvalds wrote:
> This one looks very questionable.
>
> Taking the lock for every single inode, even when we can tell that it's
> pointless, is horrid.
>
> Even if you really think you found a race, i think it would be better to
> leave the unlocked read around as an optimistic check, and then do a safe
> double check read inside the lock (together with the i_state checks)
>
> Hmm?

Yeah, pretty dumb that.