<feed xmlns='http://www.w3.org/2005/Atom'>
<title>BMC/Intel-BMC/linux.git/fs/btrfs/ctree.h, branch dev</title>
<subtitle>Intel OpenBMC Linux kernel source tree (mirror)</subtitle>
<id>https://git.radix-linux.su/BMC/Intel-BMC/linux.git/atom?h=dev</id>
<link rel='self' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/atom?h=dev'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/'/>
<updated>2015-06-30T21:36:46+00:00</updated>
<entry>
<title>Btrfs: fix race between balance and unused block group deletion</title>
<updated>2015-06-30T21:36:46+00:00</updated>
<author>
<name>Filipe Manana</name>
<email>fdmanana@suse.com</email>
</author>
<published>2015-06-10T23:58:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=67c5e7d464bc466471b05e027abe8a6b29687ebd'/>
<id>urn:sha1:67c5e7d464bc466471b05e027abe8a6b29687ebd</id>
<content type='text'>
We have a race between deleting an unused block group and balancing the
same block group that leads to an assertion failure/BUG(), producing the
following trace:

[181631.208236] BTRFS: assertion failed: 0, file: fs/btrfs/volumes.c, line: 2622
[181631.220591] ------------[ cut here ]------------
[181631.222959] kernel BUG at fs/btrfs/ctree.h:4062!
[181631.223932] invalid opcode: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC
[181631.224566] Modules linked in: btrfs dm_flakey dm_mod crc32c_generic xor raid6_pq nfsd auth_rpcgss oid_registry nfs_acl nfs lockd grace fscache sunrpc loop fuse acpi_cpufreq parpor$
[181631.224566] CPU: 8 PID: 17451 Comm: btrfs Tainted: G        W       4.1.0-rc5-btrfs-next-10+ #1
[181631.224566] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.8.1-0-g4adadbd-20150316_085822-nilsson.home.kraxel.org 04/01/2014
[181631.224566] task: ffff880127e09590 ti: ffff8800b5824000 task.ti: ffff8800b5824000
[181631.224566] RIP: 0010:[&lt;ffffffffa03f19f6&gt;]  [&lt;ffffffffa03f19f6&gt;] assfail.constprop.50+0x1e/0x20 [btrfs]
[181631.224566] RSP: 0018:ffff8800b5827ae8  EFLAGS: 00010246
[181631.224566] RAX: 0000000000000040 RBX: ffff8800109fc218 RCX: ffffffff81095dce
[181631.224566] RDX: 0000000000005124 RSI: ffffffff81464819 RDI: 00000000ffffffff
[181631.224566] RBP: ffff8800b5827ae8 R08: 0000000000000001 R09: 0000000000000000
[181631.224566] R10: 0000000000000000 R11: 0000000000000000 R12: ffff8800109fc200
[181631.224566] R13: ffff880020095000 R14: ffff8800b1a13f38 R15: ffff880020095000
[181631.224566] FS:  00007f70ca0b0c80(0000) GS:ffff88013ec00000(0000) knlGS:0000000000000000
[181631.224566] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[181631.224566] CR2: 00007f2872ab6e68 CR3: 00000000a717c000 CR4: 00000000000006e0
[181631.224566] Stack:
[181631.224566]  ffff8800b5827ba8 ffffffffa03f3916 ffff8800b5827b38 ffffffffa03d080e
[181631.224566]  ffffffffa03d1423 ffff880020095000 ffff88001233c000 0000000000000001
[181631.224566]  ffff880020095000 ffff8800b1a13f38 0000000a69c00000 0000000000000000
[181631.224566] Call Trace:
[181631.224566]  [&lt;ffffffffa03f3916&gt;] btrfs_remove_chunk+0xa4/0x6bb [btrfs]
[181631.224566]  [&lt;ffffffffa03d080e&gt;] ? join_transaction.isra.8+0xb9/0x3ba [btrfs]
[181631.224566]  [&lt;ffffffffa03d1423&gt;] ? wait_current_trans.isra.13+0x22/0xfc [btrfs]
[181631.224566]  [&lt;ffffffffa03f3fbc&gt;] btrfs_relocate_chunk.isra.29+0x8f/0xa7 [btrfs]
[181631.224566]  [&lt;ffffffffa03f54df&gt;] btrfs_balance+0xaa4/0xc52 [btrfs]
[181631.224566]  [&lt;ffffffffa03fd388&gt;] btrfs_ioctl_balance+0x23f/0x2b0 [btrfs]
[181631.224566]  [&lt;ffffffff810872f9&gt;] ? trace_hardirqs_on+0xd/0xf
[181631.224566]  [&lt;ffffffffa04019a3&gt;] btrfs_ioctl+0xfe2/0x2220 [btrfs]
[181631.224566]  [&lt;ffffffff812603ed&gt;] ? __this_cpu_preempt_check+0x13/0x15
[181631.224566]  [&lt;ffffffff81084669&gt;] ? arch_local_irq_save+0x9/0xc
[181631.224566]  [&lt;ffffffff81138def&gt;] ? handle_mm_fault+0x834/0xcd2
[181631.224566]  [&lt;ffffffff81138def&gt;] ? handle_mm_fault+0x834/0xcd2
[181631.224566]  [&lt;ffffffff8103e48c&gt;] ? __do_page_fault+0x211/0x424
[181631.224566]  [&lt;ffffffff811755e6&gt;] do_vfs_ioctl+0x3c6/0x479
(...)

The sequence of steps leading to this are:

           CPU 0                                         CPU 1

  btrfs_balance()
    btrfs_relocate_chunk()

      btrfs_relocate_block_group(bg X)
        btrfs_lookup_block_group(bg X)

                                               cleaner_kthread
                                                  locks fs_info-&gt;cleaner_mutex

                                                  btrfs_delete_unused_bgs()
                                                    finds bg X, which became
                                                    unused in the previous
                                                    transaction

                                                    checks bg X -&gt;ro == 0,
                                                    so it proceeds
        sets bg X -&gt;ro to 1
        (btrfs_set_block_group_ro(bg X))

        blocks on fs_info-&gt;cleaner_mutex
                                                    btrfs_remove_chunk(bg X)
                                                  unlocks fs_info-&gt;cleaner_mutex

        acquires fs_info-&gt;cleaner_mutex
        relocate_block_group()
          --&gt; does nothing, no extents found in
              the extent tree from bg X
        unlocks fs_info-&gt;cleaner_mutex

      btrfs_relocate_block_group(bg X) returns

    btrfs_remove_chunk(bg X)
       extent map not found
          --&gt; ASSERT(0)

Fix this by using a new mutex to make sure these 2 operations, block
group relocation and removal, are serialized.

This issue is reproducible by running fstests generic/038 (which stresses
chunk allocation and automatic removal of unused block groups) together
with the following balance loop:

    while true; do btrfs balance start -dusage=0 &lt;mountpoint&gt; ; done

Signed-off-by: Filipe Manana &lt;fdmanana@suse.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'sysfs-fsdevices-4.2-part1' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux into anand</title>
<updated>2015-06-23T12:34:39+00:00</updated>
<author>
<name>Chris Mason</name>
<email>clm@fb.com</email>
</author>
<published>2015-06-23T12:34:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=c40b7b064f6159df3a080595a498613d08206e59'/>
<id>urn:sha1:c40b7b064f6159df3a080595a498613d08206e59</id>
<content type='text'>
</content>
</entry>
<entry>
<title>btrfs: qgroup: Cleanup the old ref_node-oriented mechanism.</title>
<updated>2015-06-10T16:26:11+00:00</updated>
<author>
<name>Qu Wenruo</name>
<email>quwenruo@cn.fujitsu.com</email>
</author>
<published>2015-04-17T02:23:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=e69bcee37692f5d8c557335ddd2444cb4afe0005'/>
<id>urn:sha1:e69bcee37692f5d8c557335ddd2444cb4afe0005</id>
<content type='text'>
Goodbye, the old mechanisim.

