Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp834941pxu; Mon, 23 Nov 2020 05:30:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJzNBwTUgopMgBTygiPdP3S2WcCVkRM0bJ8CCiCFB97i5TC5+ZfbCJhjz6fz2NQqz6HOfntw X-Received: by 2002:a17:906:f10e:: with SMTP id gv14mr43267887ejb.346.1606138204421; Mon, 23 Nov 2020 05:30:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606138204; cv=none; d=google.com; s=arc-20160816; b=K4vee4iw0V1Ls5BatG2QvzQa/w+OdMwplCZbo1hE19iWt+vIlpqc/zeyU8+SdSwhsw fBhdLraEpeCR/k8x+7E7+gEU23jKLqHmbnLwhdyDn9jXhn4p3iIN/uCqtoK0dkPsXfwW 6VChL/LDYBK4cZDQtTq/8olFChfHHxgQbOEh4qwhMUGKVcrQ2oNDJc+EJIYxXdRKJxg2 FKp2XKgng0o7/caIzeFBBn5s4cKnzT1rMQAzEZGIfzdfjDlOSeetiN8h7sLB70HRbrex 3XmshX60AdUIosBxJzf3RAmF2ZVh8UX/AQEBBYXTwQyhslc/GBeTB3IuQJIyEAvKa3CS jaxA== 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=l6AvdBjc4O5Eo+hPfa2kYwtjhsl8TmLlp91VAPTf1x4=; b=oJAddwi5vfxbvWZeS1BDmyEl8+McUoD4OsWHGQcKm+jxoB7KXEB5tZoJhZe+nVfzko vM5qi7DjOiSaGkvbSwSd3A1zn9f/L4Gxade0Lh+S4kuLQ6hjX2cabaOQEpijsAMcPAiP KjNUI1QHQS2dWOWAhBzhkeOJhMmiQLXYQYD61pOD+w08Hleaey0KqgcVzcKshWLHIIKj RcXs1Q0povA0/YvcUxXIByjuketHmyHuc9zybC72FB4Ru+AR6cO0Y0jGQNXjQiyX6mBB aRvK8KC/GQvLvUKhRdLuL9FNLwFzGUQWXY+4erqSBNqfL1zWzEwlOL4JVK/gJ2pnJmXV /KRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Xr1PT7KQ; 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 u11si6533892edt.221.2020.11.23.05.29.41; Mon, 23 Nov 2020 05:30: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=Xr1PT7KQ; 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 S1731073AbgKWMc0 (ORCPT + 99 others); Mon, 23 Nov 2020 07:32:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:43238 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730488AbgKWMcH (ORCPT ); Mon, 23 Nov 2020 07:32:07 -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 89DA520728; Mon, 23 Nov 2020 12:32:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606134727; bh=lyQzsjudopK7FnhFZI2t9WlUN7+yzRcoHCYUy68ZIGQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xr1PT7KQIXiReEYYv8o0lwitiuHWNRmkuay/9NNmvqU3JuXkQHx0K+9rIaLWHS8tu YZAVSK6VBTPmWKtKLvZduyetA9i5iTLn/kmnZBs/1TRLmtPt5df5iwZ1MdG8CMibKJ 5SsZQZv/9EL76eNPJjkkMI4sua6xau6/BlNRdiXA= 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 4.19 60/91] xfs: strengthen rmap record flags checking Date: Mon, 23 Nov 2020 13:22:20 +0100 Message-Id: <20201123121812.238531014@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201123121809.285416732@linuxfoundation.org> References: <20201123121809.285416732@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 b05d65fd360b3..cf005e18d6186 100644 --- a/fs/xfs/scrub/bmap.c +++ b/fs/xfs/scrub/bmap.c @@ -225,13 +225,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