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 branch 'for-4.14-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux

Pull btrfs fixes from David Sterba:
"We've collected a bunch of isolated fixes, for crashes, user-visible
behaviour or missing bits from other subsystem cleanups from the past.

The overall number is not small but I was not able to make it
significantly smaller. Most of the patches are supposed to go to
stable"

* 'for-4.14-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
btrfs: log csums for all modified extents
Btrfs: fix unexpected result when dio reading corrupted blocks
btrfs: Report error on removing qgroup if del_qgroup_item fails
Btrfs: skip checksum when reading compressed data if some IO have failed
Btrfs: fix kernel oops while reading compressed data
Btrfs: use btrfs_op instead of bio_op in __btrfs_map_block
Btrfs: do not backup tree roots when fsync
btrfs: remove BTRFS_FS_QUOTA_DISABLING flag
btrfs: propagate error to btrfs_cmp_data_prepare caller
btrfs: prevent to set invalid default subvolid
Btrfs: send: fix error number for unknown inode types
btrfs: fix NULL pointer dereference from free_reloc_roots()
btrfs: finish ordered extent cleaning if no progress is found
btrfs: clear ordered flag on cleaning up ordered extents
Btrfs: fix incorrect {node,sector}size endianness from BTRFS_IOC_FS_INFO
Btrfs: do not reset bio->bi_ops while writing bio
Btrfs: use the new helper wbc_to_write_flags

