Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'for-6.4-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux

Pull btrfs fixes from David Sterba:

- fix backward leaf iteration which could possibly return the same key

- fix assertion when device add and balance race for exclusive
operation

- fix regression when freeing device, state tree would leak after
device replace

- fix attempt to clear space cache v1 when block-group-tree is enabled

- fix potential i_size corruption when encoded write races with send v2
and enabled no-holes (the race is hard to hit though, the window is a
few instructions wide)

- fix wrong bitmap API use when checking empty zones, parameters were
swapped but not causing a bug due to other code

- prevent potential qgroup leak if subvolume create does not commit
transaction (which is pending in the development queue)

- error handling and reporting:
- abort transaction when sibling keys check fails for leaves
- print extent buffers when sibling keys check fails

* tag 'for-6.4-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
btrfs: don't free qgroup space unless specified
btrfs: fix encoded write i_size corruption with no-holes
btrfs: zoned: fix wrong use of bitops API in btrfs_ensure_empty_zones
btrfs: properly reject clear_cache and v1 cache for block-group-tree
btrfs: print extent buffers when sibling keys check fails
btrfs: abort transaction when sibling keys check fails for leaves
btrfs: fix leak of source device allocation state after device replace
btrfs: fix assertion of exclop condition when starting balance
btrfs: fix btrfs_prev_leaf() to not return the same key twice

