btrfs-progs: temporarily disable usage of v2 of search tree ioctl

For unclear reasons using the v2 ioctl leads to an infinite loop in
'btrfs fi usage' in load_chunk_info() when there's only one valid item
returned and then it keeps looping. Can be reproduced by mkfs-tests/001.

After debugging, from second item in the buffer there's all zeros, while
it's returned nr_items=4. Switching the same code to use v1 makes it
work again. It's puzzling as it's the same code in kernel.

We want to make the switch eventually so only disable the detection so
other code can use the new API.

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2024-03-16 18:13:04 +01:00
parent a223764093
commit d73e698248
1 changed files with 6 additions and 0 deletions

View File

@ -691,8 +691,14 @@ int btrfs_tree_search_ioctl(int fd, struct btrfs_tree_search_args *sa)
{ {
/* On first use check the supported status and save it. */ /* On first use check the supported status and save it. */
if (!tree_search_v2_initialized) { if (!tree_search_v2_initialized) {
#if 0
/*
* Keep using v1 until v2 is fully tested, in some cases it
* does not return properly formatted results in the buffer.
*/
if (btrfs_tree_search2_ioctl_supported(fd) == 1) if (btrfs_tree_search2_ioctl_supported(fd) == 1)
tree_search_v2_supported = true; tree_search_v2_supported = true;
#endif
tree_search_v2_initialized = true; tree_search_v2_initialized = true;
} }
sa->use_v2 = tree_search_v2_supported; sa->use_v2 = tree_search_v2_supported;