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

Pull btrfs fixes from David Sterba:

- in tree-checker fix extref bounds check

- reorder send context structure to avoid
-Wflex-array-member-not-at-end warning

- fix extent readahead length for compressed extents

- fix memory leaks on error paths (qgroup assign ioctl, zone loading
with raid stripe tree enabled)

- fix how device specific mount options are applied, in particular the
'ssd' option will be set unexpectedly

- fix tracking of relocation state when tasks are running and
cancellation is attempted

- adjust assertion condition for folios allocated for scrub

- remove incorrect assertion checking for block group when populating
free space tree

* tag 'for-6.18-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
btrfs: send: fix -Wflex-array-member-not-at-end warning in struct send_ctx
btrfs: tree-checker: fix bounds check in check_inode_extref()
btrfs: fix memory leaks when rejecting a non SINGLE data profile without an RST
btrfs: fix incorrect readahead expansion length
btrfs: do not assert we found block group item when creating free space tree
btrfs: do not use folio_test_partial_kmap() in ASSERT()s
btrfs: only set the device specific options after devices are opened
btrfs: fix memory leak on duplicated memory in the qgroup assign ioctl
btrfs: fix clearing of BTRFS_FS_RELOC_RUNNING if relocation already running

+25 -22
+1 -1
fs/btrfs/extent_io.c
··· 973 973 { 974 974 const u64 ra_pos = readahead_pos(ractl); 975 975 const u64 ra_end = ra_pos + readahead_length(ractl); 976 - const u64 em_end = em->start + em->ram_bytes; 976 + const u64 em_end = em->start + em->len; 977 977 978 978 /* No expansion for holes and inline extents. */ 979 979 if (em->disk_bytenr > EXTENT_MAP_LAST_BYTE)
+8 -7
fs/btrfs/free-space-tree.c
··· 1106 1106 * If ret is 1 (no key found), it means this is an empty block group, 1107 1107 * without any extents allocated from it and there's no block group 1108 1108 * item (key BTRFS_BLOCK_GROUP_ITEM_KEY) located in the extent tree 1109 - * because we are using the block group tree feature, so block group 1110 - * items are stored in the block group tree. It also means there are no 1111 - * extents allocated for block groups with a start offset beyond this 1112 - * block group's end offset (this is the last, highest, block group). 1109 + * because we are using the block group tree feature (so block group 1110 + * items are stored in the block group tree) or this is a new block 1111 + * group created in the current transaction and its block group item 1112 + * was not yet inserted in the extent tree (that happens in 1113 + * btrfs_create_pending_block_groups() -> insert_block_group_item()). 1114 + * It also means there are no extents allocated for block groups with a 1115 + * start offset beyond this block group's end offset (this is the last, 1116 + * highest, block group). 1113 1117 */ 1114 - if (!btrfs_fs_compat_ro(trans->fs_info, BLOCK_GROUP_TREE)) 1115 - ASSERT(ret == 0); 1116 - 1117 1118 start = block_group->start; 1118 1119 end = block_group->start + block_group->length; 1119 1120 while (ret == 0) {
+1 -1
fs/btrfs/ioctl.c
··· 3740 3740 prealloc = kzalloc(sizeof(*prealloc), GFP_KERNEL); 3741 3741 if (!prealloc) { 3742 3742 ret = -ENOMEM; 3743 - goto drop_write; 3743 + goto out; 3744 3744 } 3745 3745 } 3746 3746
+7 -6
fs/btrfs/relocation.c
··· 3780 3780 /* 3781 3781 * Mark start of chunk relocation that is cancellable. Check if the cancellation 3782 3782 * has been requested meanwhile and don't start in that case. 3783 + * NOTE: if this returns an error, reloc_chunk_end() must not be called. 3783 3784 * 3784 3785 * Return: 3785 3786 * 0 success ··· 3797 3796 3798 3797 if (atomic_read(&fs_info->reloc_cancel_req) > 0) { 3799 3798 btrfs_info(fs_info, "chunk relocation canceled on start"); 3800 - /* 3801 - * On cancel, clear all requests but let the caller mark 3802 - * the end after cleanup operations. 3803 - */ 3799 + /* On cancel, clear all requests. */ 3800 + clear_and_wake_up_bit(BTRFS_FS_RELOC_RUNNING, &fs_info->flags); 3804 3801 atomic_set(&fs_info->reloc_cancel_req, 0); 3805 3802 return -ECANCELED; 3806 3803 } ··· 3807 3808 3808 3809 /* 3809 3810 * Mark end of chunk relocation that is cancellable and wake any waiters. 3811 + * NOTE: call only if a previous call to reloc_chunk_start() succeeded. 3810 3812 */ 3811 3813 static void reloc_chunk_end(struct btrfs_fs_info *fs_info) 3812 3814 { 3815 + ASSERT(test_bit(BTRFS_FS_RELOC_RUNNING, &fs_info->flags)); 3813 3816 /* Requested after start, clear bit first so any waiters can continue */ 3814 3817 if (atomic_read(&fs_info->reloc_cancel_req) > 0) 3815 3818 btrfs_info(fs_info, "chunk relocation canceled during operation"); ··· 4024 4023 if (err && rw) 4025 4024 btrfs_dec_block_group_ro(rc->block_group); 4026 4025 iput(rc->data_inode); 4026 + reloc_chunk_end(fs_info); 4027 4027 out_put_bg: 4028 4028 btrfs_put_block_group(bg); 4029 - reloc_chunk_end(fs_info); 4030 4029 free_reloc_control(rc); 4031 4030 return err; 4032 4031 } ··· 4209 4208 ret = ret2; 4210 4209 out_unset: 4211 4210 unset_reloc_control(rc); 4212 - out_end: 4213 4211 reloc_chunk_end(fs_info); 4212 + out_end: 4214 4213 free_reloc_control(rc); 4215 4214 out: 4216 4215 free_reloc_roots(&reloc_roots);
+2 -2
fs/btrfs/scrub.c
··· 694 694 695 695 /* stripe->folios[] is allocated by us and no highmem is allowed. */ 696 696 ASSERT(folio); 697 - ASSERT(!folio_test_partial_kmap(folio)); 697 + ASSERT(!folio_test_highmem(folio)); 698 698 return folio_address(folio) + offset_in_folio(folio, offset); 699 699 } 700 700 ··· 707 707 708 708 /* stripe->folios[] is allocated by us and no highmem is allowed. */ 709 709 ASSERT(folio); 710 - ASSERT(!folio_test_partial_kmap(folio)); 710 + ASSERT(!folio_test_highmem(folio)); 711 711 /* And the range must be contained inside the folio. */ 712 712 ASSERT(offset_in_folio(folio, offset) + fs_info->sectorsize <= folio_size(folio)); 713 713 return page_to_phys(folio_page(folio, 0)) + offset_in_folio(folio, offset);
+3 -1
fs/btrfs/send.c
··· 178 178 u64 cur_inode_rdev; 179 179 u64 cur_inode_last_extent; 180 180 u64 cur_inode_next_write_offset; 181 - struct fs_path cur_inode_path; 182 181 bool cur_inode_new; 183 182 bool cur_inode_new_gen; 184 183 bool cur_inode_deleted; ··· 304 305 305 306 struct btrfs_lru_cache dir_created_cache; 306 307 struct btrfs_lru_cache dir_utimes_cache; 308 + 309 + /* Must be last as it ends in a flexible-array member. */ 310 + struct fs_path cur_inode_path; 307 311 }; 308 312 309 313 struct pending_dir_move {
+1 -2
fs/btrfs/super.c
··· 1900 1900 return PTR_ERR(sb); 1901 1901 } 1902 1902 1903 - set_device_specific_options(fs_info); 1904 - 1905 1903 if (sb->s_root) { 1906 1904 /* 1907 1905 * Not the first mount of the fs thus got an existing super block. ··· 1944 1946 deactivate_locked_super(sb); 1945 1947 return -EACCES; 1946 1948 } 1949 + set_device_specific_options(fs_info); 1947 1950 bdev = fs_devices->latest_dev->bdev; 1948 1951 snprintf(sb->s_id, sizeof(sb->s_id), "%pg", bdev); 1949 1952 shrinker_debugfs_rename(sb->s_shrink, "sb-btrfs:%s", sb->s_id);
+1 -1
fs/btrfs/tree-checker.c
··· 1797 1797 struct btrfs_inode_extref *extref = (struct btrfs_inode_extref *)ptr; 1798 1798 u16 namelen; 1799 1799 1800 - if (unlikely(ptr + sizeof(*extref)) > end) { 1800 + if (unlikely(ptr + sizeof(*extref) > end)) { 1801 1801 inode_ref_err(leaf, slot, 1802 1802 "inode extref overflow, ptr %lu end %lu inode_extref size %zu", 1803 1803 ptr, end, sizeof(*extref));
+1 -1
fs/btrfs/zoned.c
··· 1753 1753 !fs_info->stripe_root) { 1754 1754 btrfs_err(fs_info, "zoned: data %s needs raid-stripe-tree", 1755 1755 btrfs_bg_type_to_raid_name(map->type)); 1756 - return -EINVAL; 1756 + ret = -EINVAL; 1757 1757 } 1758 1758 1759 1759 if (unlikely(cache->alloc_offset > cache->zone_capacity)) {