btrfs-progs: mkfs: extent-tree-v2 related fixes
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest2 patches 3 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | btrfs-progs: mkfs: fix a crash when enabling extent-tree-v2mkfs/ | +12 | 1 reply | |
| 2/2 | btrfs-progs: mkfs: fix a stack over-flow when features string are too longcommon/ common/ convert/ +1 more | +37 | 1 reply |
Reviews trailers per patch
All 2 patches have a Reviewed-by or Acked-by.
| Patch | Anand Jain |
|---|---|
| 1/2 | R-b T-b |
| 2/2 | R-b T-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 0/2] btrfs-progs: mkfs: extent-tree-v2 related fixes
Although recently we still have some uncertainty around the on-disk format for extent-tree-v2, related to how to determine the number of global roots, most of the on-disk format is fixed.
And even with the uncertain part involved, mkfs.btrfs should not crash for extent-tree-v2 feature (hidden behind the experimental builds).
There are two bugs involved:
- A crash caused by incorrectly set chunk_objectid for block group item As extent-tree-v2 feature reuse that member to indicate which extent tree a block group belongs to.
But the regular fs uses a fixed 256 for that chunk_objectid, and no extent-tree-v2 btrfs would have that many global roots.
This leads to btrfs_extent_root() to return NULL, and cause later segfault.
Fix it by properly setting chunk_objectid.
This is a regression caused by 1430b41427b5 ("btrfs-progs: separate block group tree from extent tree v2").
- A stack-over-flow caused by too long feature string
With extent-tree-v2 enabled, we have at least 84 bytes long feature string (unified features, including compat_ro features likle fst).
This is beyond the hard-coded 64 bytes limit.
Fix it by introducing a new macro to indicate a minimal safe buf size, and a sanity check to make sure that macro is really large enough.
Qu Wenruo (2):
btrfs-progs: mkfs: fix a crash when enabling extent-tree-v2
btrfs-progs: mkfs: fix a stack over-flow when features string are too
long
common/fsfeatures.c | 26 ++++++++++++++++++++++++++ common/fsfeatures.h | 7 +++++++ convert/main.c | 3 ++- mkfs/common.c | 14 ++++++++++++-- mkfs/main.c | 3 ++- 5 files changed, 49 insertions(+), 4 deletions(-)
Signature · 1 line
2.37.3