Skip to content

Conversation

@adam900710
Copy link
Collaborator

This reverts commit 136c586.

[BUG]
There is a bug report that kernel is rejecting a converted btrfs that has dev extents beyond device boundary.

The involved device extent is at 999627694980, length is 30924800, meanwhile the device is 999658557440.

The device is size not aligned to 64K, meanwhile the dev extent is aligned to 64K.

[CAUSE]
For converted btrfs, the source fs has all its freedom to choose its size, as long as it's aligned to the fs block size.

So when adding new converted data block groups we need to do extra alignment, but in make_convert_data_block_groups() we are rounding up the end, which can exceed the device size.

[FIX]
The original commit 136c586 ("btrfs-progs: convert: make sure the length of data chunks are also stripe aligned") is only a workaround to address a kernel bug.

But since the kernel bug is long fixed, there isn't really much need to do the workaround, just revert it to avoid the dev extent to go beyond device size.

Reported-by: Andieqqq [email protected]

The update of util library 0.1.3 added aliases of the C API unifying the
naming conventions. However this was not updated in the python
interface, and some of the existing symbols are not exported.

The definition table needs to copy the entry in module.c, no other
simple tricks.

Issue: kdave#995
Signed-off-by: David Sterba <[email protected]>
kdave and others added 6 commits November 3, 2025 09:23
Add python test cases for new aliases added in util lib version 0.1.3.
DUe to the way the tests are done the cases are copied and adjusted.
Eventually all the old versions are deleted, for now keep it intact for
test coverage.

Signed-off-by: David Sterba <[email protected]>
[ Fix a typo in self tests. ]
Signed-off-by: Qu Wenruo <[email protected]>
Add local patch from openSUSE that fixes symbol clash of parse_range
with util-linux-2.41, in libblkid.a in particular.

Author: Stanislav Brabec <[email protected]>
Signed-off-by: David Sterba <[email protected]>
The usage string incorrectly showed "btrfs-find-usage" instead of
"btrfs-find-root", which could confuse users reading the help text.

Signed-off-by: Dongjiang Zhu <[email protected]>
Signed-off-by: David Sterba <[email protected]>
Since the kernel patch is queued for v6.19, add notes to scrub and
dev-replace about the new behavior change.

For scrub it's not a huge deal as we can just resume using 'btrfs scrub
resume' command.
But for dev-replace one has to start from the beginning, thus it's
recommended to disable pm during dev-replace.

Signed-off-by: Qu Wenruo <[email protected]>
Signed-off-by: David Sterba <[email protected]>
CodeQL points out commented code, which is a macro to enable debugging.
To make this more useful compile it unconditionally and provide under
the debugging log level.

Signed-off-by: David Sterba <[email protected]>
… also stripe aligned"

This reverts commit 136c586.

[BUG]
There is a bug report that kernel is rejecting a converted btrfs that
has dev extents beyond device boundary.

The involved device extent is at 999627694980, length is 30924800,
meanwhile the device is 999658557440.

The device is size not aligned to 64K, meanwhile the dev extent is
aligned to 64K.

[CAUSE]
For converted btrfs, the source fs has all its freedom to choose its
size, as long as it's aligned to the fs block size.

So when adding new converted data block groups we need to do extra
alignment, but in make_convert_data_block_groups() we are rounding up
the end, which can exceed the device size.

[FIX]
The original commit 136c586 ("btrfs-progs: convert: make sure the
length of data chunks are also stripe aligned") is only a workaround to
address a kernel bug.

But since the kernel bug is long fixed, there isn't really much need to
do the workaround, just revert it to avoid the dev extent to go beyond
device size.

Reported-by: Andieqqq <[email protected]>
Signed-off-by: Qu Wenruo <[email protected]>
@adam900710 adam900710 force-pushed the convert_dev_extent_fix branch from 90c6faf to 97b14d3 Compare November 3, 2025 00:09
Copy link
Owner

@kdave kdave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack, thanks

@kdave kdave force-pushed the devel branch 2 times, most recently from ab07a9a to a0cd15c Compare November 4, 2025 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants