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, 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 0A971C433EF for ; Tue, 21 Sep 2021 02:03:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E693961168 for ; Tue, 21 Sep 2021 02:03:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242522AbhIUCFB (ORCPT ); Mon, 20 Sep 2021 22:05:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232672AbhIUBq5 (ORCPT ); Mon, 20 Sep 2021 21:46:57 -0400 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A97AAC0613BA; Mon, 20 Sep 2021 14:23:54 -0700 (PDT) Received: by mail-ed1-x536.google.com with SMTP id v5so65315658edc.2; 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=NNAYYHsqJiLfvOI1Q5N4FgUGBVRCqZRZpyrXzE3veh+1QAFCffkpB3+iqvP6AMiBfz i9xRLjkVMIclsVmXIV4bh4d7RmTYd7Da3al7pWV5YLcBg9M1Olh2/TJeDIo+1mAwam9p QgXaQ6NIN7shhFuxvd3puAgACdm+P2qC681k/NETQFjOiDLIZ0dNc+yzQSkR7Ns0LbmW GsE4PnD7H0HLlYeHrkw6ekWgztm6ZgRMuh1064UCyZi1CoBPwSM7tIRlKthATOirDCRF rBSLAdo+xd3RtRNr2BW4HOKysjqhXph1zSEnAkG71hnoDOaw2pIhOBWMCRd9qXIWJVGG OtJw== X-Gm-Message-State: AOAM533em34HMnz5pr3njGmQsXEr3/lkp+1u4OUWbweDwDu14AzThL/R XdMi9u2Qfbhz2njT3A8BzMl9ApDpuJv3ILODUMo= 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?