From 7ddc97fb0c36afac13486a5c819724f86f2a9f82 Mon Sep 17 00:00:00 2001 From: liuh Date: Wed, 29 May 2024 10:19:25 +0800 Subject: [PATCH] xfs_db: don't hardcode 'type data' size at 512b --- ...on-t-hardcode-type-data-size-at-512b.patch | 62 +++++++++++++++++++ xfsprogs.spec | 6 +- 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 0047-xfs_db-don-t-hardcode-type-data-size-at-512b.patch diff --git a/0047-xfs_db-don-t-hardcode-type-data-size-at-512b.patch b/0047-xfs_db-don-t-hardcode-type-data-size-at-512b.patch new file mode 100644 index 0000000..ff6ac8b --- /dev/null +++ b/0047-xfs_db-don-t-hardcode-type-data-size-at-512b.patch @@ -0,0 +1,62 @@ +From 127b66a4d8afc6f3dfe8929c01b1f1e63c1ebf31 Mon Sep 17 00:00:00 2001 +From: "Darrick J. Wong" +Date: Thu, 22 Feb 2024 14:04:31 -0800 +Subject: xfs_db: don't hardcode 'type data' size at 512b + +On a disk with 4096-byte LBAs, the xfs_db 'type data' subcommand doesn't +work: + +# xfs_io -c 'sb' -c 'type data' /dev/sda +xfs_db: read failed: Invalid argument +no current object + +The cause of this is the hardcoded initialization of bb_count when we're +setting type data -- it should be the filesystem sector size, not just 1. + +Signed-off-by: "Darrick J. Wong" +Reviewed-by: Christoph Hellwig +Reviewed-by: Carlos Maiolino +Signed-off-by: Carlos Maiolino +--- + db/block.c | 3 ++- + db/io.c | 3 ++- + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/db/block.c b/db/block.c +index f31f954..25c6961 100644 +--- a/db/block.c ++++ b/db/block.c +@@ -124,6 +124,7 @@ daddr_f( + { + int64_t d; + char *p; ++ int bb_count = BTOBB(mp->m_sb.sb_sectsize); + + if (argc == 1) { + dbprintf(_("current daddr is %lld\n"), iocur_top->off >> BBSHIFT); +@@ -136,7 +137,7 @@ daddr_f( + return 0; + } + ASSERT(typtab[TYP_DATA].typnm == TYP_DATA); +- set_cur(&typtab[TYP_DATA], d, 1, DB_RING_ADD, NULL); ++ set_cur(&typtab[TYP_DATA], d, bb_count, DB_RING_ADD, NULL); + return 0; + } + +diff --git a/db/io.c b/db/io.c +index c79cf10..755c147 100644 +--- a/db/io.c ++++ b/db/io.c +@@ -588,7 +588,8 @@ void + set_iocur_type( + const typ_t *type) + { +- int bb_count = 1; /* type's size in basic blocks */ ++ /* type's size in basic blocks */ ++ int bb_count = BTOBB(mp->m_sb.sb_sectsize); + + /* + * Inodes are special; verifier checks all inodes in the chunk, the +-- +2.27.0 + diff --git a/xfsprogs.spec b/xfsprogs.spec index aeba965..63111ef 100644 --- a/xfsprogs.spec +++ b/xfsprogs.spec @@ -1,6 +1,6 @@ Name: xfsprogs Version: 5.14.1 -Release: 15 +Release: 16 Summary: Administration and debugging tools for the XFS file system License: GPL+ and LGPLv2+ URL: https://xfs.wiki.kernel.org @@ -65,6 +65,7 @@ Patch43: 0043-xfs_repair-retain-superblock-buffer-to-avoid-write-h.patch Patch44: 0044-fsck.xfs-mount-umount-xfs-fs-to-replay-log-before-ru.patch Patch45: 0045-xfs_db-fix-dir3-block-magic-check.patch Patch46: 0046-xfs_repair-fix-incorrect-dabtree-hashval-comparison.patch +Patch47: 0047-xfs_db-don-t-hardcode-type-data-size-at-512b.patch %description @@ -149,6 +150,9 @@ rm -rf %{buildroot}%{_datadir}/doc/xfsprogs/ %changelog +* Wed May 29 2024 liuh - 5.14.1-16 +- sync patch from community + * Wed Dec 27 2023 wuguanghao - 5.14.1-15 - backport patches from community -- Gitee