From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Thu, 15 Feb 2018 13:01:15 +0000 From: Will Deacon To: Matthew Wilcox Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Peter Zijlstra , Al Viro Subject: Re: [PATCH] fs: dcache: Avoid livelock between d_alloc_parallel and __d_add Message-ID: <20180215130114.GD16623@arm.com> References: <1518526731-26546-1-git-send-email-will.deacon@arm.com> <20180213151608.GA17791@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180213151608.GA17791@bombadil.infradead.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: Hi Matthew, On Tue, Feb 13, 2018 at 07:16:08AM -0800, Matthew Wilcox wrote: > On Tue, Feb 13, 2018 at 12:58:51PM +0000, Will Deacon wrote: > > This patch resolves the livelock by not taking hlist_bl_lock in > > d_alloc_parallel if the sequence counter is odd, since any subsequent > > masked comparison with i_dir_seq will fail anyway. > > > > Cc: Peter Zijlstra > > Cc: Al Viro > > Signed-off-by: Will Deacon > > Reviewed-by: Matthew Wilcox Thanks! > I wonder whether it makes sense to turn i_dir_seq into a seqcount_t, > which would give us the lockdep checking as well. I'm not sure it's quite as simple as that. start_dir_add looks very much like it's intended to run concurrently, so we'd need a write_seqcount implementation that provides the same atomicity guarantees. Will