Merge branch 'for-linus-4.7' of git://git.kernel.org/pub/scm/linux/kernel/git/mason...
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 18 Jun 2016 15:57:59 +0000 (05:57 -1000)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 18 Jun 2016 15:57:59 +0000 (05:57 -1000)
Pull btrfs fixes from Chris Mason:
 "The most user visible change here is a fix for our recent superblock
  validation checks that were causing problems on non-4k pagesized
  systems"

* 'for-linus-4.7' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
  Btrfs: btrfs_check_super_valid: Allow 4096 as stripesize
  btrfs: remove build fixup for qgroup_account_snapshot
  btrfs: use new error message helper in qgroup_account_snapshot
  btrfs: avoid blocking open_ctree from cleaner_kthread
  Btrfs: don't BUG_ON() in btrfs_orphan_add
  btrfs: account for non-CoW'd blocks in btrfs_abort_transaction
  Btrfs: check if extent buffer is aligned to sectorsize
  btrfs: Use correct format specifier

1  2 
fs/btrfs/inode.c
fs/btrfs/tree-log.c
fs/btrfs/volumes.c

diff --combined fs/btrfs/inode.c
index 8b1212e8f7a8b65ddd96a38e7d57d534fdf75aff,bb62418b80232d0d4381ffea5d8555d06a3b973c..d2be95cfb6d156f4323cd33733e51c20533fcb11
@@@ -3271,7 -3271,16 +3271,16 @@@ int btrfs_orphan_add(struct btrfs_trans
        /* grab metadata reservation from transaction handle */
        if (reserve) {
                ret = btrfs_orphan_reserve_metadata(trans, inode);
-               BUG_ON(ret); /* -ENOSPC in reservation; Logic error? JDM */
+               ASSERT(!ret);
+               if (ret) {
+                       atomic_dec(&root->orphan_inodes);
+                       clear_bit(BTRFS_INODE_ORPHAN_META_RESERVED,
+                                 &BTRFS_I(inode)->runtime_flags);
+                       if (insert)
+                               clear_bit(BTRFS_INODE_HAS_ORPHAN_ITEM,
+                                         &BTRFS_I(inode)->runtime_flags);
+                       return ret;
+               }
        }
  
        /* insert an orphan item to track this unlinked/truncated file */
        return retval;
  }
  
 -static ssize_t btrfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter,
 -                             loff_t offset)
 +static ssize_t btrfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
  {
        struct file *file = iocb->ki_filp;
        struct inode *inode = file->f_mapping->host;
        struct btrfs_root *root = BTRFS_I(inode)->root;
        struct btrfs_dio_data dio_data = { 0 };
 +      loff_t offset = iocb->ki_pos;
        size_t count = 0;
        int flags = 0;
        bool wakeup = true;
  
        ret = __blockdev_direct_IO(iocb, inode,
                                   BTRFS_I(inode)->root->fs_info->fs_devices->latest_bdev,
 -                                 iter, offset, btrfs_get_blocks_direct, NULL,
 +                                 iter, btrfs_get_blocks_direct, NULL,
                                   btrfs_submit_direct, flags);
        if (iov_iter_rw(iter) == WRITE) {
                current->journal_info = NULL;
@@@ -10504,10 -10513,10 +10513,10 @@@ static const struct inode_operations bt
        .symlink        = btrfs_symlink,
        .setattr        = btrfs_setattr,
        .mknod          = btrfs_mknod,
 -      .setxattr       = btrfs_setxattr,
 +      .setxattr       = generic_setxattr,
        .getxattr       = generic_getxattr,
        .listxattr      = btrfs_listxattr,
 -      .removexattr    = btrfs_removexattr,
 +      .removexattr    = generic_removexattr,
        .permission     = btrfs_permission,
        .get_acl        = btrfs_get_acl,
        .set_acl        = btrfs_set_acl,
@@@ -10581,10 -10590,10 +10590,10 @@@ static const struct address_space_opera
  static const struct inode_operations btrfs_file_inode_operations = {
        .getattr        = btrfs_getattr,
        .setattr        = btrfs_setattr,
 -      .setxattr       = btrfs_setxattr,
 +      .setxattr       = generic_setxattr,
        .getxattr       = generic_getxattr,
        .listxattr      = btrfs_listxattr,
 -      .removexattr    = btrfs_removexattr,
 +      .removexattr    = generic_removexattr,
        .permission     = btrfs_permission,
        .fiemap         = btrfs_fiemap,
        .get_acl        = btrfs_get_acl,
@@@ -10595,10 -10604,10 +10604,10 @@@ static const struct inode_operations bt
        .getattr        = btrfs_getattr,
        .setattr        = btrfs_setattr,
        .permission     = btrfs_permission,
 -      .setxattr       = btrfs_setxattr,
 +      .setxattr       = generic_setxattr,
        .getxattr       = generic_getxattr,
        .listxattr      = btrfs_listxattr,
 -      .removexattr    = btrfs_removexattr,
 +      .removexattr    = generic_removexattr,
        .get_acl        = btrfs_get_acl,
        .set_acl        = btrfs_set_acl,
        .update_time    = btrfs_update_time,
@@@ -10609,10 -10618,10 +10618,10 @@@ static const struct inode_operations bt
        .getattr        = btrfs_getattr,
        .setattr        = btrfs_setattr,
        .permission     = btrfs_permission,
 -      .setxattr       = btrfs_setxattr,
 +      .setxattr       = generic_setxattr,
        .getxattr       = generic_getxattr,
        .listxattr      = btrfs_listxattr,
 -      .removexattr    = btrfs_removexattr,
 +      .removexattr    = generic_removexattr,
        .update_time    = btrfs_update_time,
  };
  
diff --combined fs/btrfs/tree-log.c
index b7665af471d88510d391c4ffc8bcbb65e506bd50,8ab1dc64cbba3cf5b42459e92b7ddd16e98eaa60..c05f69a8ec42dad19269620e0ec7e8b38f91ca25
@@@ -2422,8 -2422,8 +2422,8 @@@ static noinline int walk_down_log_tree(
                root_owner = btrfs_header_owner(parent);
  
                next = btrfs_find_create_tree_block(root, bytenr);
-               if (!next)
-                       return -ENOMEM;
+               if (IS_ERR(next))
+                       return PTR_ERR(next);
  
                if (*level == 1) {
                        ret = wc->process_func(root, next, wc, ptr_gen);
@@@ -4965,7 -4965,7 +4965,7 @@@ static noinline int check_parent_dirs_f
                        goto out;
  
        if (!S_ISDIR(inode->i_mode)) {
 -              if (!parent || d_really_is_negative(parent) || sb != d_inode(parent)->i_sb)
 +              if (!parent || d_really_is_negative(parent) || sb != parent->d_sb)
                        goto out;
                inode = d_inode(parent);
        }
                        break;
                }
  
 -              if (!parent || d_really_is_negative(parent) || sb != d_inode(parent)->i_sb)
 +              if (!parent || d_really_is_negative(parent) || sb != parent->d_sb)
                        break;
  
                if (IS_ROOT(parent))
@@@ -5404,7 -5404,7 +5404,7 @@@ static int btrfs_log_inode_parent(struc
        }
  
        while (1) {
 -              if (!parent || d_really_is_negative(parent) || sb != d_inode(parent)->i_sb)
 +              if (!parent || d_really_is_negative(parent) || sb != parent->d_sb)
                        break;
  
                inode = d_inode(parent);
diff --combined fs/btrfs/volumes.c
index 548faaa9e1693d8cad721dcb02c589f5e2f811a5,c3a2900c6030983239871b7088bb429134ab6244..2f631b58ae004c81ba28a8a4598e1fa8bfda87f8
  #include <linux/slab.h>
  #include <linux/buffer_head.h>
  #include <linux/blkdev.h>
 -#include <linux/random.h>
  #include <linux/iocontext.h>
  #include <linux/capability.h>
  #include <linux/ratelimit.h>
  #include <linux/kthread.h>
  #include <linux/raid/pq.h>
  #include <linux/semaphore.h>
 +#include <linux/uuid.h>
  #include <asm/div64.h>
  #include "ctree.h"
  #include "extent_map.h"
@@@ -6607,8 -6607,8 +6607,8 @@@ int btrfs_read_sys_array(struct btrfs_r
         * overallocate but we can keep it as-is, only the first page is used.
         */
        sb = btrfs_find_create_tree_block(root, BTRFS_SUPER_INFO_OFFSET);
-       if (!sb)
-               return -ENOMEM;
+       if (IS_ERR(sb))
+               return PTR_ERR(sb);
        set_extent_buffer_uptodate(sb);
        btrfs_set_buffer_lockdep_class(root->root_key.objectid, sb, 0);
        /*
This page took 0.065771 seconds and 5 git commands to generate.