Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1242590pxb; Sun, 19 Sep 2021 10:31:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVEziDno8a9rcYMQWssrQGWY1io2TzaDomCkwWE0KkKtr96awEUvpUKaTa0LofSZpdVuXH X-Received: by 2002:a17:906:d287:: with SMTP id ay7mr23770665ejb.402.1632072713818; Sun, 19 Sep 2021 10:31:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632072713; cv=none; d=google.com; s=arc-20160816; b=Pazzu5XJ27mqqXB9SfboRbo90fy6O3hbLdrDxZwporg0+HMBaTQQjoSFfMwXd6sg+k w1jUfvAPvvfsWfZMuqt1Pc2e8QQq22/IGv77DqA2qvkoRxxoCY1VUxaQ1JB8lYmF2bHx QQu6jwqdjYRvYpiZC8veLm52XJlyoMB8vanSH7a/VWZdVU95VDWv0TcoHguRj7SSwea9 8yemy79zPwI9JbdIzsaNSItV/VrGauDgKqyv28Y9zdtMcd70ebTzHFuL07TpfddTB0uH vK+XYrGMXAjlQ1CFcTpD6Ns13Yb2/2r6DJpzvYpeCNG7h9gWQeSj4oOjjwGO6toaWVia VDhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=0djtDXf3dJy/0lRte8xIBcRhbg0XM0G45oEvLEXQ+H8=; b=Pgg4VelcFaaIS+VbevPeIaShgsk7HTXzwmtWJ45AfKjwDPRtezgTtcbw5iyutSQHfx 3DYy1wDfJnkRSxtaueilqA4SMRHpYAde8Xp1d6SmMEb0Icw8s4+AEGmPvf46ckRsdBvk W5nfM1GpFWHJMbFZAgNNkN2yQSEYG/fD05VU+DVCMrsWE9TEPOigkD2uWPk1wQqQ7EJx PtQzDK/c7UoKVLGTJdrHGvUzFrLmB6T/HczwUnN2oMZjut0Vweiuz//c/H6CRezxnqKm p09QPvxGDEWhFI4gn9ixEY84/X/fKbhFd1UF/7EHjnNiwzZPg92vV3v8NDEqmXDEE2z7 5ajw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=V0amxD60; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hx14si13501300ejc.326.2021.09.19.10.31.29; Sun, 19 Sep 2021 10:31:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=V0amxD60; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232646AbhISOmr (ORCPT + 99 others); Sun, 19 Sep 2021 10:42:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231920AbhISOmr (ORCPT ); Sun, 19 Sep 2021 10:42:47 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9819C061574; Sun, 19 Sep 2021 07:41:21 -0700 (PDT) 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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.