]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Merge branch 'for-linus-4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/mason...
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 10 Jun 2017 18:06:05 +0000 (11:06 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 10 Jun 2017 18:06:05 +0000 (11:06 -0700)
Pull btrfs fixes from Chris Mason:
 "Some fixes that Dave Sterba collected.

  We've been hitting an early enospc problem on production machines that
  Omar tracked down to an old int->u64 mistake. I waited a bit on this
  pull to make sure it was really the problem from production, but it's
  on ~2100 hosts now and I think we're good.

  Omar also noticed a commit in the queue would make new early ENOSPC
  problems. I pulled that out for now, which is why the top three
  commits are younger than the rest.

  Otherwise these are all fixes, some explaining very old bugs that
  we've been poking at for a while"

* 'for-linus-4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
  Btrfs: fix delalloc accounting leak caused by u32 overflow
  Btrfs: clear EXTENT_DEFRAG bits in finish_ordered_io
  btrfs: tree-log.c: Wrong printk information about namelen
  btrfs: fix race with relocation recovery and fs_root setup
  btrfs: fix memory leak in update_space_info failure path
  btrfs: use correct types for page indices in btrfs_page_exists_in_range
  btrfs: fix incorrect error return ret being passed to mapping_set_error
  btrfs: Make flush bios explicitely sync
  btrfs: fiemap: Cache and merge fiemap extent before submit it to user

1  2 
fs/btrfs/ctree.h
fs/btrfs/disk-io.c

diff --combined fs/btrfs/ctree.h
index 643c70d2b2e65ab96a93ff4c022756ea7e59d179,43a8c42cdf072b21da896f8ddfcddd95b9d06ae7..4f8f75d9e83916c059902196ecab2aa6bbdf4b4d
@@@ -829,6 -829,7 +829,6 @@@ struct btrfs_fs_info 
        struct btrfs_super_block *super_for_commit;
        struct super_block *sb;
        struct inode *btree_inode;
 -      struct backing_dev_info bdi;
        struct mutex tree_log_mutex;
        struct mutex transaction_kthread_mutex;
        struct mutex cleaner_mutex;
@@@ -2563,7 -2564,7 +2563,7 @@@ u64 btrfs_csum_bytes_to_leaves(struct b
  static inline u64 btrfs_calc_trans_metadata_size(struct btrfs_fs_info *fs_info,
                                                 unsigned num_items)
  {
-       return fs_info->nodesize * BTRFS_MAX_LEVEL * 2 * num_items;
+       return (u64)fs_info->nodesize * BTRFS_MAX_LEVEL * 2 * num_items;
  }
  
  /*
  static inline u64 btrfs_calc_trunc_metadata_size(struct btrfs_fs_info *fs_info,
                                                 unsigned num_items)
  {
-       return fs_info->nodesize * BTRFS_MAX_LEVEL * num_items;
+       return (u64)fs_info->nodesize * BTRFS_MAX_LEVEL * num_items;
  }
  
  int btrfs_should_throttle_delayed_refs(struct btrfs_trans_handle *trans,
diff --combined fs/btrfs/disk-io.c
index 8685d67185d01bf90bcd2cf6d7cdd168e044c777,b3579d11fb26d15c20372182218263462b8dcb01..5f678dcb20e634d936c56f6bdcba0c86b624c21b
@@@ -1808,6 -1808,21 +1808,6 @@@ static int btrfs_congested_fn(void *con
        return ret;
  }
  
 -static int setup_bdi(struct btrfs_fs_info *info, struct backing_dev_info *bdi)
 -{
 -      int err;
 -
 -      err = bdi_setup_and_register(bdi, "btrfs");
 -      if (err)
 -              return err;
 -
 -      bdi->ra_pages = VM_MAX_READAHEAD * 1024 / PAGE_SIZE;
 -      bdi->congested_fn       = btrfs_congested_fn;
 -      bdi->congested_data     = info;
 -      bdi->capabilities |= BDI_CAP_CGROUP_WRITEBACK;
 -      return 0;
 -}
 -
  /*
   * called by the kthread helper functions to finally call the bio end_io
   * functions.  This is where read checksum verification actually happens
@@@ -2586,10 -2601,16 +2586,10 @@@ int open_ctree(struct super_block *sb
                goto fail;
        }
  
 -      ret = setup_bdi(fs_info, &fs_info->bdi);
 -      if (ret) {
 -              err = ret;
 -              goto fail_srcu;
 -      }
 -
        ret = percpu_counter_init(&fs_info->dirty_metadata_bytes, 0, GFP_KERNEL);
        if (ret) {
                err = ret;
 -              goto fail_bdi;
 +              goto fail_srcu;
        }
        fs_info->dirty_metadata_batch = PAGE_SIZE *
                                        (1 + ilog2(nr_cpu_ids));
  
        sb->s_blocksize = 4096;
        sb->s_blocksize_bits = blksize_bits(4096);
 -      sb->s_bdi = &fs_info->bdi;
  
        btrfs_init_btree_inode(fs_info);
  
                goto fail_sb_buffer;
        }
  
 -      fs_info->bdi.ra_pages *= btrfs_super_num_devices(disk_super);
 -      fs_info->bdi.ra_pages = max(fs_info->bdi.ra_pages,
 -                                  SZ_4M / PAGE_SIZE);
 +      sb->s_bdi->congested_fn = btrfs_congested_fn;
 +      sb->s_bdi->congested_data = fs_info;
 +      sb->s_bdi->capabilities |= BDI_CAP_CGROUP_WRITEBACK;
 +      sb->s_bdi->ra_pages = VM_MAX_READAHEAD * 1024 / PAGE_SIZE;
 +      sb->s_bdi->ra_pages *= btrfs_super_num_devices(disk_super);
 +      sb->s_bdi->ra_pages = max(sb->s_bdi->ra_pages, SZ_4M / PAGE_SIZE);
  
        sb->s_blocksize = sectorsize;
        sb->s_blocksize_bits = blksize_bits(sectorsize);
@@@ -3266,6 -3285,8 +3266,6 @@@ fail_delalloc_bytes
        percpu_counter_destroy(&fs_info->delalloc_bytes);
  fail_dirty_metadata_bytes:
        percpu_counter_destroy(&fs_info->dirty_metadata_bytes);
 -fail_bdi:
 -      bdi_destroy(&fs_info->bdi);
  fail_srcu:
        cleanup_srcu_struct(&fs_info->subvol_srcu);
  fail:
@@@ -3467,10 -3488,12 +3467,12 @@@ static int write_dev_supers(struct btrf
                 * we fua the first super.  The others we allow
                 * to go down lazy.
                 */
-               if (i == 0)
-                       ret = btrfsic_submit_bh(REQ_OP_WRITE, REQ_FUA, bh);
-               else
+               if (i == 0) {
+                       ret = btrfsic_submit_bh(REQ_OP_WRITE,
+                                               REQ_SYNC | REQ_FUA, bh);
+               } else {
                        ret = btrfsic_submit_bh(REQ_OP_WRITE, REQ_SYNC, bh);
+               }
                if (ret)
                        errors++;
        }
@@@ -3535,7 -3558,7 +3537,7 @@@ static int write_dev_flush(struct btrfs
  
        bio->bi_end_io = btrfs_end_empty_barrier;
        bio->bi_bdev = device->bdev;
-       bio->bi_opf = REQ_OP_WRITE | REQ_PREFLUSH;
+       bio->bi_opf = REQ_OP_WRITE | REQ_SYNC | REQ_PREFLUSH;
        init_completion(&device->flush_wait);
        bio->bi_private = &device->flush_wait;
        device->flush_bio = bio;
@@@ -3987,6 -4010,7 +3989,6 @@@ void close_ctree(struct btrfs_fs_info *
        percpu_counter_destroy(&fs_info->dirty_metadata_bytes);
        percpu_counter_destroy(&fs_info->delalloc_bytes);
        percpu_counter_destroy(&fs_info->bio_counter);
 -      bdi_destroy(&fs_info->bdi);
        cleanup_srcu_struct(&fs_info->subvol_srcu);
  
        btrfs_free_stripe_hash_table(fs_info);