From 310e14e5cf8933c13bbfd2fd9d6300fb78feeb6b Mon Sep 17 00:00:00 2001 From: wguanghao Date: Tue, 15 Aug 2023 23:27:23 +0800 Subject: [PATCH] fix xfs_repair failure (cherry picked from commit 305d031de198be8cc28e9d236f5b066c35690394) --- ...he-problem-of-repair-failure-caused-.patch | 86 +++++++++++++++++++ xfsprogs.spec | 12 ++- 2 files changed, 94 insertions(+), 4 deletions(-) create mode 100644 0008-xfs_repair-fix-the-problem-of-repair-failure-caused-.patch diff --git a/0008-xfs_repair-fix-the-problem-of-repair-failure-caused-.patch b/0008-xfs_repair-fix-the-problem-of-repair-failure-caused-.patch new file mode 100644 index 0000000..e4fba7c --- /dev/null +++ b/0008-xfs_repair-fix-the-problem-of-repair-failure-caused-.patch @@ -0,0 +1,86 @@ +From a86308c98d33e921eb133f47faedf1d9e62f2e77 Mon Sep 17 00:00:00 2001 +From: Wu Guanghao +Date: Wed, 26 Jul 2023 09:43:16 +0800 +Subject: [PATCH] xfs_repair: fix the problem of repair failure caused by dirty + flag being abnormally set on buffer + +We found an issue where repair failed in the fault injection. + +$ xfs_repair test.img +... +Phase 3 - for each AG... + - scan and clear agi unlinked lists... + - process known inodes and perform inode discovery... + - agno = 0 + - agno = 1 + - agno = 2 +Metadata CRC error detected at 0x55a30e420c7d, xfs_bmbt block 0x51d68/0x1000 + - agno = 3 +Metadata CRC error detected at 0x55a30e420c7d, xfs_bmbt block 0x51d68/0x1000 +btree block 0/41901 is suspect, error -74 +bad magic # 0x58534c4d in inode 3306572 (data fork) bmbt block 41901 +bad data fork in inode 3306572 +cleared inode 3306572 +... +Phase 7 - verify and correct link counts... +Metadata corruption detected at 0x55a30e420b58, xfs_bmbt block 0x51d68/0x1000 +libxfs_bwrite: write verifier failed on xfs_bmbt bno 0x51d68/0x8 +xfs_repair: Releasing dirty buffer to free list! +xfs_repair: Refusing to write a corrupt buffer to the data device! +xfs_repair: Lost a write to the data device! + +fatal error -- File system metadata writeout failed, err=117. Re-run xfs_repair. + + +$ xfs_db test.img +xfs_db> inode 3306572 +xfs_db> p +core.magic = 0x494e +core.mode = 0100666 // regular file +core.version = 3 +core.format = 3 (btree) +... +u3.bmbt.keys[1] = [startoff] +1:[6] +u3.bmbt.ptrs[1] = 41901 // btree root +... + +$ hexdump -C -n 4096 41901.img +00000000 58 53 4c 4d 00 00 00 00 00 00 01 e8 d6 f4 03 14 |XSLM............| +00000010 09 f3 a6 1b 0a 3c 45 5a 96 39 41 ac 09 2f 66 99 |..... +Reviewed-by: Darrick J. Wong +--- + repair/scan.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/repair/scan.c b/repair/scan.c +index 008ef65a..27a33286 100644 +--- a/repair/scan.c ++++ b/repair/scan.c +@@ -185,7 +185,7 @@ scan_lbtree( + + ASSERT(dirty == 0 || (dirty && !no_modify)); + +- if ((dirty || badcrc) && !no_modify) { ++ if (!err && (dirty || badcrc) && !no_modify) { + libxfs_buf_mark_dirty(bp); + libxfs_buf_relse(bp); + } +-- +2.41.0 + diff --git a/xfsprogs.spec b/xfsprogs.spec index cb528e1..024e4c2 100644 --- a/xfsprogs.spec +++ b/xfsprogs.spec @@ -1,6 +1,6 @@ Name: xfsprogs Version: 5.14.1 -Release: 10 +Release: 11 Summary: Administration and debugging tools for the XFS file system License: GPL+ and LGPLv2+ URL: https://xfs.wiki.kernel.org @@ -18,14 +18,15 @@ Provides: xfsprogs-qa-devel Obsoletes: xfsprogs-qa-devel <= %{version} Conflicts: xfsdump < 3.0.1 -Patch0: xfsprogs-5.12.0-default-bigtime-inobtcnt-on.patch -Patch1: 0001-xfs-correct-nlink-printf-specifier-from-hd-to-PRIu32.patch +Patch0: xfsprogs-5.12.0-default-bigtime-inobtcnt-on.patch +Patch1: 0001-xfs-correct-nlink-printf-specifier-from-hd-to-PRIu32.patch Patch2: 0002-libxfs-fix-inode-reservation-space-for-removing-tran.patch Patch3: 0003-mkfs-prevent-corruption-of-passed-in-suboption-strin.patch Patch4: 0004-xfsprogs-Add-sw64-architecture.patch Patch5: 0005-xfs_db-use-preferable-macro-to-seek-offset-for-local.patch -Patch6: 0006-mkfs.xfs-disable-inobtcount-feature.patch +Patch6: 0006-mkfs.xfs-disable-inobtcount-feature.patch Patch7: 0007-libxcmd-add-return-value-check-for-dynamic-memory-fu.patch +Patch8: 0008-xfs_repair-fix-the-problem-of-repair-failure-caused-.patch %description xfsprogs are the userspace utilities that manage XFS filesystems. @@ -109,6 +110,9 @@ rm -rf %{buildroot}%{_datadir}/doc/xfsprogs/ %changelog +* Tue Aug 15 2023 wuguanghao - 5.14.1-11 +- fix xfs_repair failure + * Sun Jun 25 2023 Weifeng Su - 5.14.1-10 - add return value check for dynamic memory function -- Gitee