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

Pull btrfs fixes from David Sterba:
"Two fixes for NOCOW files, a regression fix in scrub and an assertion
fix:

- NOCOW fixes:
- keep length of iomap direct io request in case of a failure
- properly pass mode of extent reference checking, this can break
some cases for swapfile

- fix error value confusion when scrubbing a stripe

- convert assertion to a proper error handling when loading global
roots, reported by syzbot"

* tag 'for-6.4-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
btrfs: scrub: fix a return value overwrite in scrub_stripe()
btrfs: do not ASSERT() on duplicated global roots
btrfs: can_nocow_file_extent should pass down args->strict from callers
btrfs: fix iomap_begin length for nocow writes

+22 -10
+8 -2
fs/btrfs/disk-io.c
··· 996 996 { 997 997 struct btrfs_fs_info *fs_info = root->fs_info; 998 998 struct rb_node *tmp; 999 + int ret = 0; 999 1000 1000 1001 write_lock(&fs_info->global_root_lock); 1001 1002 tmp = rb_find_add(&root->rb_node, &fs_info->global_root_tree, global_root_cmp); 1002 1003 write_unlock(&fs_info->global_root_lock); 1003 - ASSERT(!tmp); 1004 1004 1005 - return tmp ? -EEXIST : 0; 1005 + if (tmp) { 1006 + ret = -EEXIST; 1007 + btrfs_warn(fs_info, "global root %llu %llu already exists", 1008 + root->root_key.objectid, root->root_key.offset); 1009 + } 1010 + return ret; 1006 1011 } 1007 1012 1008 1013 void btrfs_global_root_delete(struct btrfs_root *root) ··· 2847 2842 /* We can't trust the free space cache either */ 2848 2843 btrfs_set_opt(fs_info->mount_opt, CLEAR_CACHE); 2849 2844 2845 + btrfs_warn(fs_info, "try to load backup roots slot %d", i); 2850 2846 ret = read_backup_root(fs_info, i); 2851 2847 backup_index = ret; 2852 2848 if (ret < 0)
+13 -7
fs/btrfs/inode.c
··· 1864 1864 1865 1865 ret = btrfs_cross_ref_exist(root, btrfs_ino(inode), 1866 1866 key->offset - args->extent_offset, 1867 - args->disk_bytenr, false, path); 1867 + args->disk_bytenr, args->strict, path); 1868 1868 WARN_ON_ONCE(ret > 0 && is_freespace_inode); 1869 1869 if (ret != 0) 1870 1870 goto out; ··· 7264 7264 static int btrfs_get_blocks_direct_write(struct extent_map **map, 7265 7265 struct inode *inode, 7266 7266 struct btrfs_dio_data *dio_data, 7267 - u64 start, u64 len, 7267 + u64 start, u64 *lenp, 7268 7268 unsigned int iomap_flags) 7269 7269 { 7270 7270 const bool nowait = (iomap_flags & IOMAP_NOWAIT); ··· 7275 7275 struct btrfs_block_group *bg; 7276 7276 bool can_nocow = false; 7277 7277 bool space_reserved = false; 7278 + u64 len = *lenp; 7278 7279 u64 prev_len; 7279 7280 int ret = 0; 7280 7281 ··· 7346 7345 free_extent_map(em); 7347 7346 *map = NULL; 7348 7347 7349 - if (nowait) 7350 - return -EAGAIN; 7348 + if (nowait) { 7349 + ret = -EAGAIN; 7350 + goto out; 7351 + } 7351 7352 7352 7353 /* 7353 7354 * If we could not allocate data space before locking the file 7354 7355 * range and we can't do a NOCOW write, then we have to fail. 7355 7356 */ 7356 - if (!dio_data->data_space_reserved) 7357 - return -ENOSPC; 7357 + if (!dio_data->data_space_reserved) { 7358 + ret = -ENOSPC; 7359 + goto out; 7360 + } 7358 7361 7359 7362 /* 7360 7363 * We have to COW and we have already reserved data space before, ··· 7399 7394 btrfs_delalloc_release_extents(BTRFS_I(inode), len); 7400 7395 btrfs_delalloc_release_metadata(BTRFS_I(inode), len, true); 7401 7396 } 7397 + *lenp = len; 7402 7398 return ret; 7403 7399 } 7404 7400 ··· 7576 7570 7577 7571 if (write) { 7578 7572 ret = btrfs_get_blocks_direct_write(&em, inode, dio_data, 7579 - start, len, flags); 7573 + start, &len, flags); 7580 7574 if (ret < 0) 7581 7575 goto unlock_err; 7582 7576 unlock_extents = true;
+1 -1
fs/btrfs/scrub.c
··· 2266 2266 } 2267 2267 out: 2268 2268 ret2 = flush_scrub_stripes(sctx); 2269 - if (!ret2) 2269 + if (!ret) 2270 2270 ret = ret2; 2271 2271 if (sctx->raid56_data_stripes) { 2272 2272 for (int i = 0; i < nr_data_stripes(map); i++)