1. 30 11月, 2016 3 次提交
  2. 27 9月, 2016 6 次提交
  3. 26 9月, 2016 1 次提交
  4. 26 7月, 2016 4 次提交
  5. 24 6月, 2016 1 次提交
  6. 18 6月, 2016 2 次提交
    • J
      btrfs: account for non-CoW'd blocks in btrfs_abort_transaction · 64c12921
      Jeff Mahoney 提交于
      The test for !trans->blocks_used in btrfs_abort_transaction is
      insufficient to determine whether it's safe to drop the transaction
      handle on the floor.  btrfs_cow_block, informed by should_cow_block,
      can return blocks that have already been CoW'd in the current
      transaction.  trans->blocks_used is only incremented for new block
      allocations. If an operation overlaps the blocks in the current
      transaction entirely and must abort the transaction, we'll happily
      let it clean up the trans handle even though it may have modified
      the blocks and will commit an incomplete operation.
      
      In the long-term, I'd like to do closer tracking of when the fs
      is actually modified so we can still recover as gracefully as possible,
      but that approach will need some discussion.  In the short term,
      since this is the only code using trans->blocks_used, let's just
      switch it to a bool indicating whether any blocks were used and set
      it when should_cow_block returns false.
      
      Cc: stable@vger.kernel.org # 3.4+
      Signed-off-by: NJeff Mahoney <jeffm@suse.com>
      Reviewed-by: NFilipe Manana <fdmanana@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      64c12921
    • L
      Btrfs: check if extent buffer is aligned to sectorsize · c871b0f2
      Liu Bo 提交于
      Thanks to fuzz testing, we can pass an invalid bytenr to extent buffer
      via alloc_extent_buffer().  An unaligned eb can have more pages than it
      should have, which ends up extent buffer's leak or some corrupted content
      in extent buffer.
      
      This adds a warning to let us quickly know what was happening.
      
      Now that alloc_extent_buffer() no more returns NULL, this changes its
      caller and callers of its caller to match with the new error
      handling.
      Signed-off-by: NLiu Bo <bo.li.liu@oracle.com>
      Reviewed-by: NDavid Sterba <dsterba@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      c871b0f2
  7. 03 6月, 2016 1 次提交
  8. 26 5月, 2016 1 次提交
  9. 28 4月, 2016 1 次提交
  10. 04 4月, 2016 1 次提交
  11. 11 2月, 2016 1 次提交
  12. 02 2月, 2016 1 次提交
  13. 07 1月, 2016 2 次提交
  14. 22 10月, 2015 1 次提交
  15. 29 9月, 2015 1 次提交
  16. 09 8月, 2015 1 次提交
    • Z
      btrfs: abort transaction on btrfs_reloc_cow_block() · 93314e3b
      Zhaolei 提交于
      When btrfs_reloc_cow_block() failed in __btrfs_cow_block(), current
      code just return a err-value to caller, but leave new_created extent
      buffer exist and locked.
      
      Then subsequent code (in relocate) try to lock above eb again,
      and caused deadlock without any dmesg.
      (eb lock use wait_event(), so no lockdep message)
      
      It is hard to do recover work in __btrfs_cow_block() at this error
      point, but we can abort transaction to avoid deadlock and operate on
      unstable state.a
      
      It also helps developer to find wrong place quickly.
      (better than a frozen fs without any dmesg before patch)
      Signed-off-by: NZhao Lei <zhaolei@cn.fujitsu.com>
      Signed-off-by: NChris Mason <clm@fb.com>
      93314e3b
  17. 03 6月, 2015 1 次提交
  18. 04 3月, 2015 1 次提交
  19. 03 3月, 2015 1 次提交
    • F
      Btrfs: fix off-by-one logic error in btrfs_realloc_node · 5dfe2be7
      Filipe Manana 提交于
      The end_slot variable actually matches the number of pointers in the
      node and not the last slot (which is 'nritems - 1'). Therefore in order
      to check that the current slot in the for loop doesn't match the last
      one, the correct logic is to check if 'i' is less than 'end_slot - 1'
      and not 'end_slot - 2'.
      
      Fix this and set end_slot to be 'nritems - 1', as it's less confusing
      since the variable name implies it's inclusive rather then exclusive.
      Signed-off-by: NFilipe Manana <fdmanana@suse.com>
      Signed-off-by: NChris Mason <clm@fb.com>
      5dfe2be7
  20. 17 2月, 2015 2 次提交
    • D
      Btrfs: disk-io: replace root args iff only fs_info used · 01d58472
      Daniel Dressler 提交于
      This is the 3rd independent patch of a larger project to cleanup btrfs's
      internal usage of btrfs_root. Many functions take btrfs_root only to
      grab the fs_info struct.
      
      By requiring a root these functions cause programmer overhead. That
      these functions can accept any valid root is not obvious until
      inspection.
      
      This patch reduces the specificity of such functions to accept the
      fs_info directly.
      
      These patches can be applied independently and thus are not being
      submitted as a patch series. There should be about 26 patches by the
      project's completion. Each patch will cleanup between 1 and 34 functions
      apiece.  Each patch covers a single file's functions.
      
      This patch affects the following function(s):
        1) csum_tree_block
        2) csum_dirty_buffer
        3) check_tree_block_fsid
        4) btrfs_find_tree_block
        5) clean_tree_block
      Signed-off-by: NDaniel Dressler <danieru.dressler@gmail.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.cz>
      01d58472
    • D
      Btrfs: ctree: reduce args where only fs_info used · b7a0365e
      Daniel Dressler 提交于
      This patch is part of a larger project to cleanup btrfs's internal usage
      of struct btrfs_root. Many functions take btrfs_root only to grab a
      pointer to fs_info.
      
      This causes programmers to ponder which root can be passed. Since only
      the fs_info is read affected functions can accept any root, except this
      is only obvious upon inspection.
      
      This patch reduces the specificty of such functions to accept the
      fs_info directly.
      
      This patch does not address the two functions in ctree.c (insert_ptr,
      and split_item) which only use root for BUG_ONs in ctree.c
      
      This patch affects the following functions:
        1) fixup_low_keys
        2) btrfs_set_item_key_safe
      Signed-off-by: NDaniel Dressler <danieru.dressler@gmail.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.cz>
      b7a0365e
  21. 22 1月, 2015 3 次提交
    • C
      Btrfs: insert_new_root: Fix lock type of the extent buffer. · 95449a16
      chandan 提交于
      btrfs_alloc_tree_block() returns an extent buffer on which a blocked lock has
      been taken. Hence assign the appropriate value to path->locks[level].
      Signed-off-by: NChandan Rajendra <chandan@linux.vnet.ibm.com>
      Signed-off-by: NChris Mason <clm@fb.com>
      95449a16
    • F
      Btrfs: fix setup_leaf_for_split() to avoid leaf corruption · a8df6fe6
      Filipe Manana 提交于
      We were incorrectly detecting when the target key didn't exist anymore
      after releasing the path and re-searching the tree. This could make
      us split or duplicate (btrfs_split_item() and btrfs_duplicate_item()
      are its only callers at the moment) an item when we should not.
      
      For the case of duplicating an item, we currently only duplicate
      checksum items (csum tree) and file extent items (fs/subvol trees).
      For the checksum items we end up overriding the item completely,
      but for file extent items we update only some of their fields in
      the copy (done in __btrfs_drop_extents), which means we can end up
      having a logical corruption for some values.
      
      Also for the case where we duplicate a file extent item it will make
      us produce a leaf with a wrong key order, as btrfs_duplicate_item()
      advances us to the next slot and then its caller sets a smaller key
      on the new item at that slot (like in __btrfs_drop_extents() e.g.).
      Alternatively if the tree search in setup_leaf_for_split() leaves
      with path->slots[0] == btrfs_header_nritems(path->nodes[0]), we end
      up accessing beyond the leaf's end (when we check if the item's size
      has changed) and make our caller insert an item at the invalid slot
      btrfs_header_nritems(path->nodes[0]) + 1, causing an invalid memory
      access if the leaf is full or nearly full.
      
      This issue has been present since the introduction of this function
      in 2009:
      
          Btrfs: Add btrfs_duplicate_item
          commit ad48fd75Signed-off-by: NFilipe Manana <fdmanana@suse.com>
      Signed-off-by: NChris Mason <clm@fb.com>
      a8df6fe6
    • J
      Btrfs: change how we track dirty roots · e7070be1
      Josef Bacik 提交于
      I've been overloading root->dirty_list to keep track of dirty roots and which
      roots need to have their commit roots switched at transaction commit time.  This
      could cause us to lose an update to the root which could corrupt the file
      system.  To fix this use a state bit to know if the root is dirty, and if it
      isn't set we go ahead and move the root to the dirty list.  This way if we
      re-dirty the root after adding it to the switch_commit list we make sure to
      update it.  This also makes it so that the extent root is always the last root
      on the dirty list to try and keep the amount of churn down at this point in the
      commit.  Thanks,
      Signed-off-by: NJosef Bacik <jbacik@fb.com>
      Signed-off-by: NChris Mason <clm@fb.com>
      e7070be1
  22. 15 1月, 2015 2 次提交
  23. 13 12月, 2014 2 次提交