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,URIBL_BLOCKED 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 1F5C5C6379D for ; Wed, 25 Nov 2020 22:01:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5FFE221527 for ; Wed, 25 Nov 2020 22:01:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="K6cXzXGO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5FFE221527 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 80FFC6B006E; Wed, 25 Nov 2020 17:01:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7C1496B0070; Wed, 25 Nov 2020 17:01:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6B3596B0071; Wed, 25 Nov 2020 17:01:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0092.hostedemail.com [216.40.44.92]) by kanga.kvack.org (Postfix) with ESMTP id 513076B006E for ; Wed, 25 Nov 2020 17:01:25 -0500 (EST) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 0E8CB180AD802 for ; Wed, 25 Nov 2020 22:01:25 +0000 (UTC) X-FDA: 77524312530.17.pies71_47163642737a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin17.hostedemail.com (Postfix) with ESMTP id E0037180D0184 for ; Wed, 25 Nov 2020 22:01:24 +0000 (UTC) X-HE-Tag: pies71_47163642737a X-Filterd-Recvd-Size: 5903 Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) by imf48.hostedemail.com (Postfix) with ESMTP for ; Wed, 25 Nov 2020 22:01:24 +0000 (UTC) Received: by mail-lf1-f53.google.com with SMTP id d8so5291411lfa.1 for ; Wed, 25 Nov 2020 14:01:24 -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=AHzxZjopdvwPb49v26gZFbNssQM0UPZ06yGo+z/tU6c=; b=K6cXzXGOWYp0YH8Ec/Cd6PHGW9EpUSbmb9ZLhiSPBPTgyeTuwWtAay+X+GE1FcohAq hcJeoMobg7GDcznqwyVEvp6b40v9HTHCqQ0yBJT4GDTt9n9UsIf+QJAhwPLCQk+aWHsg V4KTpIAvGlGRiVee5Cm69yvIVM2IWQyahDf98= 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=AHzxZjopdvwPb49v26gZFbNssQM0UPZ06yGo+z/tU6c=; b=UVYW6oOmSqugy0/EJU0/wN8YSicPeoLalmMMgO9b/3lRttpTD96oiflt7tTALCHm+R SHKsdtEcUkwfphUUHgsm4o2SXnkL+cx7H2oWVZPe+ywZbEf++cSOvej3UzD4sZIsbH8H uXgw+5QIXOUMn1VLf6O1JCVYkKkfSj6qvo8TdlQHDgATNvanG1ye8AkzPIF2MG0eOtTw uoEhjeh5XMxklpPYFkeJVaj5VBOSJUN3uJdg+LE3xDpGRnxgGLXfAkBV1fVZp/tF+vKT 2B+yK4MeKg0NkIclHbV7YDPBb2ZEXFY3OG+QCLFlqSzIrh9gErsAl+dMhG+fV956a4eP rT0Q== X-Gm-Message-State: AOAM530es+JIbljB8j0QdIajbhxWO8eKoE10VBiJIVcFFY/O1njYbuv4 iOQH0dWyMIjowVcAzgsTeX8NQmcNRamrfg== X-Google-Smtp-Source: ABdhPJwaiyAKAeES/A4SErWWOC7GjeDmDV0C+pIB/9GO61sQRBvtnPMJESxIDlZtYOCmtpLbh2m8gA== X-Received: by 2002:a19:4b45:: with SMTP id y66mr99495lfa.482.1606341682292; Wed, 25 Nov 2020 14:01:22 -0800 (PST) Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com. [209.85.167.42]) by smtp.gmail.com with ESMTPSA id j19sm370216lja.100.2020.11.25.14.01.19 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 25 Nov 2020 14:01:21 -0800 (PST) Received: by mail-lf1-f42.google.com with SMTP id v14so5283755lfo.3 for ; Wed, 25 Nov 2020 14:01:19 -0800 (PST) X-Received: by 2002:a19:ed0f:: with SMTP id y15mr92782lfy.352.1606341679142; Wed, 25 Nov 2020 14:01:19 -0800 (PST) MIME-Version: 1.0 References: <000000000000d3a33205add2f7b2@google.com> <20200828100755.GG7072@quack2.suse.cz> <20200831100340.GA26519@quack2.suse.cz> <20201124121912.GZ4327@casper.infradead.org> <20201124183351.GD4327@casper.infradead.org> <20201124201552.GE4327@casper.infradead.org> In-Reply-To: From: Linus Torvalds Date: Wed, 25 Nov 2020 14:01:03 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: kernel BUG at fs/ext4/inode.c:LINE! To: Hugh Dickins Cc: Matthew Wilcox , 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" , 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 Wed, Nov 25, 2020 at 1:30 PM Linus Torvalds wrote: > > I'm not sure I'm willing to write and test the real patch, but it > doesn't look _too_ nasty from just looking at the code. The bookmark > thing makes it important to only actually clear the bit at the end (as > does the handoff case anyway), but the way wake_up_page_bit() is > written, that's actually very straightforward - just after the > while-loop. That's when we've woken up everybody. Actually, there's a problem. We don't know if we've done the hand-off or not, so we don't know if we should clear the bit after waking everybody up or not. We set that WQ_FLAG_DONE bit for the hand-0off case, but only the woken party sees that - the waker itself doesn't know about it (and we have no good way to return it in that call chain: wake_up_page_bit -> __wake_up_locked_key_bookmark -> __wake_up_common -> wake_page_function(). We could easily hide the flag in the "bookmark" wait queue entry, but that smells a bit hacky to me. So I don't think it's worth it, unless somebody really wants to give it a try. But if it turns out that the page ref change from Hugh causes some unexpected problem, we do have this model as a backup. Linus