Signed-off-by: Qu Wenruo &lt;quwenruo@cn.fujitsu.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</content>
</entry>
<entry>
<title>btrfs: Fix lockdep warning of wr_ctx-&gt;wr_lock in scrub_free_wr_ctx()</title>
<updated>2015-06-10T14:04:52+00:00</updated>
<author>
<name>Zhao Lei</name>
<email>zhaolei@cn.fujitsu.com</email>
</author>
<published>2015-06-04T12:09:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=20b2e3029eef277cd93a46a991004260057e1a9e'/>
<id>urn:sha1:20b2e3029eef277cd93a46a991004260057e1a9e</id>
<content type='text'>
lockdep report following warning in test:
 [25176.843958] =================================
 [25176.844519] [ INFO: inconsistent lock state ]
 [25176.845047] 4.1.0-rc3 #22 Tainted: G        W
 [25176.845591] ---------------------------------
 [25176.846153] inconsistent {SOFTIRQ-ON-W} -&gt; {IN-SOFTIRQ-W} usage.
 [25176.846713] fsstress/26661 [HC0[0]:SC1[1]:HE1:SE0] takes:
 [25176.847246]  (&amp;wr_ctx-&gt;wr_lock){+.?...}, at: [&lt;ffffffffa04cdc6d&gt;] scrub_free_ctx+0x2d/0xf0 [btrfs]
 [25176.847838] {SOFTIRQ-ON-W} state was registered at:
 [25176.848396]   [&lt;ffffffff810bf460&gt;] __lock_acquire+0x6a0/0xe10
 [25176.848955]   [&lt;ffffffff810bfd1e&gt;] lock_acquire+0xce/0x2c0
 [25176.849491]   [&lt;ffffffff816489af&gt;] mutex_lock_nested+0x7f/0x410
 [25176.850029]   [&lt;ffffffffa04d04ff&gt;] scrub_stripe+0x4df/0x1080 [btrfs]
 [25176.850575]   [&lt;ffffffffa04d11b1&gt;] scrub_chunk.isra.19+0x111/0x130 [btrfs]
 [25176.851110]   [&lt;ffffffffa04d144c&gt;] scrub_enumerate_chunks+0x27c/0x510 [btrfs]
 [25176.851660]   [&lt;ffffffffa04d3b87&gt;] btrfs_scrub_dev+0x1c7/0x6c0 [btrfs]
 [25176.852189]   [&lt;ffffffffa04e918e&gt;] btrfs_dev_replace_start+0x36e/0x450 [btrfs]
 [25176.852771]   [&lt;ffffffffa04a98e0&gt;] btrfs_ioctl+0x1e10/0x2d20 [btrfs]
 [25176.853315]   [&lt;ffffffff8121c5b8&gt;] do_vfs_ioctl+0x318/0x570
 [25176.853868]   [&lt;ffffffff8121c851&gt;] SyS_ioctl+0x41/0x80
 [25176.854406]   [&lt;ffffffff8164da17&gt;] system_call_fastpath+0x12/0x6f
 [25176.854935] irq event stamp: 51506
 [25176.855511] hardirqs last  enabled at (51506): [&lt;ffffffff810d4ce5&gt;] vprintk_emit+0x225/0x5e0
 [25176.856059] hardirqs last disabled at (51505): [&lt;ffffffff810d4b77&gt;] vprintk_emit+0xb7/0x5e0
 [25176.856642] softirqs last  enabled at (50886): [&lt;ffffffff81067a23&gt;] __do_softirq+0x363/0x640
 [25176.857184] softirqs last disabled at (50949): [&lt;ffffffff8106804d&gt;] irq_exit+0x10d/0x120
 [25176.857746]
 other info that might help us debug this:
 [25176.858845]  Possible unsafe locking scenario:
 [25176.859981]        CPU0
 [25176.860537]        ----
 [25176.861059]   lock(&amp;wr_ctx-&gt;wr_lock);
 [25176.861705]   &lt;Interrupt&gt;
 [25176.862272]     lock(&amp;wr_ctx-&gt;wr_lock);
 [25176.862881]
  *** DEADLOCK ***

Reason:
 Above warning is caused by:
 Interrupt
 -&gt; bio_endio()
 -&gt; ...
 -&gt; scrub_put_ctx()
 -&gt; scrub_free_ctx() *1
 -&gt; ...
 -&gt; mutex_lock(&amp;wr_ctx-&gt;wr_lock);

 scrub_put_ctx() is allowed to be called in end_bio interrupt, but
 in code design, it will never call scrub_free_ctx(sctx) in interrupe
 context(above *1), because btrfs_scrub_dev() get one additional
 reference of sctx-&gt;refs, which makes scrub_free_ctx() only called
 withine btrfs_scrub_dev().

 Now the code runs out of our wish, because free sequence in
 scrub_pending_bio_dec() have a gap.

 Current code:
 -----------------------------------+-----------------------------------
 scrub_pending_bio_dec()            |  btrfs_scrub_dev
 -----------------------------------+-----------------------------------
 atomic_dec(&amp;sctx-&gt;bios_in_flight); |
 wake_up(&amp;sctx-&gt;list_wait);         |
                                    | scrub_put_ctx()
                                    | -&gt; atomic_dec_and_test(&amp;sctx-&gt;refs)
 scrub_put_ctx(sctx);               |
 -&gt; atomic_dec_and_test(&amp;sctx-&gt;refs)|
 -&gt; scrub_free_ctx()                |
 -----------------------------------+-----------------------------------

 We expected:
 -----------------------------------+-----------------------------------
 scrub_pending_bio_dec()            |  btrfs_scrub_dev
 -----------------------------------+-----------------------------------
 atomic_dec(&amp;sctx-&gt;bios_in_flight); |
 wake_up(&amp;sctx-&gt;list_wait);         |
 scrub_put_ctx(sctx);               |
 -&gt; atomic_dec_and_test(&amp;sctx-&gt;refs)|
                                    | scrub_put_ctx()
                                    | -&gt; atomic_dec_and_test(&amp;sctx-&gt;refs)
                                    | -&gt; scrub_free_ctx()
 -----------------------------------+-----------------------------------

Fix:
 Move scrub_pending_bio_dec() to a workqueue, to avoid this function run
 in interrupt context.
 Tested by check tracelog in debug.

Changelog v1-&gt;v2:
 Use workqueue instead of adjust function call sequence in v1,
 because v1 will introduce a bug pointed out by:
 Filipe David Manana &lt;fdmanana@gmail.com&gt;

Reported-by: Qu Wenruo &lt;quwenruo@cn.fujitsu.com&gt;
Signed-off-by: Zhao Lei &lt;zhaolei@cn.fujitsu.com&gt;
Reviewed-by: Filipe Manana &lt;fdmanana@suse.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</content>
</entry>
<entry>
<title>Btrfs: fix necessary chunk tree space calculation when allocating a chunk</title>
<updated>2015-06-10T14:02:46+00:00</updated>
<author>
<name>Filipe Manana</name>
<email>fdmanana@suse.com</email>
</author>
<published>2015-06-09T16:48:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=4617ea3a52cfe8ae407ef406ab999f40a558c369'/>
<id>urn:sha1:4617ea3a52cfe8ae407ef406ab999f40a558c369</id>
<content type='text'>
When allocating a new chunk or removing one we need to update num_devs
device items and insert or remove a chunk item in the chunk tree, so
in the worst case the space needed in the chunk space_info is:

  btrfs_calc_trunc_metadata_size(chunk_root, num_devs) +
     btrfs_calc_trans_metadata_size(chunk_root, 1)

