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.2-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux

Pull btrfs fixes from David Sterba:
"A few more regression and regular fixes:

- regressions:
- fix assertion condition using = instead of ==
- fix false alert on bad tree level check
- fix off-by-one error in delalloc search during lseek

- fix compat ro feature check at read-write remount

- handle case when read-repair happens with ongoing device replace

- updated error messages"

* tag 'for-6.2-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
btrfs: fix compat_ro checks against remount
btrfs: always report error in run_one_delayed_ref()
btrfs: handle case when repair happens with dev-replace
btrfs: fix off-by-one in delalloc search during lseek
btrfs: fix false alert on bad tree level check
btrfs: add error message for metadata level mismatch
btrfs: fix ASSERT em->len condition in btrfs_get_extent

+53 -16
+10 -1
fs/btrfs/bio.c
··· 329 329 &map_length, &bioc, mirror_num); 330 330 if (ret) 331 331 goto out_counter_dec; 332 - BUG_ON(mirror_num != bioc->mirror_num); 332 + /* 333 + * This happens when dev-replace is also running, and the 334 + * mirror_num indicates the dev-replace target. 335 + * 336 + * In this case, we don't need to do anything, as the read 337 + * error just means the replace progress hasn't reached our 338 + * read range, and later replace routine would handle it well. 339 + */ 340 + if (mirror_num != bioc->mirror_num) 341 + goto out_counter_dec; 333 342 } 334 343 335 344 sector = bioc->stripes[bioc->mirror_num - 1].physical >> 9;
+8 -3
fs/btrfs/disk-io.c
··· 530 530 } 531 531 532 532 if (found_level != check->level) { 533 + btrfs_err(fs_info, 534 + "level verify failed on logical %llu mirror %u wanted %u found %u", 535 + eb->start, eb->read_mirror, check->level, found_level); 533 536 ret = -EIO; 534 537 goto out; 535 538 } ··· 3384 3381 /* 3385 3382 * Do various sanity and dependency checks of different features. 3386 3383 * 3384 + * @is_rw_mount: If the mount is read-write. 3385 + * 3387 3386 * This is the place for less strict checks (like for subpage or artificial 3388 3387 * feature dependencies). 3389 3388 * ··· 3396 3391 * (space cache related) can modify on-disk format like free space tree and 3397 3392 * screw up certain feature dependencies. 3398 3393 */ 3399 - int btrfs_check_features(struct btrfs_fs_info *fs_info, struct super_block *sb) 3394 + int btrfs_check_features(struct btrfs_fs_info *fs_info, bool is_rw_mount) 3400 3395 { 3401 3396 struct btrfs_super_block *disk_super = fs_info->super_copy; 3402 3397 u64 incompat = btrfs_super_incompat_flags(disk_super); ··· 3435 3430 if (btrfs_super_nodesize(disk_super) > PAGE_SIZE) 3436 3431 incompat |= BTRFS_FEATURE_INCOMPAT_BIG_METADATA; 3437 3432 3438 - if (compat_ro_unsupp && !sb_rdonly(sb)) { 3433 + if (compat_ro_unsupp && is_rw_mount) { 3439 3434 btrfs_err(fs_info, 3440 3435 "cannot mount read-write because of unknown compat_ro features (0x%llx)", 3441 3436 compat_ro); ··· 3638 3633 goto fail_alloc; 3639 3634 } 3640 3635 3641 - ret = btrfs_check_features(fs_info, sb); 3636 + ret = btrfs_check_features(fs_info, !sb_rdonly(sb)); 3642 3637 if (ret < 0) { 3643 3638 err = ret; 3644 3639 goto fail_alloc;
+1 -1
fs/btrfs/disk-io.h
··· 50 50 void __cold close_ctree(struct btrfs_fs_info *fs_info); 51 51 int btrfs_validate_super(struct btrfs_fs_info *fs_info, 52 52 struct btrfs_super_block *sb, int mirror_num); 53 - int btrfs_check_features(struct btrfs_fs_info *fs_info, struct super_block *sb); 53 + int btrfs_check_features(struct btrfs_fs_info *fs_info, bool is_rw_mount); 54 54 int write_all_supers(struct btrfs_fs_info *fs_info, int max_mirrors); 55 55 struct btrfs_super_block *btrfs_read_dev_super(struct block_device *bdev); 56 56 struct btrfs_super_block *btrfs_read_dev_one_super(struct block_device *bdev,
+1 -1
fs/btrfs/extent-io-tree.c
··· 1551 1551 u64 last = 0; 1552 1552 int found = 0; 1553 1553 1554 - if (WARN_ON(search_end <= cur_start)) 1554 + if (WARN_ON(search_end < cur_start)) 1555 1555 return 0; 1556 1556 1557 1557 spin_lock(&tree->lock);
+5 -2
fs/btrfs/extent-tree.c
··· 1713 1713 BUG(); 1714 1714 if (ret && insert_reserved) 1715 1715 btrfs_pin_extent(trans, node->bytenr, node->num_bytes, 1); 1716 + if (ret < 0) 1717 + btrfs_err(trans->fs_info, 1718 + "failed to run delayed ref for logical %llu num_bytes %llu type %u action %u ref_mod %d: %d", 1719 + node->bytenr, node->num_bytes, node->type, 1720 + node->action, node->ref_mod, ret); 1716 1721 return ret; 1717 1722 } 1718 1723 ··· 1959 1954 if (ret) { 1960 1955 unselect_delayed_ref_head(delayed_refs, locked_ref); 1961 1956 btrfs_put_delayed_ref(ref); 1962 - btrfs_debug(fs_info, "run_one_delayed_ref returned %d", 1963 - ret); 1964 1957 return ret; 1965 1958 } 1966 1959
+25 -5
fs/btrfs/extent_io.c
··· 104 104 btrfs_bio_end_io_t end_io_func; 105 105 106 106 /* 107 + * This is for metadata read, to provide the extra needed verification 108 + * info. This has to be provided for submit_one_bio(), as 109 + * submit_one_bio() can submit a bio if it ends at stripe boundary. If 110 + * no such parent_check is provided, the metadata can hit false alert at 111 + * endio time. 112 + */ 113 + struct btrfs_tree_parent_check *parent_check; 114 + 115 + /* 107 116 * Tell writepage not to lock the state bits for this range, it still 108 117 * does the unlocking. 109 118 */ ··· 142 133 143 134 btrfs_bio(bio)->file_offset = page_offset(bv->bv_page) + bv->bv_offset; 144 135 145 - if (!is_data_inode(&inode->vfs_inode)) 136 + if (!is_data_inode(&inode->vfs_inode)) { 137 + if (btrfs_op(bio) != BTRFS_MAP_WRITE) { 138 + /* 139 + * For metadata read, we should have the parent_check, 140 + * and copy it to bbio for metadata verification. 141 + */ 142 + ASSERT(bio_ctrl->parent_check); 143 + memcpy(&btrfs_bio(bio)->parent_check, 144 + bio_ctrl->parent_check, 145 + sizeof(struct btrfs_tree_parent_check)); 146 + } 146 147 btrfs_submit_metadata_bio(inode, bio, mirror_num); 147 - else if (btrfs_op(bio) == BTRFS_MAP_WRITE) 148 + } else if (btrfs_op(bio) == BTRFS_MAP_WRITE) { 148 149 btrfs_submit_data_write_bio(inode, bio, mirror_num); 149 - else 150 + } else { 150 151 btrfs_submit_data_read_bio(inode, bio, mirror_num, 151 152 bio_ctrl->compress_type); 153 + } 152 154 153 155 /* The bio is owned by the end_io handler now */ 154 156 bio_ctrl->bio = NULL; ··· 4849 4829 struct extent_state *cached_state = NULL; 4850 4830 struct btrfs_bio_ctrl bio_ctrl = { 4851 4831 .mirror_num = mirror_num, 4832 + .parent_check = check, 4852 4833 }; 4853 4834 int ret = 0; 4854 4835 ··· 4899 4878 */ 4900 4879 atomic_dec(&eb->io_pages); 4901 4880 } 4902 - memcpy(&btrfs_bio(bio_ctrl.bio)->parent_check, check, sizeof(*check)); 4903 4881 submit_one_bio(&bio_ctrl); 4904 4882 if (ret || wait != WAIT_COMPLETE) { 4905 4883 free_extent_state(cached_state); ··· 4925 4905 unsigned long num_reads = 0; 4926 4906 struct btrfs_bio_ctrl bio_ctrl = { 4927 4907 .mirror_num = mirror_num, 4908 + .parent_check = check, 4928 4909 }; 4929 4910 4930 4911 if (test_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags)) ··· 5017 4996 } 5018 4997 } 5019 4998 5020 - memcpy(&btrfs_bio(bio_ctrl.bio)->parent_check, check, sizeof(*check)); 5021 4999 submit_one_bio(&bio_ctrl); 5022 5000 5023 5001 if (ret || wait != WAIT_COMPLETE)
+1 -1
fs/btrfs/file.c
··· 3354 3354 bool search_io_tree = true; 3355 3355 bool ret = false; 3356 3356 3357 - while (cur_offset < end) { 3357 + while (cur_offset <= end) { 3358 3358 u64 delalloc_start; 3359 3359 u64 delalloc_end; 3360 3360 bool delalloc;
+1 -1
fs/btrfs/inode.c
··· 7092 7092 * Other members are not utilized for inline extents. 7093 7093 */ 7094 7094 ASSERT(em->block_start == EXTENT_MAP_INLINE); 7095 - ASSERT(em->len = fs_info->sectorsize); 7095 + ASSERT(em->len == fs_info->sectorsize); 7096 7096 7097 7097 ret = read_inline_extent(inode, path, page); 7098 7098 if (ret < 0)
+1 -1
fs/btrfs/super.c
··· 1705 1705 if (ret) 1706 1706 goto restore; 1707 1707 1708 - ret = btrfs_check_features(fs_info, sb); 1708 + ret = btrfs_check_features(fs_info, !(*flags & SB_RDONLY)); 1709 1709 if (ret < 0) 1710 1710 goto restore; 1711 1711