From patchwork Wed May 31 06:04:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13261496 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7700AC7EE2E for ; Wed, 31 May 2023 06:05:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234320AbjEaGFV (ORCPT ); Wed, 31 May 2023 02:05:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234318AbjEaGFU (ORCPT ); Wed, 31 May 2023 02:05:20 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40C2E11C for ; Tue, 30 May 2023 23:05:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=Loo5pOJNOoshsPeC/eqTPMTRi5TqY72G2D3GAczj/ps=; b=kacSKQ4Rg40xrd5/UtH8+hW5RG 1PNKuKJJ4SfW/1HwwPp6tUBHFgwFkVJMgZpkNx0low/NT22ynPDntemd1IGbZtLzFhEo3tuLBxsLL /u5Sl/nL2oNn62Volqf6lOGmfWhUERAtEV74mNPJgeYliw69BW7FmiRNXMEsOyGmknTOsI1BhlFm9 IF6cpyB1tUwOkdHwagg8ezvkWNOFW5Rnx7AS37UWG6mc9I8xU7ojuQ4IGRrS6lIGNTRmniFJvvG37 q2dqLX+tbisIXPQYnvKikjRWeYxXIzileKNDUPY0PzH5+mZU5jNzmUsQivwdtZG+NJOUt83aF0UCq dFgZrJNg==; Received: from [2001:4bb8:182:6d06:f5c3:53d7:b5aa:b6a7] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1q4ExR-00GF3U-2Q; Wed, 31 May 2023 06:05:18 +0000 From: Christoph Hellwig To: Chris Mason , Josef Bacik , David Sterba Cc: linux-btrfs@vger.kernel.org Subject: [PATCH 03/16] btrfs: fix fsverify read error handling in end_page_read Date: Wed, 31 May 2023 08:04:52 +0200 Message-Id: <20230531060505.468704-4-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230531060505.468704-1-hch@lst.de> References: <20230531060505.468704-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Also clear the uptodate bit to make sure the page isn't seen as uptodate in the page cache if fsverity verification fails. Fixes: 146054090b08 ("btrfs: initial fsverity support") Signed-off-by: Christoph Hellwig --- fs/btrfs/extent_io.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 8e42ce48b52e4a..a943a66224891a 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -497,12 +497,8 @@ static void end_page_read(struct page *page, bool uptodate, u64 start, u32 len) ASSERT(page_offset(page) <= start && start + len <= page_offset(page) + PAGE_SIZE); - if (uptodate) { - if (!btrfs_verify_page(page, start)) { - btrfs_page_set_error(fs_info, page, start, len); - } else { - btrfs_page_set_uptodate(fs_info, page, start, len); - } + if (uptodate && btrfs_verify_page(page, start)) { + btrfs_page_set_uptodate(fs_info, page, start, len); } else { btrfs_page_clear_uptodate(fs_info, page, start, len); btrfs_page_set_error(fs_info, page, start, len);