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=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 20CD5C433EF for ; Sun, 19 Sep 2021 14:41:20 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9846B61244 for ; Sun, 19 Sep 2021 14:41:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9846B61244 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id E34A96B006C; Sun, 19 Sep 2021 10:41:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DBDF56B0072; Sun, 19 Sep 2021 10:41:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C85226B0073; Sun, 19 Sep 2021 10:41:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0202.hostedemail.com [216.40.44.202]) by kanga.kvack.org (Postfix) with ESMTP id B595F6B006C for ; Sun, 19 Sep 2021 10:41:18 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 72258180AD820 for ; Sun, 19 Sep 2021 14:41:18 +0000 (UTC) X-FDA: 78604585836.24.AD2490B Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf05.hostedemail.com (Postfix) with ESMTP id 397DF50E031C for ; Sun, 19 Sep 2021 14:41:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=0djtDXf3dJy/0lRte8xIBcRhbg0XM0G45oEvLEXQ+H8=; b=V0amxD60xFkrGsyAX78oTr++Gm eR01oM6mn6MtyYVDE4lcV5l3HbG5R9QqszmHEsXV074ebgN+zWpOpjwOhopBW7QPWPYWdNAWSeNw9 +qViji5amXdnG0UR2QlkclJ4kBw+Ki6KhLid8HLcy0CnDmfZv1iNdXn7a383NOcjZL7Y00oPzzRek ah6FwicMt8WaCYPK3ZP8hJ93d5uGVeAiSJO2DP31h52uvtP0enxf3FGVIs/fkbc5pN0gBdozZLyCr 8dFMvsHoAOZ7Sxe1EmO3oi4bt2XNqKZrdJaoz6oicJA4nZOmt1VoQ0eZqL1Pq6zhE2SR4RfsjeFj+ lZOoWvSg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mRxza-001w2N-QO; Sun, 19 Sep 2021 14:40:37 +0000 Date: Sun, 19 Sep 2021 15:40:30 +0100 From: Matthew Wilcox To: Yang Shi 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 Subject: Re: [PATCH] fs: buffer: check huge page size instead of single page for invalidatepage Message-ID: References: <20210917205731.262693-1-shy828301@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 397DF50E031C X-Stat-Signature: ufzm5fpip7bic54smt6c7eztmnnrtorz Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=V0amxD60; spf=none (imf05.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-HE-Tag: 1632062478-854167 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 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.