+72 -27
+17 -1
fs/btrfs/compression.c
··· 107 107 struct inode *inode; 108 108 struct page *page; 109 109 unsigned long index; 110 - int ret; 110 + unsigned int mirror = btrfs_io_bio(bio)->mirror_num; 111 + int ret = 0; 111 112 112 113 if (bio->bi_status) 113 114 cb->errors = 1; ··· 118 117 */ 119 118 if (!refcount_dec_and_test(&cb->pending_bios)) 120 119 goto out; 120 + 121 + /* 122 + * Record the correct mirror_num in cb->orig_bio so that 123 + * read-repair can work properly. 124 + */ 125 + ASSERT(btrfs_io_bio(cb->orig_bio)); 126 + btrfs_io_bio(cb->orig_bio)->mirror_num = mirror; 127 + cb->mirror_num = mirror; 128 + 129 + /* 130 + * Some IO in this cb have failed, just skip checksum as there 131 + * is no way it could be correct. 132 + */ 133 + if (cb->errors == 1) 134 + goto csum_failed; 121 135 122 136 inode = cb->inode; 123 137 ret = check_compressed_csum(BTRFS_I(inode), cb,
-1
fs/btrfs/ctree.h
··· 709 709 #define BTRFS_FS_OPEN 5 710 710 #define BTRFS_FS_QUOTA_ENABLED 6 711 711 #define BTRFS_FS_QUOTA_ENABLING 7 712 - #define BTRFS_FS_QUOTA_DISABLING 8 713 712 #define BTRFS_FS_UPDATE_UUID_TREE_GEN 9 714 713 #define BTRFS_FS_CREATING_FREE_SPACE_TREE 10 715 714 #define BTRFS_FS_BTREE_ERR 11
+8 -1
fs/btrfs/disk-io.c
··· 3643 3643 u64 flags; 3644 3644 3645 3645 do_barriers = !btrfs_test_opt(fs_info, NOBARRIER); 3646 - backup_super_roots(fs_info); 3646 + 3647 + /* 3648 + * max_mirrors == 0 indicates we're from commit_transaction, 3649 + * not from fsync where the tree roots in fs_info have not 3650 + * been consistent on disk. 3651 + */ 3652 + if (max_mirrors == 0) 3653 + backup_super_roots(fs_info); 3647 3654 3648 3655 sb = fs_info->super_for_commit; 3649 3656 dev_item = &sb->dev_item;
+2 -6
fs/btrfs/extent_io.c
··· 3471 3471 unsigned int write_flags = 0; 3472 3472 unsigned long nr_written = 0; 3473 3473 3474 - if (wbc->sync_mode == WB_SYNC_ALL) 3475 - write_flags = REQ_SYNC; 3474 + write_flags = wbc_to_write_flags(wbc); 3476 3475 3477 3476 trace___extent_writepage(page, inode, wbc); 3478 3477 ··· 3717 3718 unsigned long i, num_pages; 3718 3719 unsigned long bio_flags = 0; 3719 3720 unsigned long start, end; 3720 - unsigned int write_flags = (epd->sync_io ? REQ_SYNC : 0) | REQ_META; 3721 + unsigned int write_flags = wbc_to_write_flags(wbc) | REQ_META; 3721 3722 int ret = 0; 3722 3723 3723 3724 clear_bit(EXTENT_BUFFER_WRITE_ERR, &eb->bflags); ··· 4061 4062 { 4062 4063 if (epd->bio) { 4063 4064 int ret; 4064 - 4065 - bio_set_op_attrs(epd->bio, REQ_OP_WRITE, 4066 - epd->sync_io ? REQ_SYNC : 0); 4067 4065 4068 4066 ret = submit_one_bio(epd->bio, 0, epd->bio_flags); 4069 4067 BUG_ON(ret < 0); /* -ENOMEM */
+22 -5
fs/btrfs/inode.c
··· 135 135 const u64 offset, 136 136 const u64 bytes) 137 137 { 138 + unsigned long index = offset >> PAGE_SHIFT; 139 + unsigned long end_index = (offset + bytes - 1) >> PAGE_SHIFT; 140 + struct page *page; 141 + 142 + while (index <= end_index) { 143 + page = find_get_page(inode->i_mapping, index); 144 + index++; 145 + if (!page) 146 + continue; 147 + ClearPagePrivate2(page); 148 + put_page(page); 149 + } 138 150 return __endio_write_update_ordered(inode, offset + PAGE_SIZE, 139 151 bytes - PAGE_SIZE, false); 140 152 } ··· 8369 8357 struct btrfs_io_bio *io_bio = btrfs_io_bio(bio); 8370 8358 blk_status_t err = bio->bi_status; 8371 8359 8372 - if (dip->flags & BTRFS_DIO_ORIG_BIO_SUBMITTED) { 8360 + if (dip->flags & BTRFS_DIO_ORIG_BIO_SUBMITTED) 8373 8361 err = btrfs_subio_endio_read(inode, io_bio, err); 8374 - if (!err) 8375 - bio->bi_status = 0; 8376 - } 8377 8362 8378 8363 unlock_extent(&BTRFS_I(inode)->io_tree, dip->logical_offset, 8379 8364 dip->logical_offset + dip->bytes - 1); ··· 8378 8369 8379 8370 kfree(dip); 8380 8371 8381 - dio_bio->bi_status = bio->bi_status; 8372 + dio_bio->bi_status = err; 8382 8373 dio_end_io(dio_bio); 8383 8374 8384 8375 if (io_bio->end_io) ··· 8396 8387 btrfs_work_func_t func; 8397 8388 u64 ordered_offset = offset; 8398 8389 u64 ordered_bytes = bytes; 8390 + u64 last_offset; 8399 8391 int ret; 8400 8392 8401 8393 if (btrfs_is_free_space_inode(BTRFS_I(inode))) { ··· 8408 8398 } 8409 8399 8410 8400 again: 8401 + last_offset = ordered_offset; 8411 8402 ret = btrfs_dec_test_first_ordered_pending(inode, &ordered, 8412 8403 &ordered_offset, 8413 8404 ordered_bytes, ··· 8419 8408 btrfs_init_work(&ordered->work, func, finish_ordered_fn, NULL, NULL); 8420 8409 btrfs_queue_work(wq, &ordered->work); 8421 8410 out_test: 8411 + /* 8412 + * If btrfs_dec_test_ordered_pending does not find any ordered extent 8413 + * in the range, we can exit. 8414 + */ 8415 + if (ordered_offset == last_offset) 8416 + return; 8422 8417 /* 8423 8418 * our bio might span multiple ordered extents. If we haven't 8424 8419 * completed the accounting for the whole dio, go back and try again
+8 -4
fs/btrfs/ioctl.c
··· 2773 2773 } 2774 2774 mutex_unlock(&fs_devices->device_list_mutex); 2775 2775 2776 - fi_args->nodesize = fs_info->super_copy->nodesize; 2777 - fi_args->sectorsize = fs_info->super_copy->sectorsize; 2778 - fi_args->clone_alignment = fs_info->super_copy->sectorsize; 2776 + fi_args->nodesize = fs_info->nodesize; 2777 + fi_args->sectorsize = fs_info->sectorsize; 2778 + fi_args->clone_alignment = fs_info->sectorsize; 2779 2779 2780 2780 if (copy_to_user(arg, fi_args, sizeof(*fi_args))) 2781 2781 ret = -EFAULT; ··· 3032 3032 out: 3033 3033 if (ret) 3034 3034 btrfs_cmp_data_free(cmp); 3035 - return 0; 3035 + return ret; 3036 3036 } 3037 3037 3038 3038 static int btrfs_cmp_data(u64 len, struct cmp_pages *cmp) ··· 4059 4059 new_root = btrfs_read_fs_root_no_name(fs_info, &location); 4060 4060 if (IS_ERR(new_root)) { 4061 4061 ret = PTR_ERR(new_root); 4062 + goto out; 4063 + } 4064 + if (!is_fstree(new_root->objectid)) { 4065 + ret = -ENOENT; 4062 4066 goto out; 4063 4067 } 4064 4068
+2 -4
fs/btrfs/qgroup.c
··· 807 807 } 808 808 ret = 0; 809 809 out: 810 - set_bit(BTRFS_FS_QUOTA_DISABLING, &root->fs_info->flags); 811 810 btrfs_free_path(path); 812 811 return ret; 813 812 } ··· 952 953 if (!fs_info->quota_root) 953 954 goto out; 954 955 clear_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags); 955 - set_bit(BTRFS_FS_QUOTA_DISABLING, &fs_info->flags); 956 956 btrfs_qgroup_wait_for_completion(fs_info, false); 957 957 spin_lock(&fs_info->qgroup_lock); 958 958 quota_root = fs_info->quota_root; ··· 1305 1307 } 1306 1308 } 1307 1309 ret = del_qgroup_item(trans, quota_root, qgroupid); 1310 + if (ret && ret != -ENOENT) 1311 + goto out; 1308 1312 1309 1313 while (!list_empty(&qgroup->groups)) { 1310 1314 list = list_first_entry(&qgroup->groups, ··· 2086 2086 2087 2087 if (test_and_clear_bit(BTRFS_FS_QUOTA_ENABLING, &fs_info->flags)) 2088 2088 set_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags); 2089 - if (test_and_clear_bit(BTRFS_FS_QUOTA_DISABLING, &fs_info->flags)) 2090 - clear_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags); 2091 2089 2092 2090 spin_lock(&fs_info->qgroup_lock); 2093 2091 while (!list_empty(&fs_info->dirty_qgroups)) {
+1 -1
fs/btrfs/relocation.c
··· 2400 2400 while (!list_empty(list)) { 2401 2401 reloc_root = list_entry(list->next, struct btrfs_root, 2402 2402 root_list); 2403 + __del_reloc_root(reloc_root); 2403 2404 free_extent_buffer(reloc_root->node); 2404 2405 free_extent_buffer(reloc_root->commit_root); 2405 2406 reloc_root->node = NULL; 2406 2407 reloc_root->commit_root = NULL; 2407 - __del_reloc_root(reloc_root); 2408 2408 } 2409 2409 } 2410 2410
+1 -1
fs/btrfs/send.c
··· 2630 2630 } else { 2631 2631 btrfs_warn(sctx->send_root->fs_info, "unexpected inode type %o", 2632 2632 (int)(mode & S_IFMT)); 2633 - ret = -ENOTSUPP; 2633 + ret = -EOPNOTSUPP; 2634 2634 goto out; 2635 2635 } 2636 2636
+10 -2
fs/btrfs/tree-log.c
··· 4181 4181 struct extent_map *em, *n; 4182 4182 struct list_head extents; 4183 4183 struct extent_map_tree *tree = &inode->extent_tree; 4184 + u64 logged_start, logged_end; 4184 4185 u64 test_gen; 4185 4186 int ret = 0; 4186 4187 int num = 0; ··· 4191 4190 down_write(&inode->dio_sem); 4192 4191 write_lock(&tree->lock); 4193 4192 test_gen = root->fs_info->last_trans_committed; 4193 + logged_start = start; 4194 + logged_end = end; 4194 4195 4195 4196 list_for_each_entry_safe(em, n, &tree->modified_extents, list) { 4196 4197 list_del_init(&em->list); 4197 - 4198 4198 /* 4199 4199 * Just an arbitrary number, this can be really CPU intensive 4200 4200 * once we start getting a lot of extents, and really once we ··· 4210 4208 4211 4209 if (em->generation <= test_gen) 4212 4210 continue; 4211 + 4212 + if (em->start < logged_start) 4213 + logged_start = em->start; 4214 + if ((em->start + em->len - 1) > logged_end) 4215 + logged_end = em->start + em->len - 1; 4216 + 4213 4217 /* Need a ref to keep it from getting evicted from cache */ 4214 4218 refcount_inc(&em->refs); 4215 4219 set_bit(EXTENT_FLAG_LOGGING, &em->flags); ··· 4224 4216 } 4225 4217 4226 4218 list_sort(NULL, &extents, extent_cmp); 4227 - btrfs_get_logged_extents(inode, logged_list, start, end); 4219 + btrfs_get_logged_extents(inode, logged_list, logged_start, logged_end); 4228 4220 /* 4229 4221 * Some ordered extents started by fsync might have completed 4230 4222 * before we could collect them into the list logged_list, which
+1 -1
fs/btrfs/volumes.c
··· 6166 6166 map_length = length; 6167 6167 6168 6168 btrfs_bio_counter_inc_blocked(fs_info); 6169 - ret = __btrfs_map_block(fs_info, bio_op(bio), logical, 6169 + ret = __btrfs_map_block(fs_info, btrfs_op(bio), logical, 6170 6170 &map_length, &bbio, mirror_num, 1); 6171 6171 if (ret) { 6172 6172 btrfs_bio_counter_dec(fs_info);