That is, in the worst case we need to cow num_devs paths and cow 1 other
path that can result in splitting every node and leaf, and each path
consisting of BTRFS_MAX_LEVEL - 1 nodes and 1 leaf. We were requiring
some additional chunk_root-&gt;nodesize * BTRFS_MAX_LEVEL * num_devs bytes,
which were unnecessary since updating the existing device items does
not result in splitting the nodes and leaf since after updating them
they remain with the same size.

Signed-off-by: Filipe Manana &lt;fdmanana@suse.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</content>
</entry>
<entry>
<title>Btrfs: fix -ENOSPC on block group removal</title>
<updated>2015-06-03T11:03:05+00:00</updated>
<author>
<name>Filipe Manana</name>
<email>fdmanana@suse.com</email>
</author>
<published>2015-05-20T13:01:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=39c2d7faccc5ca5a1be682b01c0db5fafa8adeda'/>
<id>urn:sha1:39c2d7faccc5ca5a1be682b01c0db5fafa8adeda</id>
<content type='text'>
Unlike when attempting to allocate a new block group, where we check
that we have enough space in the system space_info to update the device
items and insert a new chunk item in the chunk tree, we were not checking
if the system space_info had enough space for updating the device items
and deleting the chunk item in the chunk tree. This often lead to -ENOSPC
error when attempting to allocate blocks for the chunk tree (during btree
node/leaf COW operations) while updating the device items or deleting the
chunk item, which resulted in the current transaction being aborted and
turning the filesystem into read-only mode.

While running fstests generic/038, which stresses allocation of block
groups and removal of unused block groups, with a large scratch device
(750Gb) this happened often, despite more than enough unallocated space,
and resulted in the following trace:

[68663.586604] WARNING: CPU: 3 PID: 1521 at fs/btrfs/super.c:260 __btrfs_abort_transaction+0x52/0x114 [btrfs]()
[68663.600407] BTRFS: Transaction aborted (error -28)
(...)
[68663.730829] Call Trace:
[68663.732585]  [&lt;ffffffff8142fa46&gt;] dump_stack+0x4f/0x7b
[68663.734334]  [&lt;ffffffff8108b6a2&gt;] ? console_unlock+0x361/0x3ad
[68663.739980]  [&lt;ffffffff81045ea5&gt;] warn_slowpath_common+0xa1/0xbb
[68663.757153]  [&lt;ffffffffa036ca6d&gt;] ? __btrfs_abort_transaction+0x52/0x114 [btrfs]
[68663.760925]  [&lt;ffffffff81045f05&gt;] warn_slowpath_fmt+0x46/0x48
[68663.762854]  [&lt;ffffffffa03b159d&gt;] ? btrfs_update_device+0x15a/0x16c [btrfs]
[68663.764073]  [&lt;ffffffffa036ca6d&gt;] __btrfs_abort_transaction+0x52/0x114 [btrfs]
[68663.765130]  [&lt;ffffffffa03b3638&gt;] btrfs_remove_chunk+0x597/0x5ee [btrfs]
[68663.765998]  [&lt;ffffffffa0384663&gt;] ? btrfs_delete_unused_bgs+0x245/0x296 [btrfs]
[68663.767068]  [&lt;ffffffffa0384676&gt;] btrfs_delete_unused_bgs+0x258/0x296 [btrfs]
[68663.768227]  [&lt;ffffffff8143527f&gt;] ? _raw_spin_unlock_irq+0x2d/0x4c
[68663.769081]  [&lt;ffffffffa038b109&gt;] cleaner_kthread+0x13d/0x16c [btrfs]
[68663.799485]  [&lt;ffffffffa038afcc&gt;] ? btrfs_alloc_root+0x28/0x28 [btrfs]
[68663.809208]  [&lt;ffffffff8105f367&gt;] kthread+0xef/0xf7
[68663.828795]  [&lt;ffffffff810e603f&gt;] ? time_hardirqs_on+0x15/0x28
[68663.844942]  [&lt;ffffffff8105f278&gt;] ? __kthread_parkme+0xad/0xad
[68663.846486]  [&lt;ffffffff81435a88&gt;] ret_from_fork+0x58/0x90
[68663.847760]  [&lt;ffffffff8105f278&gt;] ? __kthread_parkme+0xad/0xad
[68663.849503] ---[ end trace 798477c6d6dbaad6 ]---
[68663.850525] BTRFS: error (device sdc) in btrfs_remove_chunk:2652: errno=-28 No space left

