Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp272478pxx; Wed, 28 Oct 2020 04:41:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwwKAhUTq+OzgPX7GWb6vX0moss/N38G0yBgE4AdRYQPXD9hKTj12tzvNG32h7xYCPhAy38 X-Received: by 2002:a17:906:34c3:: with SMTP id h3mr7078707ejb.132.1603885278056; Wed, 28 Oct 2020 04:41:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603885278; cv=none; d=google.com; s=arc-20160816; b=GCk4/FveU5OC7q5Suygtp5WHdQ9fJc2ahIIZ+SIKDs+4KDdnVlMAsdqfCzq5hLRqQV JOoUhVsPDsONUPXc6Z2kpwOVV2Pn6U5clIIMLHN1RfgJwahBaT/gWSdTDi8qGeoKtMIu jgEnXmExDh8IQZWHP9toYQTlj8DWzOhDY1vAZ2oSOJamtKB9+0uAHt+rEB5jTKzbzYAi 70ghE5r96WJVz+9XukmbBc+MPVx9Z4H8nXdxecFNhfjvogR+l9hhUjsW6V16+WgGM/eA oCuOoLXPMRt1jEJ4tsfmFdlD+ecv204snAcWGjDLuF5rnXmSSrRaqbNw6uN36fI6IEMh 1N+g== 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=6+PwZRQAHRcH1lGwdvpeUFtAQNvJXHoGH73LzJTNe/Q=; b=Wtk5mZvFP3Sv4PNh33K69Tuti6+uhVnNkS2Gnj8nyzcE6riCC6dcGlwT+hj3lZ6nnv 8KhF8TuRWTjf+32bbX/85lzrwJJ5oK4FcaAJaKll3Rz9jHwgwrNqUYd4jFStrv+uvHze jYjqwcpeRDtZJ2givR29eI+TSE3uvG+C6oflxsxjliFCNsc0ieQSvFDMxAuzi5/zdcJv jkYwkAEQtZoX3mrKVntpajnzBTUm8wWYU69JQ8UaNkpG7T9ibChRYBX2GZJl+oSwnT7g VZ9EsHrrNLZbNdeBUTXSXP0dputuOerDf0yxUv+DD2rQENC0exo9jTK6tYBBu0jD/379 Op0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Y/XNw7tO"; 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 i19si2816688ejh.153.2020.10.28.04.40.56; Wed, 28 Oct 2020 04:41: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="Y/XNw7tO"; 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 S1790069AbgJ0PJ7 (ORCPT + 99 others); Tue, 27 Oct 2020 11:09:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:37964 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1790017AbgJ0PDc (ORCPT ); Tue, 27 Oct 2020 11:03:32 -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 59EA02225E; Tue, 27 Oct 2020 15:03:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603811011; bh=ndU8lpA2DpHGVsH21ii4cnrmPBVL5fxn1bfARFz3Cjg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y/XNw7tOyUYsK4WKoEpw9X7OhIhL6gqnZo0QVvxCgB42SHSr8N5swKm+OeNT1j17R mPgmaDthUVwgM7w54QZ1P/IeLDcKZNcDQNLglbOc4ROaxkXN5/gOC8swXV8sI7FmvD x918P197XlaAg9uw6ylFoRUgmsgDSmFg0vHC7rUA= 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.8 341/633] xfs: fix finobt btree block recovery ordering Date: Tue, 27 Oct 2020 14:51:24 +0100 Message-Id: <20201027135538.684635663@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@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 04faa7310c4f0..8140bd870226a 100644 --- a/fs/xfs/xfs_buf_item_recover.c +++ b/fs/xfs/xfs_buf_item_recover.c @@ -721,6 +721,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