Skip to content

btrfs-progs: detect and fix orphan roots without orphan items

Qu Wenruo linux-btrfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3btrfs-progs: check/lowmem: add the ability to detect and repair orphan subvolume trees which doesn't have orphan itemcheck/mode-common.c check/mode-common.h check/mode-lowmem.c+82 -192 replies
2/3btrfs-progs: check/original: detect and repair orphan subvolume without orphan itemcheck/main.c+11 -260 replies
3/3btrfs-progs: fsck-tests: add test image for orphan roots without an orphan itemtests/fsck-tests/048-orphan-roots/.lowmem_repairable tests/fsck-tests/048-orphan-roots/default.img.xz+0 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] btrfs-progs: detect and fix orphan roots without orphan items

There is bug report from Zhenyu Wu <[email protected]>, where even there is only one subvolume, his filesystem still consumes way more space than expected.

The problem is, there are 58 snapshots, but all of them have no ROOT_REF/ROOT_BACKREF, and all their root refs is 0.

But strangely there is no orphan items for them.

This means, btrfs kernel module won't detect them as orphan nor queue them to be removed.

"btrfs subvolume delete -i" do no helps, as it still requires ROOT_BACKREF to resolve the dentry.

For now, we should teach btrfs check to detect and repair the case by adding new orphan items for them.

The root cause I guess is some strange behavior for orphan item insert and subvolume unlink.
As the report mentioned that he had one forced power off.

Qu Wenruo (3):
btrfs-progs: check/lowmem: add the ability to detect and repair orphan
subvolume trees which doesn't have orphan item
btrfs-progs: check/original: detect and repair orphan subvolume
without orphan item
btrfs-progs: fsck-tests: add test image for orphan roots without an
orphan item

 check/main.c                                  |  37 ++++--------
 check/mode-common.c                           |  56 ++++++++++++++++++
 check/mode-common.h                           |   3 +
 check/mode-lowmem.c                           |  42 +++++++------
 .../048-orphan-roots/.lowmem_repairable       |   0
 .../048-orphan-roots/default.img.xz           | Bin 0 -> 2584 bytes
 6 files changed, 93 insertions(+), 45 deletions(-)
 create mode 100644 tests/fsck-tests/048-orphan-roots/.lowmem_repairable
 create mode 100644 tests/fsck-tests/048-orphan-roots/default.img.xz
Signature · 1 line
2.32.0