* [PATCHBOMB v4] xfsprogs: (more) everything I have for 6.12
@ 2024-11-21 0:07 Darrick J. Wong
2024-11-21 0:08 ` [PATCHSET 1/2] libxfs: new code " Darrick J. Wong
2024-11-21 0:08 ` [PATCHSET 2/2] xfs: bug fixes for 6.12 Darrick J. Wong
0 siblings, 2 replies; 6+ messages in thread
From: Darrick J. Wong @ 2024-11-21 0:07 UTC (permalink / raw)
To: Andrey Albershteyn; +Cc: xfs, Christoph Hellwig
Hi Andrey,
My newest xfs_repair fixes for xfsprogs 6.12 have completed review, and
there was a late libxfs change that Carlos merged. I'm about to send
you pull requests for all of those branches. However, I'm first
resending all those patches to the list so that they are archived in
their final form.
With these patches pulled, I'm done with 6.12. On to 6.13!
(You might have already pulled these three patches, in which case
disregard them and the pull requests.)
--D
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCHSET 1/2] libxfs: new code for 6.12
2024-11-21 0:07 [PATCHBOMB v4] xfsprogs: (more) everything I have for 6.12 Darrick J. Wong
@ 2024-11-21 0:08 ` Darrick J. Wong
2024-11-21 0:09 ` [PATCH 1/1] xfs: Reduce unnecessary searches when searching for the best extents Darrick J. Wong
2024-11-21 0:08 ` [PATCHSET 2/2] xfs: bug fixes for 6.12 Darrick J. Wong
1 sibling, 1 reply; 6+ messages in thread
From: Darrick J. Wong @ 2024-11-21 0:08 UTC (permalink / raw)
To: aalbersh, djwong; +Cc: cem, chizhiling, dchinner, linux-xfs
Hi all,
New code for 6.12.
If you're going to start using this code, I strongly recommend pulling
from my git trees, which are linked below.
Comments and questions are, as always, welcome.
xfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=libxfs-sync-6.12
---
Commits in this patchset:
* xfs: Reduce unnecessary searches when searching for the best extents
---
libxfs/xfs_alloc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCHSET 2/2] xfs: bug fixes for 6.12
2024-11-21 0:07 [PATCHBOMB v4] xfsprogs: (more) everything I have for 6.12 Darrick J. Wong
2024-11-21 0:08 ` [PATCHSET 1/2] libxfs: new code " Darrick J. Wong
@ 2024-11-21 0:08 ` Darrick J. Wong
2024-11-21 0:09 ` [PATCH 1/2] xfs_repair: fix crasher in pf_queuing_worker Darrick J. Wong
2024-11-21 0:09 ` [PATCH 2/2] xfs_repair: synthesize incore inode tree records when required Darrick J. Wong
1 sibling, 2 replies; 6+ messages in thread
From: Darrick J. Wong @ 2024-11-21 0:08 UTC (permalink / raw)
To: aalbersh, djwong; +Cc: linux-xfs, hch, linux-xfs
Hi all,
Bug fixes for 6.12.
If you're going to start using this code, I strongly recommend pulling
from my git trees, which are linked below.
Comments and questions are, as always, welcome.
kernel git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=xfs-fixes-6.12
xfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=xfs-fixes-6.12
---
Commits in this patchset:
* xfs_repair: fix crasher in pf_queuing_worker
* xfs_repair: synthesize incore inode tree records when required
---
repair/dino_chunks.c | 28 ++++++++++++++++++++++++++++
repair/prefetch.c | 2 ++
2 files changed, 30 insertions(+)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/1] xfs: Reduce unnecessary searches when searching for the best extents
2024-11-21 0:08 ` [PATCHSET 1/2] libxfs: new code " Darrick J. Wong
@ 2024-11-21 0:09 ` Darrick J. Wong
0 siblings, 0 replies; 6+ messages in thread
From: Darrick J. Wong @ 2024-11-21 0:09 UTC (permalink / raw)
To: aalbersh, djwong; +Cc: chizhiling, dchinner, cem, linux-xfs
From: Chi Zhiling <chizhiling@kylinos.cn>
Source kernel commit: 3ef22684038aa577c10972ee9c6a2455f5fac941
Recently, we found that the CPU spent a lot of time in
xfs_alloc_ag_vextent_size when the filesystem has millions of fragmented
spaces.
The reason is that we conducted much extra searching for extents that
could not yield a better result, and these searches would cost a lot of
time when there were millions of extents to search through. Even if we
get the same result length, we don't switch our choice to the new one,
so we can definitely terminate the search early.
Since the result length cannot exceed the found length, when the found
length equals the best result length we already have, we can conclude
the search.
We did a test in that filesystem:
[root@localhost ~]# xfs_db -c freesp /dev/vdb
from to extents blocks pct
1 1 215 215 0.01
2 3 994476 1988952 99.99
Before this patch:
0) | xfs_alloc_ag_vextent_size [xfs]() {
0) * 15597.94 us | }
After this patch:
0) | xfs_alloc_ag_vextent_size [xfs]() {
0) 19.176 us | }
Signed-off-by: Chi Zhiling <chizhiling@kylinos.cn>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
---
libxfs/xfs_alloc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libxfs/xfs_alloc.c b/libxfs/xfs_alloc.c
index 61453709ae515c..f0635b17f18548 100644
--- a/libxfs/xfs_alloc.c
+++ b/libxfs/xfs_alloc.c
@@ -1919,7 +1919,7 @@ xfs_alloc_ag_vextent_size(
error = -EFSCORRUPTED;
goto error0;
}
- if (flen < bestrlen)
+ if (flen <= bestrlen)
break;
busy = xfs_alloc_compute_aligned(args, fbno, flen,
&rbno, &rlen, &busy_gen);
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 1/2] xfs_repair: fix crasher in pf_queuing_worker
2024-11-21 0:08 ` [PATCHSET 2/2] xfs: bug fixes for 6.12 Darrick J. Wong
@ 2024-11-21 0:09 ` Darrick J. Wong
2024-11-21 0:09 ` [PATCH 2/2] xfs_repair: synthesize incore inode tree records when required Darrick J. Wong
1 sibling, 0 replies; 6+ messages in thread
From: Darrick J. Wong @ 2024-11-21 0:09 UTC (permalink / raw)
To: aalbersh, djwong; +Cc: linux-xfs, hch, linux-xfs
From: Darrick J. Wong <djwong@kernel.org>
Don't walk off the end of the inode records when we're skipping inodes
for prefetching. The skip loop doesn't make sense to me -- why we
ignore the first N inodes but don't care what number they are makes
little sense to me. But let's fix xfs/155 to crash less, eh?
Cc: <linux-xfs@vger.kernel.org> # v2.10.0
Fixes: 2556c98bd9e6b2 ("Perform true sequential bulk read prefetching in xfs_repair Merge of master-melb:xfs-cmds:29147a by kenmcd.")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
repair/prefetch.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/repair/prefetch.c b/repair/prefetch.c
index 998797e3696bac..0772ecef9d73eb 100644
--- a/repair/prefetch.c
+++ b/repair/prefetch.c
@@ -764,6 +764,8 @@ pf_queuing_worker(
irec = next_ino_rec(irec);
num_inos += XFS_INODES_PER_CHUNK;
}
+ if (!irec)
+ break;
if (args->dirs_only && cur_irec->ino_isa_dir == 0)
continue;
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] xfs_repair: synthesize incore inode tree records when required
2024-11-21 0:08 ` [PATCHSET 2/2] xfs: bug fixes for 6.12 Darrick J. Wong
2024-11-21 0:09 ` [PATCH 1/2] xfs_repair: fix crasher in pf_queuing_worker Darrick J. Wong
@ 2024-11-21 0:09 ` Darrick J. Wong
1 sibling, 0 replies; 6+ messages in thread
From: Darrick J. Wong @ 2024-11-21 0:09 UTC (permalink / raw)
To: aalbersh, djwong; +Cc: hch, linux-xfs
From: Darrick J. Wong <djwong@kernel.org>
On a filesystem with 64k fsblock size, xfs/093 fails with the following:
Phase 3 - for each AG...
- scan and clear agi unlinked lists...
found inodes not in the inode allocation tree
found inodes not in the inode allocation tree
- process known inodes and perform inode discovery...
- agno = 0
xfs_repair: dino_chunks.c:1166: process_aginodes: Assertion `num_inos == igeo->ialloc_inos' failed.
./common/xfs: line 392: 361225 Aborted (core dumped) $XFS_REPAIR_PROG $SCRATCH_OPTIONS $* $SCRATCH_DEV
In this situation, the inode size is 512b, which means that two inobt
records map to a single fs block. However, the inobt walk didn't find
the second record, so it didn't create a second incore ino_tree_node_t
object. The assertion trips, and we fail to repair the filesystem.
To fix this, synthesize incore inode records when we know that they must
exist. Mark the inodes as in use so that they will not be purged from
parent directories or moved to lost+found if the directory tree is also
compromised.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
repair/dino_chunks.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/repair/dino_chunks.c b/repair/dino_chunks.c
index 1953613345190d..86e29dd9ae05eb 100644
--- a/repair/dino_chunks.c
+++ b/repair/dino_chunks.c
@@ -1050,6 +1050,8 @@ process_aginodes(
first_ino_rec = ino_rec = findfirst_inode_rec(agno);
while (ino_rec != NULL) {
+ xfs_agino_t synth_agino;
+
/*
* paranoia - step through inode records until we step
* through a full allocation of inodes. this could
@@ -1068,6 +1070,32 @@ process_aginodes(
num_inos += XFS_INODES_PER_CHUNK;
}
+ /*
+ * We didn't find all the inobt records for this block, so the
+ * incore tree is missing a few records. This implies that the
+ * inobt is heavily damaged, so synthesize the incore records.
+ * Mark all the inodes in use to minimize data loss.
+ */
+ for (synth_agino = first_ino_rec->ino_startnum + num_inos;
+ num_inos < igeo->ialloc_inos;
+ synth_agino += XFS_INODES_PER_CHUNK,
+ num_inos += XFS_INODES_PER_CHUNK) {
+ int i;
+
+ ino_rec = find_inode_rec(mp, agno, synth_agino);
+ if (ino_rec)
+ continue;
+
+ ino_rec = set_inode_free_alloc(mp, agno, synth_agino);
+ do_warn(
+ _("found inobt record for inode %" PRIu64 " but not inode %" PRIu64 ", pretending that we did\n"),
+ XFS_AGINO_TO_INO(mp, agno,
+ first_ino_rec->ino_startnum),
+ XFS_AGINO_TO_INO(mp, agno,
+ synth_agino));
+ for (i = 0; i < XFS_INODES_PER_CHUNK; i++)
+ set_inode_used(ino_rec, i);
+ }
ASSERT(num_inos == igeo->ialloc_inos);
if (pf_args) {
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-11-21 0:09 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-21 0:07 [PATCHBOMB v4] xfsprogs: (more) everything I have for 6.12 Darrick J. Wong
2024-11-21 0:08 ` [PATCHSET 1/2] libxfs: new code " Darrick J. Wong
2024-11-21 0:09 ` [PATCH 1/1] xfs: Reduce unnecessary searches when searching for the best extents Darrick J. Wong
2024-11-21 0:08 ` [PATCHSET 2/2] xfs: bug fixes for 6.12 Darrick J. Wong
2024-11-21 0:09 ` [PATCH 1/2] xfs_repair: fix crasher in pf_queuing_worker Darrick J. Wong
2024-11-21 0:09 ` [PATCH 2/2] xfs_repair: synthesize incore inode tree records when required Darrick J. Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox