<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/fs/btrfs/relocation.c, branch v4.4</title>
<subtitle>Linux kernel stable tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/'/>
<entry>
<title>Btrfs: fix regression running delayed references when using qgroups</title>
<updated>2015-10-25T19:53:26+00:00</updated>
<author>
<name>Filipe Manana</name>
<email>fdmanana@suse.com</email>
</author>
<published>2015-10-23T06:52:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=b06c4bf5c874a57254b197f53ddf588e7a24a2bf'/>
<id>b06c4bf5c874a57254b197f53ddf588e7a24a2bf</id>
<content type='text'>
In the kernel 4.2 merge window we had a big changes to the implementation
of delayed references and qgroups which made the no_quota field of delayed
references not used anymore. More specifically the no_quota field is not
used anymore as of:

  commit 0ed4792af0e8 ("btrfs: qgroup: Switch to new extent-oriented qgroup mechanism.")

Leaving the no_quota field actually prevents delayed references from
getting merged, which in turn cause the following BUG_ON(), at
fs/btrfs/extent-tree.c, to be hit when qgroups are enabled:

  static int run_delayed_tree_ref(...)
  {
     (...)
     BUG_ON(node-&gt;ref_mod != 1);
     (...)
  }

This happens on a scenario like the following:

  1) Ref1 bytenr X, action = BTRFS_ADD_DELAYED_REF, no_quota = 1, added.

  2) Ref2 bytenr X, action = BTRFS_DROP_DELAYED_REF, no_quota = 0, added.
     It's not merged with Ref1 because Ref1-&gt;no_quota != Ref2-&gt;no_quota.

  3) Ref3 bytenr X, action = BTRFS_ADD_DELAYED_REF, no_quota = 1, added.
     It's not merged with the reference at the tail of the list of refs
     for bytenr X because the reference at the tail, Ref2 is incompatible
     due to Ref2-&gt;no_quota != Ref3-&gt;no_quota.

  4) Ref4 bytenr X, action = BTRFS_DROP_DELAYED_REF, no_quota = 0, added.
     It's not merged with the reference at the tail of the list of refs
     for bytenr X because the reference at the tail, Ref3 is incompatible
     due to Ref3-&gt;no_quota != Ref4-&gt;no_quota.

  5) We run delayed references, trigger merging of delayed references,
     through __btrfs_run_delayed_refs() -&gt; btrfs_merge_delayed_refs().

  6) Ref1 and Ref3 are merged as Ref1-&gt;no_quota = Ref3-&gt;no_quota and
     all other conditions are satisfied too. So Ref1 gets a ref_mod
     value of 2.

  7) Ref2 and Ref4 are merged as Ref2-&gt;no_quota = Ref4-&gt;no_quota and
     all other conditions are satisfied too. So Ref2 gets a ref_mod
     value of 2.

  8) Ref1 and Ref2 aren't merged, because they have different values
     for their no_quota field.

  9) Delayed reference Ref1 is picked for running (select_delayed_ref()
     always prefers references with an action == BTRFS_ADD_DELAYED_REF).
     So run_delayed_tree_ref() is called for Ref1 which triggers the
     BUG_ON because Ref1-&gt;red_mod != 1 (equals 2).

So fix this by removing the no_quota field, as it's not used anymore as
of commit 0ed4792af0e8 ("btrfs: qgroup: Switch to new extent-oriented
qgroup mechanism.").

The use of no_quota was also buggy in at least two places:

1) At delayed-refs.c:btrfs_add_delayed_tree_ref() - we were setting
   no_quota to 0 instead of 1 when the following condition was true:
   is_fstree(ref_root) || !fs_info-&gt;quota_enabled

2) At extent-tree.c:__btrfs_inc_extent_ref() - we were attempting to
   reset a node's no_quota when the condition "!is_fstree(root_objectid)
   || !root-&gt;fs_info-&gt;quota_enabled" was true but we did it only in
   an unused local stack variable, that is, we never reset the no_quota
   value in the node itself.

This fixes the remainder of problems several people have been having when
running delayed references, mostly while a balance is running in parallel,
on a 4.2+ kernel.

Very special thanks to Stéphane Lesimple for helping debugging this issue
and testing this fix on his multi terabyte filesystem (which took more
than one day to balance alone, plus fsck, etc).

Also, this fixes deadlock issue when using the clone ioctl with qgroups
enabled, as reported by Elias Probst in the mailing list. The deadlock
happens because after calling btrfs_insert_empty_item we have our path
holding a write lock on a leaf of the fs/subvol tree and then before
releasing the path we called check_ref() which did backref walking, when
qgroups are enabled, and tried to read lock the same leaf. The trace for
this case is the following:

  INFO: task systemd-nspawn:6095 blocked for more than 120 seconds.
  (...)
  Call Trace:
    [&lt;ffffffff86999201&gt;] schedule+0x74/0x83
    [&lt;ffffffff863ef64c&gt;] btrfs_tree_read_lock+0xc0/0xea
    [&lt;ffffffff86137ed7&gt;] ? wait_woken+0x74/0x74
    [&lt;ffffffff8639f0a7&gt;] btrfs_search_old_slot+0x51a/0x810
    [&lt;ffffffff863a129b&gt;] btrfs_next_old_leaf+0xdf/0x3ce
    [&lt;ffffffff86413a00&gt;] ? ulist_add_merge+0x1b/0x127
    [&lt;ffffffff86411688&gt;] __resolve_indirect_refs+0x62a/0x667
    [&lt;ffffffff863ef546&gt;] ? btrfs_clear_lock_blocking_rw+0x78/0xbe
    [&lt;ffffffff864122d3&gt;] find_parent_nodes+0xaf3/0xfc6
    [&lt;ffffffff86412838&gt;] __btrfs_find_all_roots+0x92/0xf0
    [&lt;ffffffff864128f2&gt;] btrfs_find_all_roots+0x45/0x65
    [&lt;ffffffff8639a75b&gt;] ? btrfs_get_tree_mod_seq+0x2b/0x88
    [&lt;ffffffff863e852e&gt;] check_ref+0x64/0xc4
    [&lt;ffffffff863e9e01&gt;] btrfs_clone+0x66e/0xb5d
    [&lt;ffffffff863ea77f&gt;] btrfs_ioctl_clone+0x48f/0x5bb
    [&lt;ffffffff86048a68&gt;] ? native_sched_clock+0x28/0x77
    [&lt;ffffffff863ed9b0&gt;] btrfs_ioctl+0xabc/0x25cb
  (...)

The problem goes away by eleminating check_ref(), which no longer is
needed as its purpose was to get a value for the no_quota field of
a delayed reference (this patch removes the no_quota field as mentioned
earlier).

Reported-by: Stéphane Lesimple &lt;stephane_btrfs@lesimple.fr&gt;
Tested-by: Stéphane Lesimple &lt;stephane_btrfs@lesimple.fr&gt;
Reported-by: Elias Probst &lt;mail@eliasprobst.eu&gt;
Reported-by: Peter Becker &lt;floyd.net@gmail.com&gt;
Reported-by: Malte Schröder &lt;malte@tnxip.de&gt;
Reported-by: Derek Dongray &lt;derek@valedon.co.uk&gt;
Reported-by: Erkki Seppala &lt;flux-btrfs@inside.org&gt;
Cc: stable@vger.kernel.org  # 4.2+
Signed-off-by: Filipe Manana &lt;fdmanana@suse.com&gt;
Reviewed-by: Qu Wenruo &lt;quwenruo@cn.fujitsu.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In the kernel 4.2 merge window we had a big changes to the implementation
of delayed references and qgroups which made the no_quota field of delayed
references not used anymore. More specifically the no_quota field is not
used anymore as of:

  commit 0ed4792af0e8 ("btrfs: qgroup: Switch to new extent-oriented qgroup mechanism.")

Leaving the no_quota field actually prevents delayed references from
getting merged, which in turn cause the following BUG_ON(), at
fs/btrfs/extent-tree.c, to be hit when qgroups are enabled:

  static int run_delayed_tree_ref(...)
  {
     (...)
     BUG_ON(node-&gt;ref_mod != 1);
     (...)
  }

