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=-2.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 79672C433EF for ; Mon, 20 Sep 2021 21:23:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D842161184 for ; Mon, 20 Sep 2021 21:23:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D842161184 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 3D19C6B0071; Mon, 20 Sep 2021 17:23:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 380EF6B0072; Mon, 20 Sep 2021 17:23:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 26F6B900002; Mon, 20 Sep 2021 17:23:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0244.hostedemail.com [216.40.44.244]) by kanga.kvack.org (Postfix) with ESMTP id 170A66B0071 for ; Mon, 20 Sep 2021 17:23:55 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id C59D81802DDFB for ; Mon, 20 Sep 2021 21:23:54 +0000 (UTC) X-FDA: 78609229188.03.0812D23 Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) by imf08.hostedemail.com (Postfix) with ESMTP id 9076C30000AC for ; Mon, 20 Sep 2021 21:23:54 +0000 (UTC) Received: by mail-ed1-f47.google.com with SMTP id h17so66597443edj.6 for ; Mon, 20 Sep 2021 14:23:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=v3jJn/Tl6ib6kn61j+6hy2vKI8Q4Xoscp7/NxeTF+GE=; b=aAG3f+E3kiBw7BL8MPLoKamnR5Dis0MyF3EGZDUA55rrJXX5EoWsZa195ABUghueCb 71CQ5mJ6qXc934jwEVRDCUJVmUMeLuHvTKNsGpTOkGoKyt+LxUjedOJ7mdngdwLT2QaV OSddfmsNndIvAPfPMSNhRiffyFHLdYRKNcaqcFpdiSRY0vWJ8IfFG5hiFz529fqINa6m hYHICZKEwdPMp47fVnqQuYSEOyr0tMoApNsY86I+el7KFpA/7/1nAacKsiNSscEs2xMX D2hfA3edgheNGdBuMTZ7bjHgFpCJhp5eBkoIxAgOe03SpCqEF1wyWD7TrUUx8Ieu1BwZ OGGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=v3jJn/Tl6ib6kn61j+6hy2vKI8Q4Xoscp7/NxeTF+GE=; b=EN0kPGkkn8IsDdHlzbubKlV/mEqwyjI8TukjoixGddB6YviSw8NR9bb/8DNrjG51Y1 y3AyxaXaYTNOBTziFjkRocVL9KLtnFS6GQ1Guv191idkd7fz1t+xQD8/qTrcYlMVkxWK Z1AhFPs4rIaffdQr0zQ28tS5W+lFkmrBz/qFS13ec6Ln3VFRFVHSzD6B1m1XKP0nzs1m BT/B+qpRTwLVlMqMb0dY0Xx0Xl8FpQ5VpnCcrNSwVDTP9SOwWxkmlUtP+YNpKmEJ3XWW eIf3fqdpBGSYiL406szSZtr2DtuAj6jw2FkW0ju3clXA7G5IAfJGUL2NVHIFypx+X68W NFsw== X-Gm-Message-State: AOAM531Sj510NPrYNOFagOEUT+RUrWahJefKbizvyaFaKDt+8J/12dRB Z++RllkTW8IkihptUHMdjp44JMMKpQhCygga9Mk= X-Google-Smtp-Source: ABdhPJwacLHpwsVUe7dIFhlLnB/9jckDDoV4UJ05h/K8GDUSmKKNgLqWG93R9ecwGn636303ugmv+quxiOKPzejhSo4= X-Received: by 2002:a50:e044:: with SMTP id g4mr464867edl.46.1632173033180; Mon, 20 Sep 2021 14:23:53 -0700 (PDT) MIME-Version: 1.0 References: <20210917205731.262693-1-shy828301@gmail.com> In-Reply-To: From: Yang Shi Date: Mon, 20 Sep 2021 14:23:41 -0700 Message-ID: Subject: Re: [PATCH] fs: buffer: check huge page size instead of single page for invalidatepage To: Matthew Wilcox Cc: Hugh Dickins , cfijalkovich@google.com, song@kernel.org, Andrew Morton , Hao Sun , Linux MM , Linux FS-devel Mailing List , Linux Kernel Mailing List , Song Liu Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 9076C30000AC X-Stat-Signature: ma93bgpzohxgydh59t1r98n4fr1pw3fm Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=aAG3f+E3; spf=pass (imf08.hostedemail.com: domain of shy828301@gmail.com designates 209.85.208.47 as permitted sender) smtp.mailfrom=shy828301@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-HE-Tag: 1632173034-707020 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, Sep 19, 2021 at 7:41 AM Matthew Wilcox wrote: > > On Fri, Sep 17, 2021 at 05:07:03PM -0700, Yang Shi wrote: > > > The debugging showed the page passed to invalidatepage is a huge page > > > and the length is the size of huge page instead of single page due to > > > read only FS THP support. But block_invalidatepage() would throw BUG if > > > the size is greater than single page. > > Things have already gone wrong before we get to this point. See > do_dentry_open(). You aren't supposed to be able to get a writable file > descriptor on a file which has had huge pages added to the page cache > without the filesystem's knowledge. That's the problem that needs to > be fixed. I don't quite understand your point here. Do you mean do_dentry_open() should fail for such cases instead of truncating the page cache?