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-linus-4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs

Pull btrfs fixes from Chris Mason:
"This has a few fixes Dave Sterba had queued up. These are all pretty
small, but since they were tested I decided against waiting for more"

* 'for-linus-4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
btrfs: transaction_kthread() is not freezable
btrfs: cleaner_kthread() doesn't need explicit freeze
btrfs: do not write corrupted metadata blocks to disk
btrfs: csum_tree_block: return proper errno value

+25 -20
+25 -20
fs/btrfs/disk-io.c
··· 25 25 #include <linux/buffer_head.h> 26 26 #include <linux/workqueue.h> 27 27 #include <linux/kthread.h> 28 - #include <linux/freezer.h> 29 28 #include <linux/slab.h> 30 29 #include <linux/migrate.h> 31 30 #include <linux/ratelimit.h> ··· 302 303 err = map_private_extent_buffer(buf, offset, 32, 303 304 &kaddr, &map_start, &map_len); 304 305 if (err) 305 - return 1; 306 + return err; 306 307 cur_len = min(len, map_len - (offset - map_start)); 307 308 crc = btrfs_csum_data(kaddr + offset - map_start, 308 309 crc, cur_len); ··· 312 313 if (csum_size > sizeof(inline_result)) { 313 314 result = kzalloc(csum_size, GFP_NOFS); 314 315 if (!result) 315 - return 1; 316 + return -ENOMEM; 316 317 } else { 317 318 result = (char *)&inline_result; 318 319 } ··· 333 334 val, found, btrfs_header_level(buf)); 334 335 if (result != (char *)&inline_result) 335 336 kfree(result); 336 - return 1; 337 + return -EUCLEAN; 337 338 } 338 339 } else { 339 340 write_extent_buffer(buf, result, 0, csum_size); ··· 512 513 eb = (struct extent_buffer *)page->private; 513 514 if (page != eb->pages[0]) 514 515 return 0; 516 + 515 517 found_start = btrfs_header_bytenr(eb); 516 - if (WARN_ON(found_start != start || !PageUptodate(page))) 517 - return 0; 518 - csum_tree_block(fs_info, eb, 0); 519 - return 0; 518 + /* 519 + * Please do not consolidate these warnings into a single if. 520 + * It is useful to know what went wrong. 521 + */ 522 + if (WARN_ON(found_start != start)) 523 + return -EUCLEAN; 524 + if (WARN_ON(!PageUptodate(page))) 525 + return -EUCLEAN; 526 + 527 + ASSERT(memcmp_extent_buffer(eb, fs_info->fsid, 528 + btrfs_header_fsid(), BTRFS_FSID_SIZE) == 0); 529 + 530 + return csum_tree_block(fs_info, eb, 0); 520 531 } 521 532 522 533 static int check_tree_block_fsid(struct btrfs_fs_info *fs_info, ··· 670 661 eb, found_level); 671 662 672 663 ret = csum_tree_block(fs_info, eb, 1); 673 - if (ret) { 674 - ret = -EIO; 664 + if (ret) 675 665 goto err; 676 - } 677 666 678 667 /* 679 668 * If this is a leaf block and it is corrupt, set the corrupt bit so ··· 1838 1831 */ 1839 1832 btrfs_delete_unused_bgs(root->fs_info); 1840 1833 sleep: 1841 - if (!try_to_freeze() && !again) { 1834 + if (!again) { 1842 1835 set_current_state(TASK_INTERRUPTIBLE); 1843 1836 if (!kthread_should_stop()) 1844 1837 schedule(); ··· 1928 1921 if (unlikely(test_bit(BTRFS_FS_STATE_ERROR, 1929 1922 &root->fs_info->fs_state))) 1930 1923 btrfs_cleanup_transaction(root); 1931 - if (!try_to_freeze()) { 1932 - set_current_state(TASK_INTERRUPTIBLE); 1933 - if (!kthread_should_stop() && 1934 - (!btrfs_transaction_blocked(root->fs_info) || 1935 - cannot_commit)) 1936 - schedule_timeout(delay); 1937 - __set_current_state(TASK_RUNNING); 1938 - } 1924 + set_current_state(TASK_INTERRUPTIBLE); 1925 + if (!kthread_should_stop() && 1926 + (!btrfs_transaction_blocked(root->fs_info) || 1927 + cannot_commit)) 1928 + schedule_timeout(delay); 1929 + __set_current_state(TASK_RUNNING); 1939 1930 } while (!kthread_should_stop()); 1940 1931 return 0; 1941 1932 }