1. 27 10月, 2015 1 次提交
    • Q
      btrfs: qgroup: Don't copy extent buffer to do qgroup rescan · 0a0e8b89
      Qu Wenruo 提交于
      Ancient qgroup code call memcpy() on a extent buffer and use it for leaf
      iteration.
      
      As extent buffer contains lock, pointers to pages, it's never sane to do
      such copy.
      
      The following bug may be caused by this insane operation:
      [92098.841309] general protection fault: 0000 [#1] SMP
      [92098.841338] Modules linked in: ...
      [92098.841814] CPU: 1 PID: 24655 Comm: kworker/u4:12 Not tainted
      4.3.0-rc1 #1
      [92098.841868] Workqueue: btrfs-qgroup-rescan btrfs_qgroup_rescan_helper
      [btrfs]
      [92098.842261] Call Trace:
      [92098.842277]  [<ffffffffc035a5d8>] ? read_extent_buffer+0xb8/0x110
      [btrfs]
      [92098.842304]  [<ffffffffc0396d00>] ? btrfs_find_all_roots+0x60/0x70
      [btrfs]
      [92098.842329]  [<ffffffffc039af3d>]
      btrfs_qgroup_rescan_worker+0x28d/0x5a0 [btrfs]
      
      Where btrfs_qgroup_rescan_worker+0x28d is btrfs_disk_key_to_cpu(),
      called in reading key from the copied extent_buffer.
      
      This patch will use btrfs_clone_extent_buffer() to a better copy of
      extent buffer to deal such case.
      Reported-by: NStephane Lesimple <stephane_btrfs@lesimple.fr>
      Suggested-by: NFilipe Manana <fdmanana@kernel.org>
      Signed-off-by: NQu Wenruo <quwenruo@cn.fujitsu.com>
      Reviewed-by: NFilipe Manana <fdmanana@suse.com>
      Signed-off-by: NChris Mason <clm@fb.com>
      0a0e8b89
  2. 22 10月, 2015 7 次提交
  3. 07 8月, 2015 2 次提交
  4. 01 7月, 2015 1 次提交
  5. 11 6月, 2015 10 次提交
  6. 03 6月, 2015 1 次提交
  7. 13 4月, 2015 15 次提交
  8. 27 3月, 2015 1 次提交
    • F
      Btrfs: change the insertion criteria for the qgroup operations rbtree · bf691960
      Filipe Manana 提交于
      After looking at Liu Bo's recent patch (titled
      "Btrfs: fix comp_oper to get right order") I realized the search made by
      qgroup_oper_exists() was buggy because its rbtree navigation comparison
      function, comp_oper_exist(), only looks at the fields bytenr and ref_root
      of a tree node, ignoring the seq field completely. This was wrong because
      when we insert a node into the rbtree we use comp_oper(), which takes a
      decision based first on bytenr, then on seq and then on the ref_root field.
      That means qgroup_oper_exists() could miss the fact that at least one
      operation with given bytenr and ref_root exists.
      
      Consider the following simple example of a 3 nodes qgroup operations
      rbtree (created using comp_oper before this patch), where each node's key
      is a tuple with the shape (bytenr, seq, ref_root, op):
      
                                [ (4096, 2, 20, op X) ]
                               /                       \
                              /                         \
         [ (4096, 1, 5, op Y) ]                         [ (4096, 3, 10, op Z) ]
      
      qgroup_oper_exists() when called to search for an existing operation for
      bytenr 4096 and ref root 10 wouldn't find anything because it would go to
      the left subtree instead of the right subtree, since comp_oper_exits()
      ignores the seq field completely.
      
      Fix this by changing the insertion navigation function to use the ref_root
      field right after using the bytenr field and before using the seq field,
      so that qgroup_oper_exists() / comp_oper_exist() work as expected.
      
      This patch applies on top of the patch mentioned above from Liu.
      Signed-off-by: NFilipe Manana <fdmanana@suse.com>
      Signed-off-by: NChris Mason <clm@fb.com>
      bf691960
  9. 14 3月, 2015 1 次提交
  10. 04 3月, 2015 1 次提交