diff --git a/xfsprogs-6.14.0-xfs_repair-handling-a-block-with-bad-crc-bad-uuid-an.patch b/xfsprogs-6.14.0-xfs_repair-handling-a-block-with-bad-crc-bad-uuid-an.patch new file mode 100644 index 0000000..fe01b7e --- /dev/null +++ b/xfsprogs-6.14.0-xfs_repair-handling-a-block-with-bad-crc-bad-uuid-an.patch @@ -0,0 +1,55 @@ +From 8cd85addd72f1f6e569bd286f6a44dfce90355f1 Mon Sep 17 00:00:00 2001 +From: Bill O'Donnell +Date: Fri, 21 Mar 2025 17:05:35 -0500 +Subject: [PATCH] xfs_repair: handling a block with bad crc, bad uuid, and bad + magic number needs fixing + +In certain cases, if a block is so messed up that crc, uuid and magic +number are all bad, we need to not only detect in phase3 but fix it +properly in phase6. In the current code, the mechanism doesn't work +in that it only pays attention to one of the parameters. + +Note: in this case, the nlink inode link count drops to 1, but +re-running xfs_repair fixes it back to 2. This is a side effect that +should probably be handled in update_inode_nlinks() with separate patch. +Regardless, running xfs_repair twice, with this patch applied +fixes the issue. Recognize that this patch is a fix for xfs v5. + +Signed-off-by: Bill O'Donnell +Reviewed-by: "Darrick J. Wong" + +v2: remove superfluous needmagic logic +v3: clarify the description +Reviewed-by: Christoph Hellwig +Reviewed-by: Darrick J. Wong +Signed-off-by: Pavel Reichl +--- + repair/phase6.c | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/repair/phase6.c b/repair/phase6.c +index 44b9bfc3..dbc090a5 100644 +--- a/repair/phase6.c ++++ b/repair/phase6.c +@@ -2378,7 +2378,6 @@ longform_dir2_entry_check( + da_bno = (xfs_dablk_t)next_da_bno) { + const struct xfs_buf_ops *ops; + int error; +- struct xfs_dir2_data_hdr *d; + + next_da_bno = da_bno + mp->m_dir_geo->fsbcount - 1; + if (bmap_next_offset(ip, &next_da_bno)) { +@@ -2426,9 +2425,7 @@ longform_dir2_entry_check( + } + + /* check v5 metadata */ +- d = bp->b_addr; +- if (be32_to_cpu(d->magic) == XFS_DIR3_BLOCK_MAGIC || +- be32_to_cpu(d->magic) == XFS_DIR3_DATA_MAGIC) { ++ if (xfs_has_crc(mp)) { + error = check_dir3_header(mp, bp, ino); + if (error) { + fixit++; +-- +2.49.0 + diff --git a/xfsprogs.spec b/xfsprogs.spec index a8067da..5044453 100644 --- a/xfsprogs.spec +++ b/xfsprogs.spec @@ -1,7 +1,7 @@ Summary: Utilities for managing the XFS filesystem Name: xfsprogs Version: 6.4.0 -Release: 5%{?dist} +Release: 6%{?dist} License: GPL+ and LGPLv2+ URL: https://xfs.wiki.kernel.org Source0: http://kernel.org/pub/linux/utils/fs/xfs/xfsprogs/%{name}-%{version}.tar.xz @@ -39,6 +39,7 @@ Patch12: xfsprogs-rhelonly-xfs_db-fix-unitialized-variable-in-check_parents-func Patch13: xfsprogs-6.5.0-xfs.8-xfs-fix-bounds-check-in-xfs_defer_agfl_block.patch # v6.9.0-270-g5a43a004: This patch is taken from the `for-next` branch. Patch14: xfsprogs-for-next-xfs_repair-allow-symlinks-with-short-remote-targets.patch +Patch15: xfsprogs-6.14.0-xfs_repair-handling-a-block-with-bad-crc-bad-uuid-an.patch %description A set of commands to use the XFS filesystem, including mkfs.xfs. @@ -151,6 +152,10 @@ install -m 0644 %{SOURCE3} %{buildroot}%{mkfsdir} %{_libdir}/*.so %changelog +* Tue May 06 2025 Pavel Reichl - 6.4.0-6 +- xfs unrepairable filesystem if directory block not junked in phase 3 +- Related: RHEL-54342 + * Tue Dec 17 2024 Pavel Reichl - 6.4.0-5 - Fix missing rpm db entry for: /usr/share/xfsprogs - Related: RHEL-39450