From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69072C433EF for ; Sun, 13 Mar 2022 06:23:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D1D2B8D0002; Sun, 13 Mar 2022 01:23:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CCCDC8D0001; Sun, 13 Mar 2022 01:23:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BBB8D8D0002; Sun, 13 Mar 2022 01:23:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0122.hostedemail.com [216.40.44.122]) by kanga.kvack.org (Postfix) with ESMTP id A86328D0001 for ; Sun, 13 Mar 2022 01:23:56 -0500 (EST) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 4EA658249980 for ; Sun, 13 Mar 2022 06:23:56 +0000 (UTC) X-FDA: 79238372472.17.94D0467 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf09.hostedemail.com (Postfix) with ESMTP id ACC4E140019 for ; Sun, 13 Mar 2022 06:23:55 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 16DD8B80A28; Sun, 13 Mar 2022 06:23:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84B1BC340F3; Sun, 13 Mar 2022 06:23:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1647152632; bh=r5ve3QQqDztmWSyNqt57pEYrCXV23g3Xex3BHLDSgQ4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=W9tERT6YvLQm6gvnCZbmJtXcLrBMD4jj5tWre40pwg48xvw0Bd7Ioe/L9XpA76+4N aDH/1GZidcyjB1POUFkZ6ChGABFbkE2wqJCNwNwrFRQnCtX829mj2zX9YRiGcpYn0O LonVH573IL59gJhV6OXdmdoGZpSgOgV+1fRSt78U= Date: Sat, 12 Mar 2022 22:23:51 -0800 From: Andrew Morton To: Ryusuke Konishi Cc: Matthew Wilcox , David Hildenbrand , "linux-kernel@vger.kernel.org" , linux-nilfs , "linux-mm@kvack.org" , Linus Torvalds Subject: Re: nilfs: WARNING: CPU: 2 PID: 1510 at include/linux/backing-dev.h:269 __folio_mark_dirty+0x31d/0x3b0 Message-Id: <20220312222351.89844f74d3cf10212f308caf@linux-foundation.org> In-Reply-To: References: <9a20b33d-b38f-b4a2-4742-c1eb5b8e4d6c@redhat.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: ACC4E140019 X-Rspam-User: Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=W9tERT6Y; dmarc=none; spf=pass (imf09.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Stat-Signature: d7d35jbiab8sn37fp4x8jxb33hx4dfk4 X-Rspamd-Server: rspam04 X-HE-Tag: 1647152635-224502 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sun, 13 Mar 2022 15:09:27 +0900 Ryusuke Konishi wrote: > Hi Matthew, and Andrew, > > On Sat, Mar 12, 2022 at 7:56 AM Matthew Wilcox wrote: > > > > On Fri, Mar 11, 2022 at 08:43:57PM +0100, David Hildenbrand wrote: > > > Hi, > > > > > > playing with swapfiles on random file systems, I stumbled over the > > > following nilfs issue (and reproduced it on latest greatest > > > linux/master -- v5.17-rc7+). I did not try finding out when this > > > was introduced and I did not run into this issue on other file > > > systems I tried. > > > > It's a known bug in NILFS, and I think yours is the fifth report > > of it dating back eight months. > > The root cause of this issue is that NILFS uses two page caches > per inode, one for data blocks and another for b-tree node blocks. > > Even though __folio_end_writeback(), __folio_start_writeback(), and > __folio_mark_dirty() acquire lock for mapping->i_pages, > inode_to_wb(inode) inside them performs lockdep test for the former one > (i.e. inode->i_mapping->i_pages.xa_lock). > > So, mark_buffer_dirty(), end_page_writeback(), and set_page_writeback() > for pages in the latter NILFS specific page cache hit the LOCKDEP warning. > > I tried to find a way to resolve this, but have no good idea so far. If things are set up appropriately, inode_to_wb() should be able to test inode->i_mapping->host->i_mapping->i_pages.xa_lock and get the desired result. At least, that's the case with blockdevs. I don't know if nilfs2 sets things up that way.