Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp358452pxx; Wed, 28 Oct 2020 06:39:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwe+0P0MxYZ3E4Hbf3PeDYM76KxBU5UIDewIszO+7Lw4Ef9b2XaU8XSZ4ntHcq5gv9Jj50u X-Received: by 2002:a05:6402:1bc9:: with SMTP id ch9mr8000580edb.386.1603892358680; Wed, 28 Oct 2020 06:39:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603892358; cv=none; d=google.com; s=arc-20160816; b=Or2gU0sTfe0OHjw4nadCE73+V/jw40vdnaPh17yMTtWWhdTnTqA6qB30lyToDVGHn1 dRQCQ6k911YbrwXJZRZ2kQcBHJTmy79R6MTINQ1eG2ooeYkZ9on0PAApX2LpOeTH9doI h/jUEHW1MHWefqwrYUSNQPBwQEmXCkAzeV+O8ZX5MwgB+s3WwD8kF4LPoClFKyKzX5h/ 8/QMB530LyZFOqiEpeNQCItaB+lyrqm5W0KxNlHaGiFlcG/npCRWEZO/SScebCn8oNbf usbJ2Zq+cs0totFLQDQ4nGLjXxMuD4fdsA5AaiV7/omy2n7dDIaDN+d3+SrBQa9Qku8G y2Hg== 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=Z5Z0aDfl03hi3a9xhaC4V6FVlpx+IaZZu1hSu7WS5BY=; b=qXc0g1RN1ZmePTc81YobNbQ9edDSxKW1OE9IuDKo6HO1x+zk1KN+/fLxT0ajHC5ZVQ Feg0VEKzwxzqaeDNlPBhsxbgBoqx9yrV+oRdZHzOuXL6iBEvqfFn3FZZsI9hPAJClN12 HUTPTf0mfB0pwEeybFAfhZZIvw3Mlz7lmJCFz/Xm1fiKrcmndhGiAT11JpGENbiGh2NY 7rxtd6b3eZ+k0ZyxIjkqIMBIVDuKoUj/5j2dOHUOGmWrB6YblSzz7w+n1WTdeyXkwq8h ttDTD5rV6FTYx+72yVAKzroEFOpckM2URxgfhMbvTHBdwjykOVBCGp+WhmZktZJsPxY+ RJ4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ewhaYgLg; 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=fail (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 bt10si1135660edb.503.2020.10.28.06.38.55; Wed, 28 Oct 2020 06:39:18 -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=@kernel.org header.s=default header.b=ewhaYgLg; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1802639AbgJ0Pug (ORCPT + 99 others); Tue, 27 Oct 2020 11:50:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:56428 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1801041AbgJ0PhY (ORCPT ); Tue, 27 Oct 2020 11:37:24 -0400 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 50D6F204EF; Tue, 27 Oct 2020 15:37:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603813043; bh=OxJs6otOzaSwI6uvGmQVX7oyaBZuQCa4KxT1dSYTM3Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ewhaYgLgTJlA/2abAh7l4o79u/ZRVVOn/yh4Z9B07lBEtf874jo324KeV5Qku88Ye UPnxwEJX5WnDSVT3KyU3TC8Nk7ufa+0YeGOrPZoHF/dSprAqv7qaUpn469BrUZvh7a YFqTuENI468Cr8RvjKXvaAjETShH5nVQDGVgdzWo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Scott , Dave Chinner , "Darrick J. Wong" , Brian Foster , Sasha Levin Subject: [PATCH 5.9 419/757] xfs: fix finobt btree block recovery ordering Date: Tue, 27 Oct 2020 14:51:09 +0100 Message-Id: <20201027135510.233835466@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135450.497324313@linuxfoundation.org> References: <20201027135450.497324313@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: Dave Chinner [ Upstream commit 671459676ab0e1d371c8d6b184ad1faa05b6941e ] Nathan popped up on #xfs and pointed out that we fail to handle finobt btree blocks in xlog_recover_get_buf_lsn(). This means they always fall through the entire magic number matching code to "recover immediately". Whilst most of the time this is the correct behaviour, occasionally it will be incorrect and could potentially overwrite more recent metadata because we don't check the LSN in the on disk metadata at all. This bug has been present since the finobt was first introduced, and is a potential cause of the occasional xfs_iget_check_free_state() failures we see that indicate that the inode btree state does not match the on disk inode state. Fixes: aafc3c246529 ("xfs: support the XFS_BTNUM_FINOBT free inode btree type") Reported-by: Nathan Scott Signed-off-by: Dave Chinner Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Reviewed-by: Brian Foster Signed-off-by: Sasha Levin --- fs/xfs/xfs_buf_item_recover.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/xfs/xfs_buf_item_recover.c b/fs/xfs/xfs_buf_item_recover.c index 8f0457d67d779..de2772394de21 100644 --- a/fs/xfs/xfs_buf_item_recover.c +++ b/fs/xfs/xfs_buf_item_recover.c @@ -719,6 +719,8 @@ xlog_recover_get_buf_lsn( case XFS_ABTC_MAGIC: case XFS_RMAP_CRC_MAGIC: case XFS_REFC_CRC_MAGIC: + case XFS_FIBT_CRC_MAGIC: + case XFS_FIBT_MAGIC: case XFS_IBT_CRC_MAGIC: case XFS_IBT_MAGIC: { struct xfs_btree_block *btb = blk; -- 2.25.1