This happens on a scenario like the following:

  1) Ref1 bytenr X, action = BTRFS_ADD_DELAYED_REF, no_quota = 1, added.

  2) Ref2 bytenr X, action = BTRFS_DROP_DELAYED_REF, no_quota = 0, added.
     It's not merged with Ref1 because Ref1-&gt;no_quota != Ref2-&gt;no_quota.

  3) Ref3 bytenr X, action = BTRFS_ADD_DELAYED_REF, no_quota = 1, added.
     It's not merged with the reference at the tail of the list of refs
     for bytenr X because the reference at the tail, Ref2 is incompatible
     due to Ref2-&gt;no_quota != Ref3-&gt;no_quota.

  4) Ref4 bytenr X, action = BTRFS_DROP_DELAYED_REF, no_quota = 0, added.
     It's not merged with the reference at the tail of the list of refs
     for bytenr X because the reference at the tail, Ref3 is incompatible
     due to Ref3-&gt;no_quota != Ref4-&gt;no_quota.

  5) We run delayed references, trigger merging of delayed references,
     through __btrfs_run_delayed_refs() -&gt; btrfs_merge_delayed_refs().

  6) Ref1 and Ref3 are merged as Ref1-&gt;no_quota = Ref3-&gt;no_quota and
     all other conditions are satisfied too. So Ref1 gets a ref_mod
     value of 2.

  7) Ref2 and Ref4 are merged as Ref2-&gt;no_quota = Ref4-&gt;no_quota and
     all other conditions are satisfied too. So Ref2 gets a ref_mod
     value of 2.

  8) Ref1 and Ref2 aren't merged, because they have different values
     for their no_quota field.

  9) Delayed reference Ref1 is picked for running (select_delayed_ref()
     always prefers references with an action == BTRFS_ADD_DELAYED_REF).
     So run_delayed_tree_ref() is called for Ref1 which triggers the
     BUG_ON because Ref1-&gt;red_mod != 1 (equals 2).

So fix this by removing the no_quota field, as it's not used anymore as
of commit 0ed4792af0e8 ("btrfs: qgroup: Switch to new extent-oriented
qgroup mechanism.").

The use of no_quota was also buggy in at least two places:

1) At delayed-refs.c:btrfs_add_delayed_tree_ref() - we were setting
   no_quota to 0 instead of 1 when the following condition was true:
   is_fstree(ref_root) || !fs_info-&gt;quota_enabled

2) At extent-tree.c:__btrfs_inc_extent_ref() - we were attempting to
   reset a node's no_quota when the condition "!is_fstree(root_objectid)
   || !root-&gt;fs_info-&gt;quota_enabled" was true but we did it only in
   an unused local stack variable, that is, we never reset the no_quota
   value in the node itself.

This fixes the remainder of problems several people have been having when
running delayed references, mostly while a balance is running in parallel,
on a 4.2+ kernel.

Very special thanks to Stéphane Lesimple for helping debugging this issue
and testing this fix on his multi terabyte filesystem (which took more
than one day to balance alone, plus fsck, etc).

Also, this fixes deadlock issue when using the clone ioctl with qgroups
enabled, as reported by Elias Probst in the mailing list. The deadlock
happens because after calling btrfs_insert_empty_item we have our path
holding a write lock on a leaf of the fs/subvol tree and then before
releasing the path we called check_ref() which did backref walking, when
qgroups are enabled, and tried to read lock the same leaf. The trace for
this case is the following:

  INFO: task systemd-nspawn:6095 blocked for more than 120 seconds.
  (...)
  Call Trace:
    [&lt;ffffffff86999201&gt;] schedule+0x74/0x83
    [&lt;ffffffff863ef64c&gt;] btrfs_tree_read_lock+0xc0/0xea
    [&lt;ffffffff86137ed7&gt;] ? wait_woken+0x74/0x74
    [&lt;ffffffff8639f0a7&gt;] btrfs_search_old_slot+0x51a/0x810
    [&lt;ffffffff863a129b&gt;] btrfs_next_old_leaf+0xdf/0x3ce
    [&lt;ffffffff86413a00&gt;] ? ulist_add_merge+0x1b/0x127
    [&lt;ffffffff86411688&gt;] __resolve_indirect_refs+0x62a/0x667
    [&lt;ffffffff863ef546&gt;] ? btrfs_clear_lock_blocking_rw+0x78/0xbe
    [&lt;ffffffff864122d3&gt;] find_parent_nodes+0xaf3/0xfc6
    [&lt;ffffffff86412838&gt;] __btrfs_find_all_roots+0x92/0xf0
    [&lt;ffffffff864128f2&gt;] btrfs_find_all_roots+0x45/0x65
    [&lt;ffffffff8639a75b&gt;] ? btrfs_get_tree_mod_seq+0x2b/0x88
    [&lt;ffffffff863e852e&gt;] check_ref+0x64/0xc4
    [&lt;ffffffff863e9e01&gt;] btrfs_clone+0x66e/0xb5d
    [&lt;ffffffff863ea77f&gt;] btrfs_ioctl_clone+0x48f/0x5bb
    [&lt;ffffffff86048a68&gt;] ? native_sched_clock+0x28/0x77
    [&lt;ffffffff863ed9b0&gt;] btrfs_ioctl+0xabc/0x25cb
  (...)

The problem goes away by eleminating check_ref(), which no longer is
needed as its purpose was to get a value for the no_quota field of
a delayed reference (this patch removes the no_quota field as mentioned
earlier).

Reported-by: Stéphane Lesimple &lt;stephane_btrfs@lesimple.fr&gt;
Tested-by: Stéphane Lesimple &lt;stephane_btrfs@lesimple.fr&gt;
Reported-by: Elias Probst &lt;mail@eliasprobst.eu&gt;
Reported-by: Peter Becker &lt;floyd.net@gmail.com&gt;
Reported-by: Malte Schröder &lt;malte@tnxip.de&gt;
Reported-by: Derek Dongray &lt;derek@valedon.co.uk&gt;
Reported-by: Erkki Seppala &lt;flux-btrfs@inside.org&gt;
Cc: stable@vger.kernel.org  # 4.2+
Signed-off-by: Filipe Manana &lt;fdmanana@suse.com&gt;
Reviewed-by: Qu Wenruo &lt;quwenruo@cn.fujitsu.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>btrfs: qgroup: Cleanup old inaccurate facilities</title>
<updated>2015-10-22T01:41:06+00:00</updated>
<author>
<name>Qu Wenruo</name>
<email>quwenruo@cn.fujitsu.com</email>
</author>
<published>2015-09-08T09:25:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=7cf5b97650f2ecefbd5afa2d58b61b289b6e3750'/>
<id>7cf5b97650f2ecefbd5afa2d58b61b289b6e3750</id>
<content type='text'>
Cleanup the old facilities which use old btrfs_qgroup_reserve() function
call, replace them with the newer version, and remove the "__" prefix in
them.

Also, make btrfs_qgroup_reserve/free() functions private, as they are
now only used inside qgroup codes.

Now, the whole btrfs qgroup is swithed to use the new reserve facilities.

Signed-off-by: Qu Wenruo &lt;quwenruo@cn.fujitsu.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Cleanup the old facilities which use old btrfs_qgroup_reserve() function
call, replace them with the newer version, and remove the "__" prefix in
them.

Also, make btrfs_qgroup_reserve/free() functions private, as they are
now only used inside qgroup codes.

Now, the whole btrfs qgroup is swithed to use the new reserve facilities.

Signed-off-by: Qu Wenruo &lt;quwenruo@cn.fujitsu.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>btrfs: extent-tree: Switch to new check_data_free_space and free_reserved_data_space</title>
<updated>2015-10-22T01:41:04+00:00</updated>
<author>
<name>Qu Wenruo</name>
<email>quwenruo@cn.fujitsu.com</email>
</author>
<published>2015-09-08T09:22:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=d9d8b2a51a404c2d45b9dc4c755f62cb3ddb7c79'/>
<id>d9d8b2a51a404c2d45b9dc4c755f62cb3ddb7c79</id>
<content type='text'>
Use new reserve/free for buffered write and inode cache.

For buffered write case, as nodatacow write won't increase quota account,
so unlike old behavior which does reserve before check nocow, now we
check nocow first and then only reserve data if we can't do nocow write.

Signed-off-by: Qu Wenruo &lt;quwenruo@cn.fujitsu.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Use new reserve/free for buffered write and inode cache.

For buffered write case, as nodatacow write won't increase quota account,
so unlike old behavior which does reserve before check nocow, now we
check nocow first and then only reserve data if we can't do nocow write.

Signed-off-by: Qu Wenruo &lt;quwenruo@cn.fujitsu.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Btrfs: consolidate btrfs_error() to btrfs_std_error()</title>
<updated>2015-09-29T14:30:00+00:00</updated>
<author>
<name>Anand Jain</name>
<email>anand.jain@oracle.com</email>
</author>
<published>2015-09-25T06:43:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=a4553fefb59cb0336f543fa567170b47e90142a9'/>
<id>a4553fefb59cb0336f543fa567170b47e90142a9</id>
<content type='text'>
btrfs_error() and btrfs_std_error() does the same thing
and calls _btrfs_std_error(), so consolidate them together.
And the main motivation is that btrfs_error() is closely
named with btrfs_err(), one handles error action the other
is to log the error, so don't closely name them.

Signed-off-by: Anand Jain &lt;anand.jain@oracle.com&gt;
Suggested-by: David Sterba &lt;dsterba@suse.com&gt;
Reviewed-by: David Sterba &lt;dsterba@suse.com&gt;
Signed-off-by: David Sterba &lt;dsterba@suse.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
btrfs_error() and btrfs_std_error() does the same thing
and calls _btrfs_std_error(), so consolidate them together.
And the main motivation is that btrfs_error() is closely
named with btrfs_err(), one handles error action the other
is to log the error, so don't closely name them.

Signed-off-by: Anand Jain &lt;anand.jain@oracle.com&gt;
Suggested-by: David Sterba &lt;dsterba@suse.com&gt;
Reviewed-by: David Sterba &lt;dsterba@suse.com&gt;
Signed-off-by: David Sterba &lt;dsterba@suse.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>btrfs: Remove unnecessary variants in relocation.c</title>
<updated>2015-08-09T14:07:14+00:00</updated>
<author>
<name>Zhaolei</name>
<email>zhaolei@cn.fujitsu.com</email>
</author>
<published>2015-08-06T12:58:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=147d256e0980e31505d25d721be979d6a8d2148c'/>
<id>147d256e0980e31505d25d721be979d6a8d2148c</id>
<content type='text'>
These arguments are not used in functions, remove them for cleanup
and make kernel stack happy.

Signed-off-by: Zhao Lei &lt;zhaolei@cn.fujitsu.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
These arguments are not used in functions, remove them for cleanup
and make kernel stack happy.

Signed-off-by: Zhao Lei &lt;zhaolei@cn.fujitsu.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>btrfs: Cleanup: Remove objectid's init-value in create_reloc_inode()</title>
<updated>2015-08-09T14:07:13+00:00</updated>
<author>
<name>Zhaolei</name>
<email>zhaolei@cn.fujitsu.com</email>
</author>
<published>2015-08-05T10:00:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=4624900dd353488479a12abf8dffe2c1786cdb89'/>
<id>4624900dd353488479a12abf8dffe2c1786cdb89</id>
<content type='text'>
objectid's init-value is not used in any case, remove it.

Signed-off-by: Zhao Lei &lt;zhaolei@cn.fujitsu.com&gt;
Reviewed-by: David Sterba &lt;dsterba@suse.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
objectid's init-value is not used in any case, remove it.

Signed-off-by: Zhao Lei &lt;zhaolei@cn.fujitsu.com&gt;
Reviewed-by: David Sterba &lt;dsterba@suse.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>btrfs: Error handle for get_ref_objectid_v0() in relocate_block_group()</title>
<updated>2015-08-09T14:07:13+00:00</updated>
<author>
<name>Zhaolei</name>
<email>zhaolei@cn.fujitsu.com</email>
</author>
<published>2015-08-05T10:00:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=4b3576e450a1539492e26e2d7b1e2e69578c032e'/>
<id>4b3576e450a1539492e26e2d7b1e2e69578c032e</id>
<content type='text'>
We need error checking code for get_ref_objectid_v0() in
relocate_block_group(), to avoid unpredictable result, especially
for accessing uninitialized value(when function failed) after
this line.

Signed-off-by: Zhao Lei &lt;zhaolei@cn.fujitsu.com&gt;
Reviewed-by: David Sterba &lt;dsterba@suse.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We need error checking code for get_ref_objectid_v0() in
relocate_block_group(), to avoid unpredictable result, especially
for accessing uninitialized value(when function failed) after
this line.

Signed-off-by: Zhao Lei &lt;zhaolei@cn.fujitsu.com&gt;
Reviewed-by: David Sterba &lt;dsterba@suse.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>btrfs: Use ref_cnt for set_block_group_ro()</title>
<updated>2015-08-09T14:07:12+00:00</updated>
<author>
<name>Zhaolei</name>
<email>zhaolei@cn.fujitsu.com</email>
</author>
<published>2015-08-05T08:43:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=868f401ae38acb439005626c04d575e64c5ae760'/>
<id>868f401ae38acb439005626c04d575e64c5ae760</id>
<content type='text'>
More than one code call set_block_group_ro() and restore rw in fail.

Old code use bool bit to save blockgroup's ro state, it can not
support parallel case(it is confirmd exist in my debug log).

This patch use ref count to store ro state, and rename
set_block_group_ro/set_block_group_rw
to
inc_block_group_ro/dec_block_group_ro.

Signed-off-by: Zhao Lei &lt;zhaolei@cn.fujitsu.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
More than one code call set_block_group_ro() and restore rw in fail.

Old code use bool bit to save blockgroup's ro state, it can not
support parallel case(it is confirmd exist in my debug log).

This patch use ref count to store ro state, and rename
set_block_group_ro/set_block_group_rw
to
inc_block_group_ro/dec_block_group_ro.

Signed-off-by: Zhao Lei &lt;zhaolei@cn.fujitsu.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Btrfs: fix wrong check for btrfs_force_chunk_alloc()</title>
<updated>2015-07-02T00:17:22+00:00</updated>
<author>
<name>Shilong Wang</name>
<email>wangshilong1991@gmail.com</email>
</author>
<published>2015-04-12T06:35:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=9689457b5b0a2b69874c421a489d3fb50ca76b7b'/>
<id>9689457b5b0a2b69874c421a489d3fb50ca76b7b</id>
<content type='text'>
btrfs_force_chunk_alloc() return 1 for allocation chunk successfully.
This problem exists since commit c87f08ca4.

With this patch, we might fix some enospc problems for balances.

Signed-off-by: Wang Shilong &lt;wangshilong1991@gmail.com&gt;
Reviewed-by: Filipe Manana &lt;fdmanana@suse.com&gt;
Tested-by: Filipe Manana &lt;fdmanana@suse.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
btrfs_force_chunk_alloc() return 1 for allocation chunk successfully.
This problem exists since commit c87f08ca4.

With this patch, we might fix some enospc problems for balances.

Signed-off-by: Wang Shilong &lt;wangshilong1991@gmail.com&gt;
Reviewed-by: Filipe Manana &lt;fdmanana@suse.com&gt;
Tested-by: Filipe Manana &lt;fdmanana@suse.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Btrfs: fix up read_tree_block to return proper error</title>
<updated>2015-06-03T11:03:08+00:00</updated>
<author>
<name>Liu Bo</name>
<email>bo.li.liu@oracle.com</email>
</author>
<published>2015-05-25T09:30:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=64c043de466d5746e7ca306dab9d418cd871cefc'/>
<id>64c043de466d5746e7ca306dab9d418cd871cefc</id>
<content type='text'>
The return value of read_tree_block() can confuse callers as it always
returns NULL for either -ENOMEM or -EIO, so it's likely that callers
parse it to a wrong error, for instance, in btrfs_read_tree_root().

This fixes the above issue.

Signed-off-by: Liu Bo &lt;bo.li.liu@oracle.com&gt;
Reviewed-by: David Sterba &lt;dsterba@suse.cz&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The return value of read_tree_block() can confuse callers as it always
returns NULL for either -ENOMEM or -EIO, so it's likely that callers
parse it to a wrong error, for instance, in btrfs_read_tree_root().

This fixes the above issue.

Signed-off-by: Liu Bo &lt;bo.li.liu@oracle.com&gt;
Reviewed-by: David Sterba &lt;dsterba@suse.cz&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
