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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64FDFC433EF for ; Thu, 30 Sep 2021 16:49:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0C33661268 for ; Thu, 30 Sep 2021 16:49:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0C33661268 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 429C19400BC; Thu, 30 Sep 2021 12:49:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3D93794003A; Thu, 30 Sep 2021 12:49:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 27B319400BC; Thu, 30 Sep 2021 12:49:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0106.hostedemail.com [216.40.44.106]) by kanga.kvack.org (Postfix) with ESMTP id 1550494003A for ; Thu, 30 Sep 2021 12:49:35 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id BF66B183B30F3 for ; Thu, 30 Sep 2021 16:49:34 +0000 (UTC) X-FDA: 78644825868.07.26FD918 Received: from mail-oo1-f54.google.com (mail-oo1-f54.google.com [209.85.161.54]) by imf04.hostedemail.com (Postfix) with ESMTP id 84D8B5000321 for ; Thu, 30 Sep 2021 16:49:34 +0000 (UTC) Received: by mail-oo1-f54.google.com with SMTP id h11-20020a4aa74b000000b002a933d156cbso2055442oom.4 for ; Thu, 30 Sep 2021 09:49:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:in-reply-to:message-id:references :mime-version; bh=44d3gnYmT27t8uddNQ3yxOlO4++yDknbqHA9EiC9gdY=; b=cLouT4HFtWsCwPY2St5rtRgkF3AAxwYH1AEm5cF99lFjEFxfBHV7Q8JzRtKmP4I2o6 0rt19x9uuZEQE9ukIb9twZ4KeyaWeQvLid56QeSrHhhJqZrNjGs9/4cL44+dMsHOjpDZ Nf6l+Hhd92pQm0NRYhsy1Z/SMT6gMjexCX4U53tZ7NbDS+Dwzt64R3D7DdozbRwRXWzw 9vpwTH0SJz5RCqXwwq0cf2pGvCSJWy1WDoG8FtPTCMFW5lmozRqTypNDlu5tOtoQFG8A Ol07nV9IS3mhcGc1LPkrQmAdaTKj9xBq5rkFTzTzkCR9K7rzeqHFDxrbcVNw8oJMFbzm Pc2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:mime-version; bh=44d3gnYmT27t8uddNQ3yxOlO4++yDknbqHA9EiC9gdY=; b=N6umYoDEHHBAXRSUFzW6a2pDj642FHR3WbaMdXyXUzekL5AlAXl36EfE/s0nsfrg8M RhjLLSXA40dLKUlbUZhwKrFXdjidRzQIcXO8brXRseKg4hfF4azuyVXaG/kza6cJRjE8 rXHZeNGT/wuutl+nFxUqMotxkxvWrhfGysfjlVPABdnFMORpoARR7AyQCYBk04hWpouK 5xY5/ptiSkbLz1oCPUkPQB4P7hbOn+NYA/oqYOfKxN8ujHmlA9LGad/eZDLWi4fkBI0v 7hUKXKuejSPe9eYL7CJ1Xu/X9k0NnsAAkTnld7t7VXhAcA8ofYotH51mwIgdOpC9iVjn 3opw== X-Gm-Message-State: AOAM532fEmW2V5A//qA5L4YdDu0mjsmES+mcfyrwCKKdNSQpo9GYm+cu DbgYfvzg6jJbX3a74JTV6ZAy9Q== X-Google-Smtp-Source: ABdhPJxz0iVgkHdi/uoTIH21qWRPOPxzc+ZHokNo8Bv/sOITJWR/nWR3POSxzfc5/PY3hg/CGIO7wA== X-Received: by 2002:a05:6820:512:: with SMTP id m18mr5776292ooj.48.1633020573699; Thu, 30 Sep 2021 09:49:33 -0700 (PDT) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id x62sm664859oig.24.2021.09.30.09.49.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Sep 2021 09:49:33 -0700 (PDT) Date: Thu, 30 Sep 2021 09:49:21 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.anvils To: Matthew Wilcox cc: Hugh Dickins , Song Liu , Rongwei Wang , Andrew Morton , Linux MM , Linux Kernel Mailing List , William Kucharski Subject: Re: [PATCH v2 1/2] mm, thp: check page mapping when truncating page cache In-Reply-To: Message-ID: References: <68737431-01d2-e6e3-5131-7d7c731e49ae@linux.alibaba.com> <67906bf5-4de9-8433-3d70-cc8fc5cc2347@linux.alibaba.com> <3d264ed9-f8fd-60d4-7125-f9f745ebeb52@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 84D8B5000321 X-Stat-Signature: mw6w5thqjzujwk4qqgasz5fd597wcdzg Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=cLouT4HF; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf04.hostedemail.com: domain of hughd@google.com designates 209.85.161.54 as permitted sender) smtp.mailfrom=hughd@google.com X-HE-Tag: 1633020574-960958 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 Thu, 30 Sep 2021, Matthew Wilcox wrote: > On Wed, Sep 29, 2021 at 10:24:44PM -0700, Hugh Dickins wrote: > > > > Aside from the above page->index mischeck in find_lock_entries(), > > I now think this bug needs nothing more than simply removing the > > VM_BUG_ON_PAGE(PageTail(page), page) from truncate_inode_page(). > > I don't think that's right. This bug was also observed when calling > truncate(), so there's clearly a situation where two concurrent calls > to truncate_pagecache() leaves a THP in the cache. I assume you're thinking of one of the fuzzer blkdev ones: https://lore.kernel.org/linux-mm/CACkBjsbtF_peC7N_4mRfHML_BeiPe+O9DahTfr84puSG_J9rcQ@mail.gmail.com/ or https://lore.kernel.org/lkml/CACkBjsYwLYLRmX8GpsDpMthagWOjWWrNxqY6ZLNQVr6yx+f5vA@mail.gmail.com/ I haven't started on those ones yet: yes, I imagine one or both of those will need a further fix (S_ISREG() check somewhere if we're lucky; but could well be nastier); but for the bug in this thread, I expect removing the VM_BUG_ON_PAGE(PageTail) to be enough. If you're thinking of something else, please send a link if you can - thanks. Hugh