So fix this by verifying that enough space exists in system space_info,
and reserving the space in the chunk block reserve, before attempting to
delete the block group and allocate a new system chunk if we don't have
enough space to perform the necessary updates and delete in the chunk
tree. Like for the block group creation case, we don't error our if we
fail to allocate a new system chunk, since we might end up not needing
it (no node/leaf splits happen during the COW operations and/or we end
up not needing to COW any btree nodes or leafs because they were already
COWed in the current transaction and their writeback didn't start yet).

Signed-off-by: Filipe Manana &lt;fdmanana@suse.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</content>
</entry>
<entry>
<title>Btrfs: fix -ENOSPC when finishing block group creation</title>
<updated>2015-06-03T11:03:04+00:00</updated>
<author>
<name>Filipe Manana</name>
<email>fdmanana@suse.com</email>
</author>
<published>2015-05-20T13:01:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=4fbcdf6694544fd9d2aedbc1e73e52b90a4fcc20'/>
<id>urn:sha1:4fbcdf6694544fd9d2aedbc1e73e52b90a4fcc20</id>
<content type='text'>
While creating a block group, we often end up getting ENOSPC while updating
the chunk tree, which leads to a transaction abortion that produces a trace
like the following:

[30670.116368] WARNING: CPU: 4 PID: 20735 at fs/btrfs/super.c:260 __btrfs_abort_transaction+0x52/0x106 [btrfs]()
[30670.117777] BTRFS: Transaction aborted (error -28)
(...)
[30670.163567] Call Trace:
[30670.163906]  [&lt;ffffffff8142fa46&gt;] dump_stack+0x4f/0x7b
[30670.164522]  [&lt;ffffffff8108b6a2&gt;] ? console_unlock+0x361/0x3ad
[30670.165171]  [&lt;ffffffff81045ea5&gt;] warn_slowpath_common+0xa1/0xbb
[30670.166323]  [&lt;ffffffffa035daa7&gt;] ? __btrfs_abort_transaction+0x52/0x106 [btrfs]
[30670.167213]  [&lt;ffffffff81045f05&gt;] warn_slowpath_fmt+0x46/0x48
[30670.167862]  [&lt;ffffffffa035daa7&gt;] __btrfs_abort_transaction+0x52/0x106 [btrfs]
[30670.169116]  [&lt;ffffffffa03743d7&gt;] btrfs_create_pending_block_groups+0x101/0x130 [btrfs]
[30670.170593]  [&lt;ffffffffa038426a&gt;] __btrfs_end_transaction+0x84/0x366 [btrfs]
[30670.171960]  [&lt;ffffffffa038455c&gt;] btrfs_end_transaction+0x10/0x12 [btrfs]
[30670.174649]  [&lt;ffffffffa036eb6b&gt;] btrfs_check_data_free_space+0x11f/0x27c [btrfs]
[30670.176092]  [&lt;ffffffffa039450d&gt;] btrfs_fallocate+0x7c8/0xb96 [btrfs]
[30670.177218]  [&lt;ffffffff812459f2&gt;] ? __this_cpu_preempt_check+0x13/0x15
[30670.178622]  [&lt;ffffffff81152447&gt;] vfs_fallocate+0x14c/0x1de
[30670.179642]  [&lt;ffffffff8116b915&gt;] ? __fget_light+0x2d/0x4f
[30670.180692]  [&lt;ffffffff81152863&gt;] SyS_fallocate+0x47/0x62
[30670.186737]  [&lt;ffffffff81435b32&gt;] system_call_fastpath+0x12/0x17
[30670.187792] ---[ end trace 0373e6b491c4a8cc ]---

This is because we don't do proper space reservation for the chunk block
reserve when we have multiple tasks allocating chunks in parallel.

So block group creation has 2 phases, and the first phase essentially
checks if there is enough space in the system space_info, allocating a
new system chunk if there isn't, while the second phase updates the
device, extent and chunk trees. However, because the updates to the
chunk tree happen in the second phase, if we have N tasks, each with
its own transaction handle, allocating new chunks in parallel and if
there is only enough space in the system space_info to allocate M chunks,
where M &lt; N, none of the tasks ends up allocating a new system chunk in
the first phase and N - M tasks will get -ENOSPC when attempting to
update the chunk tree in phase 2 if they need to COW any nodes/leafs
from the chunk tree.

Fix this by doing proper reservation in the chunk block reserve.

The issue could be reproduced by running fstests generic/038 in a loop,
which eventually triggered the problem.

Signed-off-by: Filipe Manana &lt;fdmanana@suse.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</content>
</entry>
<entry>
<title>btrfs: Fix superblock csum type check.</title>
<updated>2015-06-03T02:34:35+00:00</updated>
<author>
<name>Qu Wenruo</name>
<email>quwenruo@cn.fujitsu.com</email>
</author>
<published>2015-05-05T02:53:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=1f6e4b3f9f7c859fed7ac4c0853e976a1a752873'/>
<id>urn:sha1:1f6e4b3f9f7c859fed7ac4c0853e976a1a752873</id>
<content type='text'>
Old csum type check is wrong and can't catch csum_type 1(not supported).

Fix it to avoid hostile 0 division.

Reported-by: Lukas Lueg &lt;lukas.lueg@gmail.com&gt;
Signed-off-by: Qu Wenruo &lt;quwenruo@cn.fujitsu.com&gt;
Reviewed-by: David Sterba &lt;dsterba@suse.cz&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</content>
</entry>
<entry>
<title>btrfs: add 'cold' compiler annotations to all error handling functions</title>
<updated>2015-06-03T02:34:34+00:00</updated>
<author>
<name>David Sterba</name>
<email>dsterba@suse.cz</email>
</author>
<published>2015-04-24T17:11:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=c0d19e2b9a521bbdc33049ad92c94b517afda1f0'/>
<id>urn:sha1:c0d19e2b9a521bbdc33049ad92c94b517afda1f0</id>
<content type='text'>
The annotated functios will be placed into .text.unlikely section. The
annotation also hints compiler to move the code out of the hot paths,
and may implicitly mark if-statement leading to that block as unlikely.

This is a heuristic, the impact on the generated code is not
significant.

Signed-off-by: David Sterba &lt;dsterba@suse.cz&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</content>
</entry>
<entry>
<title>btrfs: report exact callsite where transaction abort occurs</title>
<updated>2015-06-03T02:34:34+00:00</updated>
<author>
<name>David Sterba</name>
<email>dsterba@suse.cz</email>
</author>
<published>2015-04-24T17:11:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=1a9a8a71ed1d457d4f03284ebfd3e40fe1e217ac'/>
<id>urn:sha1:1a9a8a71ed1d457d4f03284ebfd3e40fe1e217ac</id>
<content type='text'>
WARN is called from a single location and all bugreports say that's in
super.c __btrfs_abort_transaction. This is slightly confusing as we'd
rather want to know the exact callsite. Whereas this information is
printed in the syslog below the stacktrace, this requires further look
and we usually see only the headline from WARNING.

Moving the WARN into the macro has to inline some code and increases
code by a few kilobytes:

  text    data     bss     dec     hex filename
835481   20305   14120  869906   d4612 btrfs.ko.before
842883   20305   14120  877308   d62fc btrfs.ko.after

The delta is +7k (130+ calls), measured on 3.19 x86_64, distro config.
The increase is not small and could lead to worse icache use. The code
is on error/exit paths that can be recognized by compiler as cold and
moved out of the way so the impact is speculated to be low, if
measurable at all.

Signed-off-by: David Sterba &lt;dsterba@suse.cz&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</content>
</entry>
</feed>
