Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH v2 0/3] btrfs-progs: check: add detection for missing root orphan items
@ 2025-07-26 22:32 Qu Wenruo
  2025-07-26 22:33 ` [PATCH v2 1/3] btrfs-progs: check/original: detect missing orphan items correctly Qu Wenruo
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Qu Wenruo @ 2025-07-26 22:32 UTC (permalink / raw)
  To: linux-btrfs

[CHANGELOG]
v2:
- Enhance the original mode to detect any refs mismatch
  Thus even if the root item has 0 refs but we find some unexpected
  backref, then it will also report it as an error.

  Thanks Boris for point this out.

There is an internal bug report that some half-dropped subvolume makes
balance to fail.

It turns out that, the involved subvolume doesn't have an orphan item,
this means the half-dropped subvolume is never going to be cleaned up.

Then at balance time, a reloc tree is created for that half-dropped
subvolume, and since balance doesn't expect to get a half-dropped
subvolume, it doesn't check the drop_process_key and increased ref on
already dropped nodes.

The problem for progs is that, neither original mode nor lowmem detects
this kind of problem.

Original mode has a bad logic which prevents us from calling the proper
orphan item check.
Lowmem mode doesn't even take orphan item into consideration.

This series will add the detection part for btrfs-check, for both
original and lowmem mode, with a hand crafted image for test.


Qu Wenruo (3):
  btrfs-progs: check/original: detect missing orphan items correctly
  btrfs-progs: check/lowmem: detect missing orphan items correctly
  btrfs-progs: fsck-tests: a new test case for missing root orphan item

 check/main.c                                  |  39 +++++++++++-------
 check/mode-lowmem.c                           |  11 +++++
 check/mode-original.h                         |   3 ++
 .../default.img.xz                            | Bin 0 -> 13468 bytes
 .../066-missing-root-orphan-item/test.sh      |  14 +++++++
 5 files changed, 51 insertions(+), 16 deletions(-)
 create mode 100644 tests/fsck-tests/066-missing-root-orphan-item/default.img.xz
 create mode 100755 tests/fsck-tests/066-missing-root-orphan-item/test.sh

--
2.50.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-07-27 19:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-26 22:32 [PATCH v2 0/3] btrfs-progs: check: add detection for missing root orphan items Qu Wenruo
2025-07-26 22:33 ` [PATCH v2 1/3] btrfs-progs: check/original: detect missing orphan items correctly Qu Wenruo
2025-07-26 22:33 ` [PATCH v2 2/3] btrfs-progs: check/lowmem: " Qu Wenruo
2025-07-26 22:33 ` [PATCH v2 3/3] btrfs-progs: fsck-tests: a new test case for missing root orphan item Qu Wenruo
2025-07-27 19:07 ` [PATCH v2 0/3] btrfs-progs: check: add detection for missing root orphan items Boris Burkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox