Merge branch 'for-linus-4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/mason...
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 1 Apr 2016 23:08:34 +0000 (18:08 -0500)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 1 Apr 2016 23:08:34 +0000 (18:08 -0500)
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

1  2 
fs/btrfs/disk-io.c

diff --combined fs/btrfs/disk-io.c
index 4b02591b030106a58b2aba74eb1596693e0c944e,f6705252b5b2ea44b4aaf4d451692594b0904dcd..d01f89d130e029dd31f9a2bba6d50a9ca1f1b7cd
@@@ -25,7 -25,6 +25,6 @@@
  #include <linux/buffer_head.h>
  #include <linux/workqueue.h>
  #include <linux/kthread.h>
- #include <linux/freezer.h>
  #include <linux/slab.h>
  #include <linux/migrate.h>
  #include <linux/ratelimit.h>
@@@ -303,7 -302,7 +302,7 @@@ static int csum_tree_block(struct btrfs
                err = map_private_extent_buffer(buf, offset, 32,
                                        &kaddr, &map_start, &map_len);
                if (err)
-                       return 1;
+                       return err;
                cur_len = min(len, map_len - (offset - map_start));
                crc = btrfs_csum_data(kaddr + offset - map_start,
                                      crc, cur_len);
        if (csum_size > sizeof(inline_result)) {
                result = kzalloc(csum_size, GFP_NOFS);
                if (!result)
-                       return 1;
+                       return -ENOMEM;
        } else {
                result = (char *)&inline_result;
        }
                                val, found, btrfs_header_level(buf));
                        if (result != (char *)&inline_result)
                                kfree(result);
-                       return 1;
+                       return -EUCLEAN;
                }
        } else {
                write_extent_buffer(buf, result, 0, csum_size);
@@@ -513,11 -512,21 +512,21 @@@ static int csum_dirty_buffer(struct btr
        eb = (struct extent_buffer *)page->private;
        if (page != eb->pages[0])
                return 0;
        found_start = btrfs_header_bytenr(eb);
-       if (WARN_ON(found_start != start || !PageUptodate(page)))
-               return 0;
-       csum_tree_block(fs_info, eb, 0);
-       return 0;
+       /*
+        * Please do not consolidate these warnings into a single if.
+        * It is useful to know what went wrong.
+        */
+       if (WARN_ON(found_start != start))
+               return -EUCLEAN;
+       if (WARN_ON(!PageUptodate(page)))
+               return -EUCLEAN;
+       ASSERT(memcmp_extent_buffer(eb, fs_info->fsid,
+                       btrfs_header_fsid(), BTRFS_FSID_SIZE) == 0);
+       return csum_tree_block(fs_info, eb, 0);
  }
  
  static int check_tree_block_fsid(struct btrfs_fs_info *fs_info,
@@@ -661,10 -670,8 +670,8 @@@ static int btree_readpage_end_io_hook(s
                                       eb, found_level);
  
        ret = csum_tree_block(fs_info, eb, 1);
-       if (ret) {
-               ret = -EIO;
+       if (ret)
                goto err;
-       }
  
        /*
         * If this is a leaf block and it is corrupt, set the corrupt bit so
@@@ -931,7 -938,7 +938,7 @@@ static int check_async_write(struct ino
        if (bio_flags & EXTENT_BIO_TREE_LOG)
                return 0;
  #ifdef CONFIG_X86
 -      if (static_cpu_has_safe(X86_FEATURE_XMM4_2))
 +      if (static_cpu_has(X86_FEATURE_XMM4_2))
                return 0;
  #endif
        return 1;
@@@ -1831,7 -1838,7 +1838,7 @@@ static int cleaner_kthread(void *arg
                 */
                btrfs_delete_unused_bgs(root->fs_info);
  sleep:
-               if (!try_to_freeze() && !again) {
+               if (!again) {
                        set_current_state(TASK_INTERRUPTIBLE);
                        if (!kthread_should_stop())
                                schedule();
@@@ -1921,14 -1928,12 +1928,12 @@@ sleep
                if (unlikely(test_bit(BTRFS_FS_STATE_ERROR,
                                      &root->fs_info->fs_state)))
                        btrfs_cleanup_transaction(root);
-               if (!try_to_freeze()) {
-                       set_current_state(TASK_INTERRUPTIBLE);
-                       if (!kthread_should_stop() &&
-                           (!btrfs_transaction_blocked(root->fs_info) ||
-                            cannot_commit))
-                               schedule_timeout(delay);
-                       __set_current_state(TASK_RUNNING);
-               }
+               set_current_state(TASK_INTERRUPTIBLE);
+               if (!kthread_should_stop() &&
+                               (!btrfs_transaction_blocked(root->fs_info) ||
+                                cannot_commit))
+                       schedule_timeout(delay);
+               __set_current_state(TASK_RUNNING);
        } while (!kthread_should_stop());
        return 0;
  }
This page took 0.030334 seconds and 5 git commands to generate.