Linux, BTRFS and kernel crashing / hanging when balancing.. SOLVED

If you’re balancing your BTRFS file system and Ubuntureceive a stacktrace in your os errorlog (typically /var/log/syslog on Linux) like the one below, then don’t fear! It’s been fixed in the 3.14 Linux kernel! You can either wait until it is included in your distribution or get it from kernel.org.

In the case of Ubuntu and derivatives, you can always download the latest kernel from kernel.ubuntu.com. I’m currently using 3.14.0-031400rc5-generic.

kernel: [  451.005400] btrfs: disk space caching is enabled
kernel: [  463.141547] BTRFS debug (device sdl): unlinked 1 orphans
kernel: [  463.170345] btrfs: continuing balance
kernel: [  489.303180] btrfs: relocating block group 3402792697856 flags 129
kernel: [  520.839804] btrfs: found 75 extents
kernel: [  530.404740] ------------[ cut here ]------------
kernel: [  530.404767] Kernel BUG at ffffffffa02e2167 [verbose debug info unavailable]
kernel: [  530.404775] invalid opcode: 0000 [#1] SMP
....
kernel: [  530.404960] task: ffff88032894aee0 ti: ffff88030a1c0000 task.ti: ffff88030a1c0000
kernel: [  530.404966] RIP: 0010:[<ffffffffa02e2167>]  [</ffffffffa02e2167><ffffffffa02e2167>] build_backref_tree+0x277/0x11d0 [btrfs]
kernel: [  530.404996] RSP: 0018:ffff88030a1c19f8  EFLAGS: 00010246
kernel: [  530.405002] RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffff8802cdb7b8d0
kernel: [  530.405007] RDX: ffff88030a1c1a68 RSI: ffff88030a1c1a68 RDI: ffff8802cdb7b8c0
kernel: [  530.405013] RBP: ffff88030a1c1ad8 R08: ffff88030970cf00 R09: ffff88030970cc80
kernel: [  530.405019] R10: 0000000000000001 R11: 0000000000000000 R12: ffff8802cdb7b8d0
kernel: [  530.405025] R13: ffff88030ec1ccf0 R14: ffff88032a5bf000 R15: ffff88030970cb80
kernel: [  530.405031] FS:  0000000000000000(0000) GS:ffff88033fc60000(0000) knlGS:0000000000000000
kernel: [  530.405038] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
kernel: [  530.405043] CR2: 00007f4244bd9000 CR3: 0000000001c0e000 CR4: 00000000000007e0
kernel: [  530.405049] Stack:
kernel: [  530.405052]  ffff88032a5bf588 ffff88030970cc80 ffff8802cdb7bc60 ffff88030970cf00
kernel: [  530.405064]  ffff88030970cf00 ffff88032a5be000 ffff88030ec1ccf0 ffff88030970cf40
kernel: [  530.405075]  ffff88030ec1cd80 ffff88032a5bf120 ffff88030970cc80 ffff88032a5bf020
kernel: [  530.405086] Call Trace:
kernel: [  530.405107]  [<ffffffffa02e3478>] relocate_tree_blocks+0x1d8/0x630 [btrfs]
kernel: [  530.405128]  [<ffffffffa02e4108>] ? add_data_references+0x248/0x280 [btrfs]
kernel: [  530.405148]  [<ffffffffa02e4d00>] relocate_block_group+0x280/0x690 [btrfs]
kernel: [  530.405169]  [<ffffffffa02e52af>] btrfs_relocate_block_group+0x19f/0x2e0 [btrfs]
kernel: [  530.405190]  [<ffffffffa02bc77f>] btrfs_relocate_chunk.isra.30+0x6f/0x730 [btrfs]
kernel: [  530.405204]  [<ffffffffa0272b89>] ? btrfs_set_path_blocking+0x39/0x80 [btrfs]
kernel: [  530.405219]  [<ffffffffa0277940>] ? btrfs_search_slot+0x380/0x940 [btrfs]
kernel: [  530.407979]  [<ffffffffa02b3289>] ? release_extent_buffer+0x69/0xd0 [btrfs]
kernel: [  530.408001]  [<ffffffffa02b8c8f>] ? free_extent_buffer+0x4f/0xa0 [btrfs]
kernel: [  530.408021]  [<ffffffffa02c0859>] btrfs_shrink_device+0x1e9/0x420 [btrfs]
kernel: [  530.408042]  [<ffffffffa02c0b5c>] __btrfs_balance+0xcc/0x800 [btrfs]
kernel: [  530.408052]  [<ffffffff816e9932>] ? down_read+0x12/0x30
kernel: [  530.408071]  [<ffffffffa0294563>] ? btrfs_calc_num_tolerated_disk_barrier_failures+0x133/0x180 [btrfs]
kernel: [  530.408093]  [<ffffffffa02c164b>] btrfs_balance+0x3bb/0x670 [btrfs]
kernel: [  530.408113]  [<ffffffffa02c1970>] balance_kthread+0x70/0x80 [btrfs]
kernel: [  530.408133]  [<ffffffffa02c1900>] ? btrfs_balance+0x670/0x670 [btrfs]
kernel: [  530.408143]  [<ffffffff810847b0>] kthread+0xc0/0xd0
kernel: [  530.408150]  [<ffffffff810846f0>] ? kthread_create_on_node+0x120/0x120
kernel: [  530.408158]  [<ffffffff816f516c>] ret_from_fork+0x7c/0xb0
kernel: [  530.408165]  [<ffffffff810846f0>] ? kthread_create_on_node+0x120/0x120
kernel: [  530.408170] Code: f6 43 71 10 0f 85 18 0f 00 00 48 8d 43 40 48 89 c6 48 89 85 58 ff ff ff 48 8b 43 40 48 39 c6 74 0c 48 3b 43 48 0f 84 f5 08 00 00 &lt;0f> 0b 48 c7 85 78 ff ff ff 00 00 00 00 0f 1f 40 00 e8 93 87 40
kernel: [  530.409046] RIP  [<ffffffffa02e2167>] build_backref_tree+0x277/0x11d0 [btrfs]
kernel: [  530.409068]  RSP <ffff88030a1c19f8>
kernel: [  530.419453] ---[ end trace 5cd3ef9b0a742c83 ]---
kernel: [  648.985201] perf samples too long (3067 > 2500), lowering kernel.perf_event_max_sample_rate to 50000</ffff88030a1c19f8></ffffffffa02e2167></ffffffff810846f0></ffffffff816f516c></ffffffff810846f0></ffffffff810847b0></ffffffffa02c1900></ffffffffa02c1970></ffffffffa02c164b></ffffffffa0294563></ffffffff816e9932></ffffffffa02c0b5c></ffffffffa02c0859></ffffffffa02b8c8f></ffffffffa02b3289></ffffffffa0277940></ffffffffa0272b89></ffffffffa02bc77f></ffffffffa02e52af></ffffffffa02e4d00></ffffffffa02e4108></ffffffffa02e3478></ffffffffa02e2167>
Share Button

One Reply to “Linux, BTRFS and kernel crashing / hanging when balancing.. SOLVED”

Leave a Reply

Your email address will not be published. Required fields are marked *