From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C8DA183CBB; Sun, 16 Mar 2025 06:18:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742105892; cv=none; b=CAHhdbmuESL3GxhvXhvUyXuXQ+yM4Fy2UAPVt7Mc9UFFmwjD3HY2x7ofDQrFosTx8rChldN3QTKRiotQWdd75PZczuXVNzzdQ+SPMxSwo++30DZjtwuiU9eOCAnjtclQozopchvHJaXYGeayTW/mY4FHxAM14zvMEfbFz5XWiic= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742105892; c=relaxed/simple; bh=6KrR2Uceu7Lxr+fO87wTyPsYTDNnCb1Mx5JfS81gWPQ=; h=Subject:To:Cc:From:Date:In-Reply-To:Message-ID:MIME-Version: Content-Type; b=YxlqfE3jTFY5Y94Z2rkrak1y2kc94+o+e7Wl8/9YjlOJcqRq6h9Xt6tZwKNRqjUsgPSTj0oq43CeSmk4Q1Fh++UBoJ76goprfr8kdVCheQin2Ft1zhygD9c4M50yH/6qLCyU+2gxWQJZJLe6K3A26Qrmf7T9YoGqpTrPtsVYAgs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=dc/GBHWK; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="dc/GBHWK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06F69C4CEDD; Sun, 16 Mar 2025 06:18:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1742105892; bh=6KrR2Uceu7Lxr+fO87wTyPsYTDNnCb1Mx5JfS81gWPQ=; h=Subject:To:Cc:From:Date:In-Reply-To:From; b=dc/GBHWKloNXsPSnbVfaTXDLUh+L/LpsPCMU9xsvnOqf+YCX71YBFi0Cf1FbXnxwD j/RRd2tlWgT6ejld3aGpIpbhCx7EFjQlJMfYmp9vLn3eLHpjcORzuhRwkBkmuEnfuw KWdFZHGiujl96iD76tjJs4dnjld27gf4ARGL7wXo= Subject: Patch "xfs: update dir3 leaf block metadata after swap" has been added to the 6.1-stable tree To: chandanbabu@kernel.org,david@fromorbit.com,djwong@kernel.org,gregkh@linuxfoundation.org,leah.rumancik@gmail.com,xfs-stable@lists.linux.dev,zhangtianci.1997@bytedance.com Cc: From: Date: Sun, 16 Mar 2025 07:17:08 +0100 In-Reply-To: <20250313202550.2257219-28-leah.rumancik@gmail.com> Message-ID: <2025031608-keg-jump-9de5@gregkh> Precedence: bulk X-Mailing-List: xfs-stable@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit X-stable: commit X-Patchwork-Hint: ignore This is a note to let you know that I've just added the patch titled xfs: update dir3 leaf block metadata after swap to the 6.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: xfs-update-dir3-leaf-block-metadata-after-swap.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >From stable+bounces-124384-greg=kroah.com@vger.kernel.org Thu Mar 13 21:26:48 2025 From: Leah Rumancik Date: Thu, 13 Mar 2025 13:25:47 -0700 Subject: xfs: update dir3 leaf block metadata after swap To: stable@vger.kernel.org Cc: xfs-stable@lists.linux.dev, Zhang Tianci , Dave Chinner , "Darrick J. Wong" , Chandan Babu R , Leah Rumancik Message-ID: <20250313202550.2257219-28-leah.rumancik@gmail.com> From: Zhang Tianci [ Upstream commit 5759aa4f956034b289b0ae2c99daddfc775442e1 ] xfs_da3_swap_lastblock() copy the last block content to the dead block, but do not update the metadata in it. We need update some metadata for some kinds of type block, such as dir3 leafn block records its blkno, we shall update it to the dead block blkno. Otherwise, before write the xfs_buf to disk, the verify_write() will fail in blk_hdr->blkno != xfs_buf->b_bn, then xfs will be shutdown. We will get this warning: XFS (dm-0): Metadata corruption detected at xfs_dir3_leaf_verify+0xa8/0xe0 [xfs], xfs_dir3_leafn block 0x178 XFS (dm-0): Unmount and run xfs_repair XFS (dm-0): First 128 bytes of corrupted metadata buffer: 00000000e80f1917: 00 80 00 0b 00 80 00 07 3d ff 00 00 00 00 00 00 ........=....... 000000009604c005: 00 00 00 00 00 00 01 a0 00 00 00 00 00 00 00 00 ................ 000000006b6fb2bf: e4 44 e3 97 b5 64 44 41 8b 84 60 0e 50 43 d9 bf .D...dDA..`.PC.. 00000000678978a2: 00 00 00 00 00 00 00 83 01 73 00 93 00 00 00 00 .........s...... 00000000b28b247c: 99 29 1d 38 00 00 00 00 99 29 1d 40 00 00 00 00 .).8.....).@.... 000000002b2a662c: 99 29 1d 48 00 00 00 00 99 49 11 00 00 00 00 00 .).H.....I...... 00000000ea2ffbb8: 99 49 11 08 00 00 45 25 99 49 11 10 00 00 48 fe .I....E%.I....H. 0000000069e86440: 99 49 11 18 00 00 4c 6b 99 49 11 20 00 00 4d 97 .I....Lk.I. ..M. XFS (dm-0): xfs_do_force_shutdown(0x8) called from line 1423 of file fs/xfs/xfs_buf.c. Return address = 00000000c0ff63c1 XFS (dm-0): Corruption of in-memory data detected. Shutting down filesystem XFS (dm-0): Please umount the filesystem and rectify the problem(s) >>>From the log above, we know xfs_buf->b_no is 0x178, but the block's hdr record its blkno is 0x1a0. Fixes: 24df33b45ecf ("xfs: add CRC checking to dir2 leaf blocks") Signed-off-by: Zhang Tianci Suggested-by: Dave Chinner Reviewed-by: "Darrick J. Wong" Signed-off-by: Chandan Babu R Signed-off-by: Leah Rumancik Acked-by: "Darrick J. Wong" Signed-off-by: Greg Kroah-Hartman --- fs/xfs/libxfs/xfs_da_btree.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/fs/xfs/libxfs/xfs_da_btree.c +++ b/fs/xfs/libxfs/xfs_da_btree.c @@ -2316,10 +2316,17 @@ xfs_da3_swap_lastblock( return error; /* * Copy the last block into the dead buffer and log it. + * On CRC-enabled file systems, also update the stamped in blkno. */ memcpy(dead_buf->b_addr, last_buf->b_addr, args->geo->blksize); + if (xfs_has_crc(mp)) { + struct xfs_da3_blkinfo *da3 = dead_buf->b_addr; + + da3->blkno = cpu_to_be64(xfs_buf_daddr(dead_buf)); + } xfs_trans_log_buf(tp, dead_buf, 0, args->geo->blksize - 1); dead_info = dead_buf->b_addr; + /* * Get values from the moved block. */ Patches currently in stable-queue which might be from leah.rumancik@gmail.com are queue-6.1/xfs-fix-confusing-xfs_extent_item-variable-names.patch queue-6.1/xfs-fix-32-bit-truncation-in-xfs_compute_rextslog.patch queue-6.1/xfs-transfer-recovered-intent-item-ownership-in-iop_recover.patch queue-6.1/xfs-initialise-di_crc-in-xfs_log_dinode.patch queue-6.1/xfs-consider-minlen-sized-extents-in-xfs_rtallocate_extent_block.patch queue-6.1/xfs-don-t-leak-recovered-attri-intent-items.patch queue-6.1/xfs-remove-unused-fields-from-struct-xbtree_ifakeroot.patch queue-6.1/xfs-fix-bounds-check-in-xfs_defer_agfl_block.patch queue-6.1/xfs-ensure-logflagsp-is-initialized-in-xfs_bmap_del_extent_real.patch queue-6.1/xfs-convert-rt-bitmap-extent-lengths-to-xfs_rtbxlen_t.patch queue-6.1/xfs-pass-refcount-intent-directly-through-the-log-intent-code.patch queue-6.1/xfs-fix-perag-leak-when-growfs-fails.patch queue-6.1/xfs-pass-the-xfs_defer_pending-object-to-iop_recover.patch queue-6.1/xfs-update-dir3-leaf-block-metadata-after-swap.patch queue-6.1/xfs-use-deferred-frees-for-btree-block-freeing.patch queue-6.1/xfs-make-rextslog-computation-consistent-with-mkfs.patch queue-6.1/xfs-pass-xfs_extent_free_item-directly-through-the-log-intent-code.patch queue-6.1/xfs-move-the-xfs_rtbitmap.c-declarations-to-xfs_rtbitmap.h.patch queue-6.1/xfs-recompute-growfsrtfree-transaction-reservation-while-growing-rt-volume.patch queue-6.1/xfs-reserve-less-log-space-when-recovering-log-intent-items.patch queue-6.1/xfs-pass-the-xfs_bmbt_irec-directly-through-the-log-intent-code.patch queue-6.1/xfs-force-all-buffers-to-be-written-during-btree-bulk-load.patch queue-6.1/xfs-reset-xfs_attr_incomplete-filter-on-node-removal.patch queue-6.1/xfs-add-lock-protection-when-remove-perag-from-radix-tree.patch queue-6.1/xfs-use-xfs_defer_pending-objects-to-recover-intent-items.patch queue-6.1/xfs-pass-per-ag-references-to-xfs_free_extent.patch queue-6.1/xfs-validate-block-number-being-freed-before-adding-to-xefi.patch queue-6.1/xfs-don-t-allow-overly-small-or-large-realtime-volumes.patch queue-6.1/xfs-remove-conditional-building-of-rt-geometry-validator-functions.patch