Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1308096pxu; Mon, 23 Nov 2020 17:56:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJwRPfu00vsWGW4ODtKeP1eckhvlCKMjh+PDcVyYazq7oMzh/Aoe9FfNjZeWk9Kr7IDkbD0B X-Received: by 2002:a05:6402:b8e:: with SMTP id cf14mr1864579edb.86.1606182964050; Mon, 23 Nov 2020 17:56:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606182964; cv=none; d=google.com; s=arc-20160816; b=V+ZFPxbU6Ivqk9e4uwEtCIMqyZkV5a/nLMaL3hkANxv3/uXGNzLjd4yZGWz4P4130U Wy9HzWN/DCscpcy+ctI32iy+0ousu5ENpodzdWb9sBzHzE/IIVKzfox+iSYaf5se2Iox hx/RN3KXyqWNOypeo9pHEQr8v/uOvdMaBQDSJwqL59rPwJWhFCFkbkNgFS+89iWkhyWa NzoAucURVfDRp0o6X0+L4usoDyJHtWiM/pYxJ7sAzVsO2aY/u9ZJJMRhC8mn294MTuve XLrQal4l1jTUt/C/dNOZe5z85WXv+XE0jol84d7BIMmW/GsljnzWLqb84XQeWy4qYevT 4jVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ct4VHss0UbLUYQZ6e0jU52Y/b41yATzVSCaU2q2cWl0=; b=RVePcftxu9oJIvOBbq1xxsW2he7rz4+undr1Y2I2hwXHI/Trz81IVTjCLxr51wDDhc qvGAUR9X8c9Mmm7Ooo/r5gBP1i7v+MKcN65zvS8Ow/yRO8SOZATz4UEApIH48lnZ5obG acs4z0AY3SReFQQl5ToPVUU2Ke1NT5KKLDQDIj+nKyBeQk/Egncgfxx76DbtkRA6hAxJ BC58WcI/wwnnFjBIcHmZ+7OWupU+VjDHWLYbcGKy+/d1OoVcAM813e/O7TitcVVxxI7o /hYB8/XE3MmKymRxe0+u+d9OChZUgCYmRgb9V4bdz5/YZR38zK0VBPcoOPfUWDbt0SBY eBSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rcWUTN0i; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g16si3505458ejf.167.2020.11.23.17.55.41; Mon, 23 Nov 2020 17:56:04 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=rcWUTN0i; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732132AbgKWMit (ORCPT + 99 others); Mon, 23 Nov 2020 07:38:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:50630 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730880AbgKWMiO (ORCPT ); Mon, 23 Nov 2020 07:38:14 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BEE9D20732; Mon, 23 Nov 2020 12:38:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606135092; bh=JQzplOilP0ia9M+WKKXpjJHYcWcB9m3Ymhw3AOXLLbU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rcWUTN0iGWszKrPYMSkPPbHFkOEPcpfhEjzu8RgLx3bARvpCfyTXu9mE80biu0Orz cZuec1B1e9McfXVacPKkJzPOShVXDiO06srIyw7FZltxNfP1xLpcG+VMRD3Od7dk8R vAINp3G6btmeybrGueOxNwDxRgevIXl/XIW4nKlE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Darrick J. Wong" , Chandan Babu R , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.4 102/158] xfs: strengthen rmap record flags checking Date: Mon, 23 Nov 2020 13:22:10 +0100 Message-Id: <20201123121824.854798079@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201123121819.943135899@linuxfoundation.org> References: <20201123121819.943135899@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Darrick J. Wong [ Upstream commit 498fe261f0d6d5189f8e11d283705dd97b474b54 ] We always know the correct state of the rmap record flags (attr, bmbt, unwritten) so check them by direct comparison. Fixes: d852657ccfc0 ("xfs: cross-reference reverse-mapping btree") Signed-off-by: Darrick J. Wong Reviewed-by: Chandan Babu R Reviewed-by: Christoph Hellwig Signed-off-by: Sasha Levin --- fs/xfs/scrub/bmap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/xfs/scrub/bmap.c b/fs/xfs/scrub/bmap.c index ec580c0d70fa3..52892f41eb2d8 100644 --- a/fs/xfs/scrub/bmap.c +++ b/fs/xfs/scrub/bmap.c @@ -218,13 +218,13 @@ xchk_bmap_xref_rmap( * which doesn't track unwritten state. */ if (owner != XFS_RMAP_OWN_COW && - irec->br_state == XFS_EXT_UNWRITTEN && - !(rmap.rm_flags & XFS_RMAP_UNWRITTEN)) + !!(irec->br_state == XFS_EXT_UNWRITTEN) != + !!(rmap.rm_flags & XFS_RMAP_UNWRITTEN)) xchk_fblock_xref_set_corrupt(info->sc, info->whichfork, irec->br_startoff); - if (info->whichfork == XFS_ATTR_FORK && - !(rmap.rm_flags & XFS_RMAP_ATTR_FORK)) + if (!!(info->whichfork == XFS_ATTR_FORK) != + !!(rmap.rm_flags & XFS_RMAP_ATTR_FORK)) xchk_fblock_xref_set_corrupt(info->sc, info->whichfork, irec->br_startoff); if (rmap.rm_flags & XFS_RMAP_BMBT_BLOCK) -- 2.27.0