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.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 296EBC63777 for ; Tue, 24 Nov 2020 04:27:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4E63E2085B for ; Tue, 24 Nov 2020 04:27:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="Qo/w8pRw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4E63E2085B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 6AC556B005D; Mon, 23 Nov 2020 23:27:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 65B5B6B006E; Mon, 23 Nov 2020 23:27:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 523286B0070; Mon, 23 Nov 2020 23:27:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0025.hostedemail.com [216.40.44.25]) by kanga.kvack.org (Postfix) with ESMTP id 235F36B005D for ; Mon, 23 Nov 2020 23:27:09 -0500 (EST) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id B97B03626 for ; Tue, 24 Nov 2020 04:27:08 +0000 (UTC) X-FDA: 77518026936.22.dock57_04157372736b Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin22.hostedemail.com (Postfix) with ESMTP id 9EA0518038E60 for ; Tue, 24 Nov 2020 04:27:08 +0000 (UTC) X-HE-Tag: dock57_04157372736b X-Filterd-Recvd-Size: 4969 Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) by imf01.hostedemail.com (Postfix) with ESMTP for ; Tue, 24 Nov 2020 04:27:08 +0000 (UTC) Received: by mail-lf1-f44.google.com with SMTP id z21so26921479lfe.12 for ; Mon, 23 Nov 2020 20:27:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=24cszGpR4ywO4s4bnLwJTzF6tXtNEZ3Sx4FvfUI5fRM=; b=Qo/w8pRweB3KyHg3F/WpjXkumwlz+D/AvIsfhGajTbc5rxWuFX6axMRr2JB4kSL4pA hIBC4OqrP3RwB25oHrD6ZaKBqVFGtNoYL6Y4nSMoCfYeCeQOINqE3jTOyTbnWeWoHLiI UkFQ9R+vhIKbEe6WKzj2zXtFUjc557jUOVygU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=24cszGpR4ywO4s4bnLwJTzF6tXtNEZ3Sx4FvfUI5fRM=; b=rO6s8kaQAHFuW/Lh3uENk0OGYgCswHT8hk7gWqzwhJJGJUXIaxqKIzNvZBv29SXxlw VU/4fU5r5zRQp5Oz6PBUmXPDy90DtTVQdiJtvbM1iOmdlfj+adpwFj08zsjLbyt9ue54 NdAfcq5bzu/MI7ycuDp+zgfkQluYHgN21L6piGUnAs1BsrY05JdNStz4Hf1C+s6LZzDF qLbERG44nEtdmhxo7LNc+BAqUZMhjoR03g71NGrm0Fp9J/x0Xa78sL2QIiLmti71HSjy UqMdkdzyHjvhqcNpJbMDQW4U4TfywgBNf6SBtkVKzOuQzRr79lBd05ek+qFFMSUGxxTw Ojfw== X-Gm-Message-State: AOAM531UxeniFixxTSxxJEsS8ifNPYJP0SdIHHUuH3MvApEkOq+4guDw fCot8m6f2D06Bzy1VBt64hF4Q2H3o89Zjw== X-Google-Smtp-Source: ABdhPJzJXwvHkAGNL6skErAsZlBXeGK4BdTm92mSHJOrp4YhPlEk0+qVufveI63snbJJ6IeGyNX2hg== X-Received: by 2002:a19:c7c5:: with SMTP id x188mr1077316lff.364.1606192025881; Mon, 23 Nov 2020 20:27:05 -0800 (PST) Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com. [209.85.167.54]) by smtp.gmail.com with ESMTPSA id u4sm181615lju.47.2020.11.23.20.27.04 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 23 Nov 2020 20:27:04 -0800 (PST) Received: by mail-lf1-f54.google.com with SMTP id r24so10816440lfm.8 for ; Mon, 23 Nov 2020 20:27:04 -0800 (PST) X-Received: by 2002:a19:3f55:: with SMTP id m82mr1019862lfa.344.1606192024162; Mon, 23 Nov 2020 20:27:04 -0800 (PST) MIME-Version: 1.0 References: <000000000000d3a33205add2f7b2@google.com> <20200828100755.GG7072@quack2.suse.cz> <20200831100340.GA26519@quack2.suse.cz> In-Reply-To: From: Linus Torvalds Date: Mon, 23 Nov 2020 20:26:48 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: kernel BUG at fs/ext4/inode.c:LINE! To: Hugh Dickins Cc: Jan Kara , syzbot , Andreas Dilger , Ext4 Developers List , Linux Kernel Mailing List , syzkaller-bugs , "Theodore Ts'o" , Linux-MM , Oleg Nesterov , Andrew Morton , "Kirill A. Shutemov" , Nicholas Piggin , Alex Shi , Qian Cai , Christoph Hellwig , "Darrick J. Wong" , Matthew Wilcox , William Kucharski , Jens Axboe , linux-fsdevel , linux-xfs Content-Type: text/plain; charset="UTF-8" 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 Mon, Nov 23, 2020 at 8:07 PM Hugh Dickins wrote: > > The problem is that PageWriteback is not accompanied by a page reference > (as the NOTE at the end of test_clear_page_writeback() acknowledges): as > soon as TestClearPageWriteback has been done, that page could be removed > from page cache, freed, and reused for something else by the time that > wake_up_page() is reached. Ugh. Would it be possible to instead just make PageWriteback take the ref? I don't hate your patch per se, but looking at that long explanation, and looking at the gyrations end_page_writeback() does, I go "why don't we do that?" IOW, why couldn't we just make the __test_set_page_writeback() increment the page count if the writeback flag wasn't already set, and then make the end_page_writeback() do a put_page() after it all? Linus