+55 -9
+2 -1
fs/btrfs/block-rsv.c
··· 124 124 } else { 125 125 num_bytes = 0; 126 126 } 127 - if (block_rsv->qgroup_rsv_reserved >= block_rsv->qgroup_rsv_size) { 127 + if (qgroup_to_release_ret && 128 + block_rsv->qgroup_rsv_reserved >= block_rsv->qgroup_rsv_size) { 128 129 qgroup_to_release = block_rsv->qgroup_rsv_reserved - 129 130 block_rsv->qgroup_rsv_size; 130 131 block_rsv->qgroup_rsv_reserved = block_rsv->qgroup_rsv_size;
+37 -1
fs/btrfs/ctree.c
··· 2627 2627 } 2628 2628 2629 2629 if (btrfs_comp_cpu_keys(&left_last, &right_first) >= 0) { 2630 + btrfs_crit(left->fs_info, "left extent buffer:"); 2631 + btrfs_print_tree(left, false); 2632 + btrfs_crit(left->fs_info, "right extent buffer:"); 2633 + btrfs_print_tree(right, false); 2630 2634 btrfs_crit(left->fs_info, 2631 2635 "bad key order, sibling blocks, left last (%llu %u %llu) right first (%llu %u %llu)", 2632 2636 left_last.objectid, left_last.type, ··· 3219 3215 3220 3216 if (check_sibling_keys(left, right)) { 3221 3217 ret = -EUCLEAN; 3218 + btrfs_abort_transaction(trans, ret); 3222 3219 btrfs_tree_unlock(right); 3223 3220 free_extent_buffer(right); 3224 3221 return ret; ··· 3438 3433 3439 3434 if (check_sibling_keys(left, right)) { 3440 3435 ret = -EUCLEAN; 3436 + btrfs_abort_transaction(trans, ret); 3441 3437 goto out; 3442 3438 } 3443 3439 return __push_leaf_left(trans, path, min_data_size, empty, left, ··· 4484 4478 int btrfs_prev_leaf(struct btrfs_root *root, struct btrfs_path *path) 4485 4479 { 4486 4480 struct btrfs_key key; 4481 + struct btrfs_key orig_key; 4487 4482 struct btrfs_disk_key found_key; 4488 4483 int ret; 4489 4484 4490 4485 btrfs_item_key_to_cpu(path->nodes[0], &key, 0); 4486 + orig_key = key; 4491 4487 4492 4488 if (key.offset > 0) { 4493 4489 key.offset--; ··· 4506 4498 4507 4499 btrfs_release_path(path); 4508 4500 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); 4509 - if (ret < 0) 4501 + if (ret <= 0) 4510 4502 return ret; 4503 + 4504 + /* 4505 + * Previous key not found. Even if we were at slot 0 of the leaf we had 4506 + * before releasing the path and calling btrfs_search_slot(), we now may 4507 + * be in a slot pointing to the same original key - this can happen if 4508 + * after we released the path, one of more items were moved from a 4509 + * sibling leaf into the front of the leaf we had due to an insertion 4510 + * (see push_leaf_right()). 4511 + * If we hit this case and our slot is > 0 and just decrement the slot 4512 + * so that the caller does not process the same key again, which may or 4513 + * may not break the caller, depending on its logic. 4514 + */ 4515 + if (path->slots[0] < btrfs_header_nritems(path->nodes[0])) { 4516 + btrfs_item_key(path->nodes[0], &found_key, path->slots[0]); 4517 + ret = comp_keys(&found_key, &orig_key); 4518 + if (ret == 0) { 4519 + if (path->slots[0] > 0) { 4520 + path->slots[0]--; 4521 + return 0; 4522 + } 4523 + /* 4524 + * At slot 0, same key as before, it means orig_key is 4525 + * the lowest, leftmost, key in the tree. We're done. 4526 + */ 4527 + return 1; 4528 + } 4529 + } 4530 + 4511 4531 btrfs_item_key(path->nodes[0], &found_key, 0); 4512 4532 ret = comp_keys(&found_key, &key); 4513 4533 /*
+3 -2
fs/btrfs/file-item.c
··· 52 52 u64 start, end, i_size; 53 53 int ret; 54 54 55 + spin_lock(&inode->lock); 55 56 i_size = new_i_size ?: i_size_read(&inode->vfs_inode); 56 57 if (btrfs_fs_incompat(fs_info, NO_HOLES)) { 57 58 inode->disk_i_size = i_size; 58 - return; 59 + goto out_unlock; 59 60 } 60 61 61 - spin_lock(&inode->lock); 62 62 ret = find_contiguous_extent_bit(&inode->file_extent_tree, 0, &start, 63 63 &end, EXTENT_DIRTY); 64 64 if (!ret && start == 0) ··· 66 66 else 67 67 i_size = 0; 68 68 inode->disk_i_size = i_size; 69 + out_unlock: 69 70 spin_unlock(&inode->lock); 70 71 } 71 72
+3 -1
fs/btrfs/ioctl.c
··· 454 454 case BTRFS_EXCLOP_BALANCE_PAUSED: 455 455 spin_lock(&fs_info->super_lock); 456 456 ASSERT(fs_info->exclusive_operation == BTRFS_EXCLOP_BALANCE || 457 - fs_info->exclusive_operation == BTRFS_EXCLOP_DEV_ADD); 457 + fs_info->exclusive_operation == BTRFS_EXCLOP_DEV_ADD || 458 + fs_info->exclusive_operation == BTRFS_EXCLOP_NONE || 459 + fs_info->exclusive_operation == BTRFS_EXCLOP_BALANCE_PAUSED); 458 460 fs_info->exclusive_operation = BTRFS_EXCLOP_BALANCE_PAUSED; 459 461 spin_unlock(&fs_info->super_lock); 460 462 break;
+6 -1
fs/btrfs/super.c
··· 826 826 !btrfs_test_opt(info, CLEAR_CACHE)) { 827 827 btrfs_err(info, "cannot disable free space tree"); 828 828 ret = -EINVAL; 829 - 829 + } 830 + if (btrfs_fs_compat_ro(info, BLOCK_GROUP_TREE) && 831 + (btrfs_test_opt(info, CLEAR_CACHE) || 832 + !btrfs_test_opt(info, FREE_SPACE_TREE))) { 833 + btrfs_err(info, "cannot disable free space tree with block-group-tree feature"); 834 + ret = -EINVAL; 830 835 } 831 836 if (!ret) 832 837 ret = btrfs_check_mountopts_zoned(info);
+1
fs/btrfs/volumes.c
··· 395 395 { 396 396 WARN_ON(!list_empty(&device->post_commit_list)); 397 397 rcu_string_free(device->name); 398 + extent_io_tree_release(&device->alloc_state); 398 399 btrfs_destroy_dev_zone_info(device); 399 400 kfree(device); 400 401 }
+3 -3
fs/btrfs/zoned.c
··· 1168 1168 return -ERANGE; 1169 1169 1170 1170 /* All the zones are conventional */ 1171 - if (find_next_bit(zinfo->seq_zones, begin, end) == end) 1171 + if (find_next_bit(zinfo->seq_zones, end, begin) == end) 1172 1172 return 0; 1173 1173 1174 1174 /* All the zones are sequential and empty */ 1175 - if (find_next_zero_bit(zinfo->seq_zones, begin, end) == end && 1176 - find_next_zero_bit(zinfo->empty_zones, begin, end) == end) 1175 + if (find_next_zero_bit(zinfo->seq_zones, end, begin) == end && 1176 + find_next_zero_bit(zinfo->empty_zones, end, begin) == end) 1177 1177 return 0; 1178 1178 1179 1179 for (pos = start; pos < start + size; pos += zinfo->zone_size) {