From ee377eff1d584f7cb96ede2f0448516cf645f4a2 Mon Sep 17 00:00:00 2001 From: wguanghao Date: Tue, 5 Sep 2023 09:16:38 +0000 Subject: [PATCH] xfs_repair: fix warn in xfs_buf_find when growfs fails Signed-off-by: wguanghao --- ...rn-in-xfs_buf_find-when-growfs-fails.patch | 93 +++++++++++++++++++ xfsprogs.spec | 8 +- 2 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 0010-xfs_repair-fix-warn-in-xfs_buf_find-when-growfs-fails.patch diff --git a/0010-xfs_repair-fix-warn-in-xfs_buf_find-when-growfs-fails.patch b/0010-xfs_repair-fix-warn-in-xfs_buf_find-when-growfs-fails.patch new file mode 100644 index 0000000..3add0cf --- /dev/null +++ b/0010-xfs_repair-fix-warn-in-xfs_buf_find-when-growfs-fails.patch @@ -0,0 +1,93 @@ +From d1b7a268a4d5f47e6e8d1ed9f2d44c61ba9103a2 Mon Sep 17 00:00:00 2001 +From: Long Li +Date: Fri, 7 Jul 2023 17:01:52 +0800 +Subject: [PATCH] xfs_repair: fix warn in xfs_buf_find when growfs fails + +The kernel does not update secondary superblock through transactions, so +the atomicity of secondary sb cannot be guaranteed. If IO failures are +encountered during the growfs, secondary superblocks and primary superblock +will be inconsistent, and xfs_repair may update the old data in secondary +superblocks to primary superblock. This will cause sb_dblocks to be less +than the actual value and trigger the following warning. + +When checking whether secondary superblocks and primary superblock are +consistent, do not judge the fields that will change during growfs in +superblock. + +XFS (sdb): Starting recovery (logdev: internal) +XFS (sdb): xfs_buf_find: daddr 0xf00001 out of range, EOFS 0xeec208 +------------[ cut here ]------------ +WARNING: CPU: 2 PID: 54142 at fs/xfs/xfs_buf.c:615 xfs_buf_find+0x268a/0x2f90 fs/xfs/xfs_buf.c:612 +Modules linked in: +CPU: 2 PID: 54142 Comm: mount Not tainted 5.10.0-02690-g9edb619c0692 #24 +Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 +RIP: 0010:xfs_buf_find+0x268a/0x2f90 fs/xfs/xfs_buf.c:615 +Code: 01 e8 aa 1e 16 ff 49 89 d8 4c 89 e1 4c 89 ef 48 c7 c2 a0 c2 02 af 48 c7 c6 e0 b8 02 af e8 16 dc a2 02 48 83 05 3e 56 00 09 01 <0f> 0b 48 83 05 3c 56 00 09 01 48 83 05 3c 56 00 09 01 41 bc 8b ff +RSP: 0018:ffff88811c6b7138 EFLAGS: 00010202 +RAX: 0000000000000000 RBX: 0000000000eec208 RCX: 0000000000000000 +RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffed10238d6e17 +RBP: ffff88811c6b72b8 R08: ffff88810168c000 R09: 0000000000000001 +R10: ffff8881f6738427 R11: ffffed103ece7084 R12: 0000000000f00001 +R13: ffff88812fe44000 R14: ffff88810da77418 R15: 0000000000000001 +FS: 00007f9ef08e0080(0000) GS:ffff8881f6700000(0000) knlGS:0000000000000000 +CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 +CR2: 0000564ec77273d0 CR3: 000000011ba20005 CR4: 0000000000370ee0 +DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 +DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 +Call Trace: + xfs_buf_get_map+0xc3/0xa20 fs/xfs/xfs_buf.c:717 + xfs_buf_read_map+0xd1/0xbe0 fs/xfs/xfs_buf.c:832 + xfs_buf_readahead_map+0x185/0x1c0 fs/xfs/xfs_buf.c:913 + xfs_buf_readahead fs/xfs/xfs_buf.h:249 [inline] + xlog_buf_readahead+0x13d/0x160 fs/xfs/xfs_log_recover.c:1921 + xlog_recover_buf_ra_pass2+0xad/0xf0 fs/xfs/xfs_buf_item_recover.c:177 + xlog_recover_commit_trans+0x3bb/0xec0 fs/xfs/xfs_log_recover.c:2003 + xlog_recovery_process_trans+0x1de/0x290 fs/xfs/xfs_log_recover.c:2256 + xlog_recover_process_ophdr+0x205/0x4c0 fs/xfs/xfs_log_recover.c:2402 + xlog_recover_process_data+0x1dc/0x620 fs/xfs/xfs_log_recover.c:2444 + xlog_recover_process+0x296/0x390 fs/xfs/xfs_log_recover.c:2892 + xlog_do_recovery_pass+0x7fb/0x13e0 fs/xfs/xfs_log_recover.c:3178 + xlog_do_log_recovery+0xf8/0x170 fs/xfs/xfs_log_recover.c:3258 + xlog_do_recover+0x118/0x810 fs/xfs/xfs_log_recover.c:3286 + xlog_recover+0x2d1/0x5d0 fs/xfs/xfs_log_recover.c:3420 + xfs_log_mount+0x40f/0xa00 fs/xfs/xfs_log.c:713 + xfs_mountfs+0x12f5/0x2390 fs/xfs/xfs_mount.c:905 + xfs_fc_fill_super+0x1482/0x1f80 fs/xfs/xfs_super.c:1684 + get_tree_bdev+0x4ba/0x890 fs/super.c:1345 + xfs_fc_get_tree+0x20/0x30 fs/xfs/xfs_super.c:1731 + vfs_get_tree+0x96/0x390 fs/super.c:1550 + do_new_mount fs/namespace.c:2900 [inline] + path_mount+0x7b0/0x2430 fs/namespace.c:3230 + do_mount+0x10f/0x140 fs/namespace.c:3243 + __do_sys_mount fs/namespace.c:3451 [inline] + __se_sys_mount fs/namespace.c:3428 [inline] + __x64_sys_mount+0x1bb/0x2b0 fs/namespace.c:3428 + do_syscall_64+0x4b/0x80 arch/x86/entry/common.c:46 + entry_SYSCALL_64_after_hwframe+0x61/0xc6 + +Signed-off-by: Long Li +Signed-off-by: Wu Guanghao +--- + repair/sb.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/repair/sb.c b/repair/sb.c +index 7391cf04..fe63bff3 100644 +--- a/repair/sb.c ++++ b/repair/sb.c +@@ -663,13 +663,11 @@ get_sb_geometry(fs_geometry_t *geo, xfs_sb_t *sbp) + * blindly set fields that we know are always good + */ + geo->sb_blocksize = sbp->sb_blocksize; +- geo->sb_dblocks = sbp->sb_dblocks; + geo->sb_rblocks = sbp->sb_rblocks; + geo->sb_rextents = sbp->sb_rextents; + geo->sb_logstart = sbp->sb_logstart; + geo->sb_rextsize = sbp->sb_rextsize; + geo->sb_agblocks = sbp->sb_agblocks; +- geo->sb_agcount = sbp->sb_agcount; + geo->sb_rbmblocks = sbp->sb_rbmblocks; + geo->sb_logblocks = sbp->sb_logblocks; + geo->sb_sectsize = sbp->sb_sectsize; +-- +2.31.1 \ No newline at end of file diff --git a/xfsprogs.spec b/xfsprogs.spec index 9fe240b..7a11960 100644 --- a/xfsprogs.spec +++ b/xfsprogs.spec @@ -1,6 +1,6 @@ Name: xfsprogs Version: 5.14.1 -Release: 12 +Release: 13 Summary: Administration and debugging tools for the XFS file system License: GPL+ and LGPLv2+ URL: https://xfs.wiki.kernel.org @@ -27,7 +27,8 @@ Patch5: 0005-xfs_db-use-preferable-macro-to-seek-offset-for-local.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 -Patch9: 0009-mkfs.xfs-fix-segmentation-fault-caused-by-accessing-.patch +Patch9: 0009-mkfs.xfs-fix-segmentation-fault-caused-by-accessing-.patch +Patch10: 0010-xfs_repair-fix-warn-in-xfs_buf_find-when-growfs-fails.patch %description xfsprogs are the userspace utilities that manage XFS filesystems. @@ -111,6 +112,9 @@ rm -rf %{buildroot}%{_datadir}/doc/xfsprogs/ %changelog +* Tue Sep 12 2023 wuguanghao - 5.14.1-13 +- xfs_repair: fix warn in xfs_buf_find when growfs fails + * Sun Sep 3 2023 wuguanghao - 5.14.1-12 - fix segmentation fault in mkfs.xfs -- Gitee