03 Jan, 2015

1 commit

  • If we are using skinny metadata, the block's tree level is in the offset
    of the key and not in a btrfs_tree_block_info structure following the
    extent item (it doesn't exist). Therefore fix it.

    Besides returning the correct level in the tree, this also prevents reading
    past the leaf's end in the case where the extent item is the last item in
    the leaf (eb) and it has only 1 inline reference - this is because
    sizeof(struct btrfs_tree_block_info) is greater than
    sizeof(struct btrfs_extent_inline_ref).

    Got it while running a scrub which produced the following warning:

    BTRFS: checksum error at logical 42123264 on dev /dev/sde, sector 15840: metadata node (level 24) in tree 5

    Signed-off-by: Filipe Manana
    Reviewed-by: Satoru Takeuchi
    Signed-off-by: Chris Mason

    Filipe Manana
     

02 Oct, 2014

1 commit


18 Sep, 2014

3 commits

  • We have been iterating all references for each extent we have in a file when we
    do fiemap to see if it is shared. This is fine when you have a few clones or a
    few snapshots, but when you have 5k snapshots suddenly fiemap just sits there
    and stares at you. So add btrfs_check_shared which will use the backref walking
    code but will short circuit as soon as it finds a root or inode that doesn't
    match the one we currently have. This makes fiemap on my testbox go from
    looking at me blankly for a day to spitting out actual output in a reasonable
    amount of time. Thanks,

    Signed-off-by: Josef Bacik
    Signed-off-by: Chris Mason

    Josef Bacik
     
  • The nodesize and leafsize were never of different values. Unify the
    usage and make nodesize the one. Cleanup the redundant checks and
    helpers.

    Shaves a few bytes from .text:

    text data bss dec hex filename
    852418 24560 23112 900090 dbbfa btrfs.ko.before
    851074 24584 23112 898770 db6d2 btrfs.ko.after

    Signed-off-by: David Sterba
    Signed-off-by: Chris Mason

    David Sterba
     
  • btrfs_set_key_type and btrfs_key_type are used inconsistently along with
    open coded variants. Other members of btrfs_key are accessed directly
    without any helpers anyway.

    Signed-off-by: David Sterba
    Signed-off-by: Chris Mason

    David Sterba
     

15 Aug, 2014

2 commits

  • We've got bug reports that btrfs crashes when quota is enabled on
    32bit kernel, typically with the Oops like below:
    BUG: unable to handle kernel NULL pointer dereference at 00000004
    IP: [] find_parent_nodes+0x360/0x1380 [btrfs]
    *pde = 00000000
    Oops: 0000 [#1] SMP
    CPU: 0 PID: 151 Comm: kworker/u8:2 Tainted: G S W 3.15.2-1.gd43d97e-default #1
    Workqueue: btrfs-qgroup-rescan normal_work_helper [btrfs]
    task: f1478130 ti: f147c000 task.ti: f147c000
    EIP: 0060:[] EFLAGS: 00010213 CPU: 0
    EIP is at find_parent_nodes+0x360/0x1380 [btrfs]
    EAX: f147dda8 EBX: f147ddb0 ECX: 00000011 EDX: 00000000
    ESI: 00000000 EDI: f147dda4 EBP: f147ddf8 ESP: f147dd38
    DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
    CR0: 8005003b CR2: 00000004 CR3: 00bf3000 CR4: 00000690
    Stack:
    00000000 00000000 f147dda4 00000050 00000001 00000000 00000001 00000050
    00000001 00000000 d3059000 00000001 00000022 000000a8 00000000 00000000
    00000000 000000a1 00000000 00000000 00000001 00000000 00000000 11800000
    Call Trace:
    [] __btrfs_find_all_roots+0x9d/0xf0 [btrfs]
    [] btrfs_qgroup_rescan_worker+0x401/0x760 [btrfs]
    [] normal_work_helper+0xc8/0x270 [btrfs]
    [] process_one_work+0x11b/0x390
    [] worker_thread+0x101/0x340
    [] kthread+0x9b/0xb0
    [] ret_from_kernel_thread+0x21/0x30
    [] kthread_create_on_node+0x110/0x110

    This indicates a NULL corruption in prefs_delayed list. The further
    investigation and bisection pointed that the call of ulist_add_merge()
    results in the corruption.

    ulist_add_merge() takes u64 as aux and writes a 64bit value into
    old_aux. The callers of this function in backref.c, however, pass a
    pointer of a pointer to old_aux. That is, the function overwrites
    64bit value on 32bit pointer. This caused a NULL in the adjacent
    variable, in this case, prefs_delayed.

    Here is a quick attempt to band-aid over this: a new function,
    ulist_add_merge_ptr() is introduced to pass/store properly a pointer
    value instead of u64. There are still ugly void ** cast remaining
    in the callers because void ** cannot be taken implicitly. But, it's
    safer than explicit cast to u64, anyway.

    Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=887046
    Cc: [v3.11+]
    Signed-off-by: Takashi Iwai
    Signed-off-by: Chris Mason

    Takashi Iwai
     
  • Before processing the extent buffer, acquire a read lock on it, so
    that we're safe against concurrent updates on the extent buffer.

    Signed-off-by: Filipe Manana
    Signed-off-by: Chris Mason

    Filipe Manana
     

10 Jun, 2014

4 commits

  • The skinny extents are intepreted incorrectly in scrub_print_warning(),
    and end up hitting the BUG() in btrfs_extent_inline_ref_size.

    Reported-by: Konstantinos Skarlatos
    Signed-off-by: Liu Bo
    Signed-off-by: Chris Mason

    Liu Bo
     
  • We want to make sure the point is still within the extent item, not to verify
    the memory it's pointing to.

    Signed-off-by: Liu Bo
    Signed-off-by: Chris Mason

    Liu Bo
     
  • The backref code was looking at nodes as well as leaves when we tried to
    populate extent item entries. This is not good, and although we go away with it
    for the most part because we'd skip where disk_bytenr != random_memory,
    sometimes random_memory would match and suddenly boom. This fixes that problem.
    Thanks,

    Signed-off-by: Josef Bacik
    Signed-off-by: Chris Mason

    Josef Bacik
     
  • This exercises the various parts of the new qgroup accounting code. We do some
    basic stuff and do some things with the shared refs to make sure all that code
    works. I had to add a bunch of infrastructure because I needed to be able to
    insert items into a fake tree without having to do all the hard work myself,
    hopefully this will be usefull in the future. Thanks,

    Signed-off-by: Josef Bacik
    Signed-off-by: Chris Mason

    Josef Bacik
     

07 Apr, 2014

1 commit

  • Lets try this again. We can deadlock the box if we send on a box and try to
    write onto the same fs with the app that is trying to listen to the send pipe.
    This is because the writer could get stuck waiting for a transaction commit
    which is being blocked by the send. So fix this by making sure looking at the
    commit roots is always going to be consistent. We do this by keeping track of
    which roots need to have their commit roots swapped during commit, and then
    taking the commit_root_sem and swapping them all at once. Then make sure we
    take a read lock on the commit_root_sem in cases where we search the commit root
    to make sure we're always looking at a consistent view of the commit roots.
    Previously we had problems with this because we would swap a fs tree commit root
    and then swap the extent tree commit root independently which would cause the
    backref walking code to screw up sometimes. With this patch we no longer
    deadlock and pass all the weird send/receive corner cases. Thanks,

    Reportedy-by: Hugo Mills
    Signed-off-by: Josef Bacik
    Signed-off-by: Chris Mason

    Josef Bacik
     

22 Mar, 2014

1 commit

  • I added an optimization for large files where we would stop searching for
    backrefs once we had looked at the number of references we currently had for
    this extent. This works great most of the time, but for snapshots that point to
    this extent and has changes in the original root this assumption falls on it
    face. So keep track of any delayed ref mods made and add in the actual ref
    count as reported by the extent item and use that to limit how far down an inode
    we'll search for extents. Thanks,

    Reportedy-by: Hugo Mills
    Signed-off-by: Josef Bacik
    Reported-by: Hugo Mills
    Tested-by: Hugo Mills
    Signed-off-by: Chris Mason

    Josef Bacik
     

11 Mar, 2014

3 commits


29 Jan, 2014

10 commits

  • When walking backrefs, we may iterate every inode's extent
    and add/merge them into ulist, and the caller will free memory
    from ulist.

    However, if we fail to allocate inode's extents element
    memory or ulist_add() fail to allocate memory, we won't
    add allocated memory into ulist, and the caller won't
    free some allocated memory thus memory leaks happen.

    Signed-off-by: Wang Shilong
    Signed-off-by: Josef Bacik
    Signed-off-by: Chris Mason

    Wang Shilong
     
  • I can easily trigger the following warnings when enabling quota
    in my virtual machine(running Opensuse), Steps are firstly creating
    a subvolume full of fragment extents, and then create many snapshots
    (500 in my test case).

    [ 2362.808459] BUG: soft lockup - CPU#0 stuck for 22s! [btrfs-qgroup-re:1970]

    [ 2362.809023] task: e4af8450 ti: e371c000 task.ti: e371c000
    [ 2362.809026] EIP: 0060:[] EFLAGS: 00000246 CPU: 0
    [ 2362.809049] EIP is at __merge_refs+0x5e/0x100 [btrfs]
    [ 2362.809051] EAX: 00000000 EBX: cfadbcf0 ECX: 00000000 EDX: cfadbcb0
    [ 2362.809052] ESI: dd8d3370 EDI: e371dde0 EBP: e371dd6c ESP: e371dd5c
    [ 2362.809054] DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
    [ 2362.809055] CR0: 80050033 CR2: ac454d50 CR3: 009a9000 CR4: 001407d0
    [ 2362.809099] Stack:
    [ 2362.809100] 00000001 e371dde0 dfcc6890 f29f8000 e371de28 fa39016d 00000011 00000001
    [ 2362.809105] 99bfc000 00000000 93928000 00000000 00000001 00000050 e371dda8 00000001
    [ 2362.809109] f3a31000 f3413000 00000001 e371ddb8 000040a8 00000202 00000000 00000023
    [ 2362.809113] Call Trace:
    [ 2362.809136] [] find_parent_nodes+0x34d/0x1280 [btrfs]
    [ 2362.809156] [] btrfs_find_all_roots+0xb2/0x110 [btrfs]
    [ 2362.809174] [] btrfs_qgroup_rescan_worker+0x358/0x7a0 [btrfs]
    [ 2362.809180] [] ? lock_timer_base.isra.39+0x1e/0x40
    [ 2362.809199] [] worker_loop+0xff/0x470 [btrfs]
    [ 2362.809204] [] ? __wake_up_locked+0x1a/0x20
    [ 2362.809221] [] ? btrfs_queue_worker+0x2b0/0x2b0 [btrfs]
    [ 2362.809225] [] kthread+0x9c/0xb0
    [ 2362.809229] [] ret_from_kernel_thread+0x1b/0x30
    [ 2362.809233] [] ? kthread_create_on_node+0x110/0x110

    By adding a reschedule point at the end of btrfs_find_all_roots(), i no longer
    hit these warnings.

    Cc: Josef Bacik
    Signed-off-by: Wang Shilong
    Reviewed-by: David Sterba
    Signed-off-by: Josef Bacik
    Signed-off-by: Chris Mason

    Wang Shilong
     
  • We can only tolerate ENOENT here, for other errors, we should
    return directly.

    Signed-off-by: Wang Shilong
    Signed-off-by: Josef Bacik
    Signed-off-by: Chris Mason

    Wang Shilong
     
  • There is a race condition between resolving indirect ref and root deletion,
    and we should gurantee that root can not be destroyed to avoid accessing
    broken tree here.

    Here we fix it by holding @subvol_srcu, and we will release it as soon
    as we have held root node lock.

    Signed-off-by: Wang Shilong
    Signed-off-by: Josef Bacik
    Signed-off-by: Chris Mason

    Wang Shilong
     
  • The backref walking code will search down to the key it is looking for and then
    proceed to walk _all_ of the extents on the file until it hits the end. This is
    suboptimal with large files, we only need to look for as many extents as we have
    references for that inode. I have a testcase that creates a randomly written 4
    gig file and before this patch it took 6min 30sec to do the initial send, with
    this patch it takes 2min 30sec to do the intial send. Thanks,

    Signed-off-by: Josef Bacik
    Signed-off-by: Chris Mason

    Josef Bacik
     
  • I don't think this is an issue and I've not seen it in practice but
    extent_from_logical will fail to find a skinny extent because it uses
    btrfs_previous_item and gives it the normal extent item type. This is just not
    a place to use btrfs_previous_item since we care about either normal extents or
    skinny extents, so open code btrfs_previous_item to properly check. This would
    only affect metadata and the only place this is used for metadata is scrub and
    I'm pretty sure it's just for printing stuff out, not actually doing any work so
    hopefully it was never a problem other than a cosmetic one. Thanks,

    Signed-off-by: Josef Bacik
    Signed-off-by: Chris Mason

    Josef Bacik
     
  • Currently we have two rb-trees, one for delayed ref heads and one for all of the
    delayed refs, including the delayed ref heads. When we process the delayed refs
    we have to hold onto the delayed ref lock for all of the selecting and merging
    and such, which results in quite a bit of lock contention. This was solved by
    having a waitqueue and only one flusher at a time, however this hurts if we get
    a lot of delayed refs queued up.

    So instead just have an rb tree for the delayed ref heads, and then attach the
    delayed ref updates to an rb tree that is per delayed ref head. Then we only
    need to take the delayed ref lock when adding new delayed refs and when
    selecting a delayed ref head to process, all the rest of the time we deal with a
    per delayed ref head lock which will be much less contentious.

    The locking rules for this get a little more complicated since we have to lock
    up to 3 things to properly process delayed refs, but I will address that problem
    later. For now this passes all of xfstests and my overnight stress tests.
    Thanks,

    Signed-off-by: Josef Bacik
    Signed-off-by: Chris Mason

    Josef Bacik
     
  • While running btrfs/004 from xfstests, after 503 iterations, dmesg reported
    a deadlock between tasks iterating inode refs and tasks running delayed inodes
    (during a transaction commit).

    It turns out that iterating inode refs implies doing one tree search and
    release all nodes in the path except the leaf node, and then passing that
    leaf node to btrfs_ref_to_path(), which in turn does another tree search
    without releasing the lock on the leaf node it received as parameter.

    This is a problem when other task wants to write to the btree as well and
    ends up updating the leaf that is read locked - the writer task locks the
    parent of the leaf and then blocks waiting for the leaf's lock to be
    released - at the same time, the task executing btrfs_ref_to_path()
    does a second tree search, without releasing the lock on the first leaf,
    and wants to access a leaf (the same or another one) that is a child of
    the same parent, resulting in a deadlock.

    The trace reported by lockdep follows.

    [84314.936373] INFO: task fsstress:11930 blocked for more than 120 seconds.
    [84314.936381] Tainted: G W O 3.12.0-fdm-btrfs-next-16+ #70
    [84314.936383] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
    [84314.936386] fsstress D ffff8806e1bf8000 0 11930 11926 0x00000000
    [84314.936393] ffff8804d6d89b78 0000000000000046 ffff8804d6d89b18 ffffffff810bd8bd
    [84314.936399] ffff8806e1bf8000 ffff8804d6d89fd8 ffff8804d6d89fd8 ffff8804d6d89fd8
    [84314.936405] ffff880806308000 ffff8806e1bf8000 ffff8804d6d89c08 ffff8804deb8f190
    [84314.936410] Call Trace:
    [84314.936421] [] ? trace_hardirqs_on+0xd/0x10
    [84314.936428] [] schedule+0x29/0x70
    [84314.936451] [] btrfs_tree_lock+0x75/0x270 [btrfs]
    [84314.936457] [] ? __init_waitqueue_head+0x60/0x60
    [84314.936470] [] btrfs_search_slot+0x7f1/0x930 [btrfs]
    [84314.936489] [] ? __btrfs_run_delayed_items+0x13a/0x1e0 [btrfs]
    [84314.936504] [] btrfs_lookup_inode+0x2f/0xa0 [btrfs]
    [84314.936510] [] ? trace_hardirqs_on_caller+0x1f/0x1e0
    [84314.936528] [] __btrfs_update_delayed_inode+0x4c/0x1d0 [btrfs]
    [84314.936543] [] ? __btrfs_run_delayed_items+0x13a/0x1e0 [btrfs]
    [84314.936558] [] ? __btrfs_run_delayed_items+0x13a/0x1e0 [btrfs]
    [84314.936573] [] __btrfs_run_delayed_items+0x192/0x1e0 [btrfs]
    [84314.936589] [] btrfs_run_delayed_items+0x13/0x20 [btrfs]
    [84314.936604] [] btrfs_flush_all_pending_stuffs+0x24/0x80 [btrfs]
    [84314.936620] [] btrfs_commit_transaction+0x223/0xa20 [btrfs]
    [84314.936630] [] btrfs_sync_fs+0x6e/0x110 [btrfs]
    [84314.936635] [] ? __sync_filesystem+0x60/0x60
    [84314.936639] [] ? __sync_filesystem+0x60/0x60
    [84314.936643] [] sync_fs_one_sb+0x20/0x30
    [84314.936648] [] iterate_supers+0xf1/0x100
    [84314.936652] [] sys_sync+0x55/0x90
    [84314.936658] [] system_call_fastpath+0x16/0x1b
    [84314.936660] INFO: lockdep is turned off.
    [84314.936663] INFO: task btrfs:11955 blocked for more than 120 seconds.
    [84314.936666] Tainted: G W O 3.12.0-fdm-btrfs-next-16+ #70
    [84314.936668] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
    [84314.936670] btrfs D ffff880541729a88 0 11955 11608 0x00000000
    [84314.936674] ffff880541729a38 0000000000000046 ffff8805417299d8 ffffffff810bd8bd
    [84314.936680] ffff88075430c8a0 ffff880541729fd8 ffff880541729fd8 ffff880541729fd8
    [84314.936685] ffffffff81c104e0 ffff88075430c8a0 ffff8804de8b00b8 ffff8804de8b0000
    [84314.936690] Call Trace:
    [84314.936695] [] ? trace_hardirqs_on+0xd/0x10
    [84314.936700] [] schedule+0x29/0x70
    [84314.936717] [] btrfs_tree_read_lock+0xd5/0x140 [btrfs]
    [84314.936721] [] ? __init_waitqueue_head+0x60/0x60
    [84314.936733] [] btrfs_search_slot+0x7c1/0x930 [btrfs]
    [84314.936746] [] btrfs_find_item+0x55/0x160 [btrfs]
    [84314.936763] [] ? free_extent_buffer+0x49/0xc0 [btrfs]
    [84314.936780] [] btrfs_ref_to_path+0xba/0x1e0 [btrfs]
    [84314.936797] [] ? release_extent_buffer+0xb9/0xe0 [btrfs]
    [84314.936813] [] ? free_extent_buffer+0x49/0xc0 [btrfs]
    [84314.936830] [] inode_to_path+0x60/0xd0 [btrfs]
    [84314.936846] [] paths_from_inode+0x115/0x3c0 [btrfs]
    [84314.936851] [] ? kmem_cache_alloc_trace+0x114/0x200
    [84314.936868] [] btrfs_ioctl+0xf14/0x2030 [btrfs]
    [84314.936873] [] ? _raw_spin_unlock+0x2b/0x50
    [84314.936877] [] ? handle_mm_fault+0x34f/0xb00
    [84314.936882] [] ? up_read+0x23/0x40
    [84314.936886] [] ? __do_page_fault+0x20c/0x5a0
    [84314.936892] [] do_vfs_ioctl+0x96/0x570
    [84314.936896] [] ? error_sti+0x5/0x6
    [84314.936901] [] ? trace_hardirqs_off_caller+0x28/0xd0
    [84314.936906] [] ? retint_swapgs+0xe/0x13
    [84314.936910] [] SyS_ioctl+0x91/0xb0
    [84314.936915] [] ? trace_hardirqs_on_thunk+0x3a/0x3f
    [84314.936920] [] system_call_fastpath+0x16/0x1b
    [84314.936922] INFO: lockdep is turned off.
    [84434.866873] INFO: task btrfs-transacti:11921 blocked for more than 120 seconds.
    [84434.866881] Tainted: G W O 3.12.0-fdm-btrfs-next-16+ #70
    [84434.866883] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
    [84434.866886] btrfs-transacti D ffff880755b6a478 0 11921 2 0x00000000
    [84434.866893] ffff8800735b9ce8 0000000000000046 ffff8800735b9c88 ffffffff810bd8bd
    [84434.866899] ffff8805a1b848a0 ffff8800735b9fd8 ffff8800735b9fd8 ffff8800735b9fd8
    [84434.866904] ffffffff81c104e0 ffff8805a1b848a0 ffff880755b6a478 ffff8804cece78f0
    [84434.866910] Call Trace:
    [84434.866920] [] ? trace_hardirqs_on+0xd/0x10
    [84434.866927] [] schedule+0x29/0x70
    [84434.866948] [] wait_current_trans.isra.33+0xbf/0x120 [btrfs]
    [84434.866954] [] ? __init_waitqueue_head+0x60/0x60
    [84434.866970] [] start_transaction+0x388/0x5a0 [btrfs]
    [84434.866985] [] ? transaction_kthread+0xb5/0x280 [btrfs]
    [84434.866999] [] btrfs_attach_transaction+0x17/0x20 [btrfs]
    [84434.867012] [] transaction_kthread+0x19e/0x280 [btrfs]
    [84434.867026] [] ? open_ctree+0x2260/0x2260 [btrfs]
    [84434.867030] [] kthread+0xed/0x100
    [84434.867035] [] ? flush_kthread_worker+0x190/0x190
    [84434.867040] [] ret_from_fork+0x7c/0xb0
    [84434.867044] [] ? flush_kthread_worker+0x190/0x190

    Signed-off-by: Filipe David Borba Manana
    Signed-off-by: Josef Bacik
    Signed-off-by: Chris Mason

    Filipe David Borba Manana
     
  • There are many btrfs functions that manually search the tree for an
    item. They all reimplement the same mechanism and differ in the
    conditions that they use to find the item. __inode_info() is one such
    example. Zach Brown proposed creating a new interface to take the place
    of these functions.

    This patch is the first step to creating the interface. A new function,
    btrfs_find_item, has been added to ctree.c and prototyped in ctree.h.
    It is identical to __inode_info, except that the order of the parameters
    has been rearranged to more closely those of similar functions elsewhere
    in the code (now, root and path come first, then the objectid, offset
    and type, and the key to be filled in last). __inode_info's callers have
    been set to call this new function instead, and __inode_info itself has
    been removed.

    Signed-off-by: Kelley Nielsen
    Suggested-by: Zach Brown
    Reviewed-by: Josh Triplett
    Signed-off-by: Josef Bacik
    Signed-off-by: Chris Mason

    Kelley Nielsen
     
  • Signed-off-by: Valentina Giusti
    Signed-off-by: Josef Bacik
    Signed-off-by: Chris Mason

    Valentina Giusti
     

12 Nov, 2013

3 commits

  • Use WARN_ON()'s return value in place of WARN_ON(1) for cleaner source
    code that outputs a more descriptive warnings. Also fix the styling
    warning of redundant braces that came up as a result of this fix.

    Signed-off-by: Dulshani Gunawardhana
    Reviewed-by: Zach Brown
    Signed-off-by: Josef Bacik
    Signed-off-by: Chris Mason

    Dulshani Gunawardhana
     
  • Running balance and defrag concurrently can end up with a crash:

    kernel BUG at fs/btrfs/relocation.c:4528!
    RIP: 0010:[] [] btrfs_reloc_cow_block+ 0x1eb/0x230 [btrfs]
    Call Trace:
    [] ? update_ref_for_cow+0x241/0x380 [btrfs]
    [] ? copy_extent_buffer+0xad/0x110 [btrfs]
    [] __btrfs_cow_block+0x3a1/0x520 [btrfs]
    [] btrfs_cow_block+0x116/0x1b0 [btrfs]
    [] btrfs_search_slot+0x43d/0x970 [btrfs]
    [] btrfs_lookup_file_extent+0x37/0x40 [btrfs]
    [] __btrfs_drop_extents+0x11e/0xae0 [btrfs]
    [] ? generic_bin_search.constprop.39+0x8d/0x1a0 [btrfs]
    [] ? kmem_cache_alloc+0x1da/0x200
    [] ? btrfs_alloc_path+0x1a/0x20 [btrfs]
    [] btrfs_drop_extents+0x60/0x90 [btrfs]
    [] relink_extent_backref+0x2ed/0x780 [btrfs]
    [] ? btrfs_submit_bio_hook+0x1e0/0x1e0 [btrfs]
    [] ? iterate_inodes_from_logical+0x87/0xa0 [btrfs]
    [] btrfs_finish_ordered_io+0x229/0xac0 [btrfs]
    [] finish_ordered_fn+0x15/0x20 [btrfs]
    [] worker_loop+0x125/0x4e0 [btrfs]
    [] ? btrfs_queue_worker+0x300/0x300 [btrfs]
    [] kthread+0xc0/0xd0
    [] ? insert_kthread_work+0x40/0x40
    [] ret_from_fork+0x7c/0xb0
    [] ? insert_kthread_work+0x40/0x40
    ----------------------------------------------------------------------

    It turns out to be that balance operation will bump root's @last_snapshot,
    which enables snapshot-aware defrag path, and backref walking stuff will
    find data reloc tree as refs' parent, and hit the BUG_ON() during COW.

    As data reloc tree's data is just for relocation purpose, and will be deleted right
    after relocation is done, it's unnecessary to walk those refs belonged to data reloc
    tree, it'd be better to skip them.

    Signed-off-by: Liu Bo
    Signed-off-by: Josef Bacik
    Signed-off-by: Chris Mason

    Liu Bo
     
  • Remove unused eb parameter from btrfs_item_nr

    Signed-off-by: Ross Kirk
    Reviewed-by: David Sterba
    Signed-off-by: Josef Bacik
    Signed-off-by: Chris Mason

    Ross Kirk
     

01 Sep, 2013

6 commits


10 Aug, 2013

2 commits

  • Because we don't mess with the offset into the extent for compressed we will
    properly find both extents for this case

    [extent a][extent b][rest of extent a]

    but because we already added a ref for the front half we won't add the inode
    information for the second half. This causes us to leak that memory and not
    print out the other offset when we do logical-resolve. So fix this by calling
    ulist_add_merge and then add our eie to the existing entry if there is one.
    With this patch we get both offsets out of logical-resolve. With this and the
    other 2 patches I've sent we now pass btrfs/276 on my vm with compress-force=lzo
    set. Thanks,

    Signed-off-by: Josef Bacik
    Signed-off-by: Chris Mason

    Josef Bacik
     
  • If you do btrfs inspect-internal logical-resolve on a compressed extent that has
    been partly overwritten it won't find anything. This is because we try and
    match the extent offset we've searched for based on the extent offset in the
    data extent entry. However this doesn't work for compressed extents because the
    offsets are for the uncompressed size, not the compressed size. So instead only
    do this check if we are not compressed, that way we can get an actual entry for
    the physical offset rather than nothing for compressed. Thanks,

    Signed-off-by: Josef Bacik
    Signed-off-by: Chris Mason

    Josef Bacik
     

02 Jul, 2013

1 commit

  • I missed fixing the backref stuff when I introduced the skinny metadata. If you
    try and do things like snapshot aware defrag with skinny metadata you are going
    to see tons of warnings related to the backref count being less than 0. This is
    because the delayed refs will be found for stuff just fine, but it won't find
    the skinny metadata extent refs. With this patch I'm not seeing warnings
    anymore. Thanks,

    Reviewed-by: Liu Bo
    Signed-off-by: Josef Bacik

    Josef Bacik
     

01 Jul, 2013

1 commit

  • Looking into this backref problem I noticed we're using a macro to what turns
    out to essentially be a NULL check to see if we need to search the commit root.
    I'm killing this, let's just do what everybody else does and checks if trans ==
    NULL. I've also made it so we pass in the path to __resolve_indirect_refs which
    will have the search_commit_root flag set properly already and that way we can
    avoid allocating another path when we have a perfectly good one to use. Thanks,

    Signed-off-by: Josef Bacik

    Josef Bacik
     

18 May, 2013

1 commit