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 X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B78AC56201 for ; Mon, 26 Oct 2020 09:49:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4705820874 for ; Mon, 26 Oct 2020 09:49:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391448AbgJZJtz (ORCPT ); Mon, 26 Oct 2020 05:49:55 -0400 Received: from mx2.suse.de ([195.135.220.15]:47962 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1768620AbgJZJtu (ORCPT ); Mon, 26 Oct 2020 05:49:50 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 8E924B2CB; Mon, 26 Oct 2020 09:49:49 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id E72A81E10F5; Mon, 26 Oct 2020 10:49:48 +0100 (CET) Date: Mon, 26 Oct 2020 10:49:48 +0100 From: Jan Kara To: Matthew Wilcox Cc: Qian Cai , Christoph Hellwig , "Darrick J. Wong" , linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Jens Axboe , linux-mm@kvack.org Subject: Re: kernel BUG at mm/page-writeback.c:2241 [ BUG_ON(PageWriteback(page); ] Message-ID: <20201026094948.GA29758@quack2.suse.cz> References: <645a3f332f37e09057c10bc32f4f298ce56049bb.camel@lca.pw> <20201022004906.GQ20115@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201022004906.GQ20115@casper.infradead.org> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 22-10-20 01:49:06, Matthew Wilcox wrote: > On Wed, Oct 21, 2020 at 08:30:18PM -0400, Qian Cai wrote: > > Today's linux-next starts to trigger this wondering if anyone has any clue. > > I've seen that occasionally too. I changed that BUG_ON to VM_BUG_ON_PAGE > to try to get a clue about it. Good to know it's not the THP patches > since they aren't in linux-next. > > I don't understand how it can happen. We have the page locked, and then we do: > > if (PageWriteback(page)) { > if (wbc->sync_mode != WB_SYNC_NONE) > wait_on_page_writeback(page); > else > goto continue_unlock; > } > > VM_BUG_ON_PAGE(PageWriteback(page), page); > > Nobody should be able to put this page under writeback while we have it > locked ... right? The page can be redirtied by the code that's supposed > to be writing it back, but I don't see how anyone can make PageWriteback > true while we're holding the page lock. FWIW here's very similar report for ext4 [1] and I strongly suspect this started happening after Linus' rewrite of the page bit waiting logic. Linus thinks it's preexisting bug which just got exposed by his changes (which is possible). I've been searching a culprit for some time but so far I failed. It's good to know it isn't ext4 specific so we should be searching in the generic code ;). So far I was concentrating more on ext4 bits... Honza [1] https://lore.kernel.org/lkml/000000000000d3a33205add2f7b2@google.com/ -- Jan Kara SUSE Labs, CR