Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp836025pxu; Mon, 23 Nov 2020 05:31:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJwldzsABCd0niEys8TrvgISl/pVU2PwCd3IRiFKiNHtoR/LCVhhcLIu7hdfmMIkibxhPMjg X-Received: by 2002:aa7:dccd:: with SMTP id w13mr10415234edu.385.1606138291863; Mon, 23 Nov 2020 05:31:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606138291; cv=none; d=google.com; s=arc-20160816; b=fiBbHY8bhdw5Y7If8S1/KMjcWBHtLjzytRxzDIs933RYvRZhLMRm+/CP6OFpUHmGh7 IdcEz6Yp1/210UpXgwgGL5+2RLPH9WjlS8WxT9ccgAtxZKNm7qQef3POCxfoFtKTm4ui i7FC178XVUOyssw01UfjP/CoDlJAnp0kDZeo4qS5TCaXGKwO430LvIACciuXegwJeIte mmGLJsf5qQI99s1GZhKi9/XkmIXGhLqYxQjW1UkJ0M52/m2/Ucuw550B6Tg4dRdvusU/ j4HxBsKk3hhA/Z51+vnSiGvO3nfEnqA/bw82YtL6u7WMMbCYmpsAqVlvolrdKCOtfgXU fAmA== 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=u7iDJ9b3j+3QYud725/JU5k6/qqJF2CRGronu00yW/A=; b=fKeRbjSegX8/GyPCFxAlYMupnAIHsV2XQ0os4vRnkFJuCvZ0B/B1D1JNNS7j7IZYQW Zl4Ag3Igt0os/yR76wC2nP52UU92RB6Js2HceLFLRW63md9xFp0sjJYoPArAepdxqa2t vgM62ydXWMBxu1Rrb+Ws9zesyiW1M9zEdGj+CP2dbWNsYHugSauWNlgorTeq828hoPNn qY8bhvTBEBlVNUsESVZqzJfUCOVKBrYyqTH8puGzJhad2LSlTUBXZ9nfC1wl4ZB63NX+ PA9c+vaa+e7YfcuP4kkVGSMKbo6Yz35nQg3ekB4H9AkAr6qeVqtKkdZ4pQMYGJmjnzmI oJqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZsxnOwBQ; 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 lx9si6549348ejb.494.2020.11.23.05.31.07; Mon, 23 Nov 2020 05:31:31 -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=ZsxnOwBQ; 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 S1731108AbgKWMch (ORCPT + 99 others); Mon, 23 Nov 2020 07:32:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:43334 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731043AbgKWMcP (ORCPT ); Mon, 23 Nov 2020 07:32:15 -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 8A9C02076E; Mon, 23 Nov 2020 12:32:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606134735; bh=zTqSVl6e/CwJ8uAp5qgjjh0A/0uAZHROmGN2twz+niA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZsxnOwBQ+rJp5YILwKcn5jYwd7hTXeYUbXVdMfLHOtXvvpRs65coaxPk8CHYr6ybp PYLEm5oUJ4I41BhLge8IuuRhO+5uSBUY/d1YIerSwCsuv/vSQgqhDamRQ98zZQH1MV mH50UoK7Q8leG1hQHSbXmOYWxIplfyOwu3RWizPw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Sandeen , "Darrick J. Wong" , Eric Sandeen , Sasha Levin Subject: [PATCH 4.19 63/91] xfs: revert "xfs: fix rmap key and record comparison functions" Date: Mon, 23 Nov 2020 13:22:23 +0100 Message-Id: <20201123121812.382866887@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 eb8409071a1d47e3593cfe077107ac46853182ab ] This reverts commit 6ff646b2ceb0eec916101877f38da0b73e3a5b7f. Your maintainer committed a major braino in the rmap code by adding the attr fork, bmbt, and unwritten extent usage bits into rmap record key comparisons. While XFS uses the usage bits *in the rmap records* for cross-referencing metadata in xfs_scrub and xfs_repair, it only needs the owner and offset information to distinguish between reverse mappings of the same physical extent into the data fork of a file at multiple offsets. The other bits are not important for key comparisons for index lookups, and never have been. Eric Sandeen reports that this causes regressions in generic/299, so undo this patch before it does more damage. Reported-by: Eric Sandeen Fixes: 6ff646b2ceb0 ("xfs: fix rmap key and record comparison functions") Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen Signed-off-by: Sasha Levin --- fs/xfs/libxfs/xfs_rmap_btree.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/fs/xfs/libxfs/xfs_rmap_btree.c b/fs/xfs/libxfs/xfs_rmap_btree.c index 77528f413286b..f79cf040d7450 100644 --- a/fs/xfs/libxfs/xfs_rmap_btree.c +++ b/fs/xfs/libxfs/xfs_rmap_btree.c @@ -247,8 +247,8 @@ xfs_rmapbt_key_diff( else if (y > x) return -1; - x = be64_to_cpu(kp->rm_offset); - y = xfs_rmap_irec_offset_pack(rec); + x = XFS_RMAP_OFF(be64_to_cpu(kp->rm_offset)); + y = rec->rm_offset; if (x > y) return 1; else if (y > x) @@ -279,8 +279,8 @@ xfs_rmapbt_diff_two_keys( else if (y > x) return -1; - x = be64_to_cpu(kp1->rm_offset); - y = be64_to_cpu(kp2->rm_offset); + x = XFS_RMAP_OFF(be64_to_cpu(kp1->rm_offset)); + y = XFS_RMAP_OFF(be64_to_cpu(kp2->rm_offset)); if (x > y) return 1; else if (y > x) @@ -393,8 +393,8 @@ xfs_rmapbt_keys_inorder( return 1; else if (a > b) return 0; - a = be64_to_cpu(k1->rmap.rm_offset); - b = be64_to_cpu(k2->rmap.rm_offset); + a = XFS_RMAP_OFF(be64_to_cpu(k1->rmap.rm_offset)); + b = XFS_RMAP_OFF(be64_to_cpu(k2->rmap.rm_offset)); if (a <= b) return 1; return 0; @@ -423,8 +423,8 @@ xfs_rmapbt_recs_inorder( return 1; else if (a > b) return 0; - a = be64_to_cpu(r1->rmap.rm_offset); - b = be64_to_cpu(r2->rmap.rm_offset); + a = XFS_RMAP_OFF(be64_to_cpu(r1->rmap.rm_offset)); + b = XFS_RMAP_OFF(be64_to_cpu(r2->rmap.rm_offset)); if (a <= b) return 1; return 0; -- 2.27.0