<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/fs/btrfs, branch v3.19</title>
<subtitle>Linux kernel source tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/'/>
<entry>
<title>Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs</title>
<updated>2015-02-07T19:04:48+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2015-02-07T19:04:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=bdfeb5a10471530dc93098e7b7663628ec951407'/>
<id>bdfeb5a10471530dc93098e7b7663628ec951407</id>
<content type='text'>
Pull btrfs fix from Chris Mason:
 "Forrest Liu tracked down a missing blk_finish_plug in the btrfs
  logging code.  This isn't a new bug, and it's hard to hit.  But, it's
  safe enough for inclusion now, and in my for-linus branch"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
  Btrfs: add missing blk_finish_plug in btrfs_sync_log()
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Pull btrfs fix from Chris Mason:
 "Forrest Liu tracked down a missing blk_finish_plug in the btrfs
  logging code.  This isn't a new bug, and it's hard to hit.  But, it's
  safe enough for inclusion now, and in my for-linus branch"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
  Btrfs: add missing blk_finish_plug in btrfs_sync_log()
</pre>
</div>
</content>
</entry>
<entry>
<title>Btrfs: add missing blk_finish_plug in btrfs_sync_log()</title>
<updated>2015-02-05T02:02:37+00:00</updated>
<author>
<name>Forrest Liu</name>
<email>forrestl@synology.com</email>
</author>
<published>2015-01-30T11:42:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=3da5ab56482f322a9736c484db8773899c5c731b'/>
<id>3da5ab56482f322a9736c484db8773899c5c731b</id>
<content type='text'>
Add missing blk_finish_plug in btrfs_sync_log()

Signed-off-by: Forrest Liu &lt;forrestl@synology.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>
Add missing blk_finish_plug in btrfs_sync_log()

Signed-off-by: Forrest Liu &lt;forrestl@synology.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>
<entry>
<title>Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs</title>
<updated>2015-01-30T22:25:52+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2015-01-30T22:25:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=bc208e0ee0f46744aac95c29366144271a6962bb'/>
<id>bc208e0ee0f46744aac95c29366144271a6962bb</id>
<content type='text'>
Pull btrfs fix from Chris Mason:
 "We have one more fix for btrfs in my for-linus branch - this was a bug
  in the new raid5/6 scrubbing support"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
  btrfs: fix raid56 scrub failed in xfstests btrfs/072
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Pull btrfs fix from Chris Mason:
 "We have one more fix for btrfs in my for-linus branch - this was a bug
  in the new raid5/6 scrubbing support"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
  btrfs: fix raid56 scrub failed in xfstests btrfs/072
</pre>
</div>
</content>
</entry>
<entry>
<title>btrfs: fix raid56 scrub failed in xfstests btrfs/072</title>
<updated>2015-01-27T23:26:16+00:00</updated>
<author>
<name>Gui Hecheng</name>
<email>guihc.fnst@cn.fujitsu.com</email>
</author>
<published>2015-01-09T01:39:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=063c54dccdecb0479662778ddf54ee45aa55423d'/>
<id>063c54dccdecb0479662778ddf54ee45aa55423d</id>
<content type='text'>
The xfstests btrfs/072 reports uncorrectable read errors in dmesg,
because scrub forgets to use commit_root for parity scrub routine
and scrub attempts to scrub those extents items whose contents are
not fully on disk.

To fix it, we just add the @search_commit_root flag back.

Signed-off-by: Gui Hecheng &lt;guihc.fnst@cn.fujitsu.com&gt;
Signed-off-by: Qu Wenruo &lt;quwenruo@cn.fujitsu.com&gt;
Reviewed-by: Miao Xie &lt;miaoxie@huawei.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>
The xfstests btrfs/072 reports uncorrectable read errors in dmesg,
because scrub forgets to use commit_root for parity scrub routine
and scrub attempts to scrub those extents items whose contents are
not fully on disk.

To fix it, we just add the @search_commit_root flag back.

Signed-off-by: Gui Hecheng &lt;guihc.fnst@cn.fujitsu.com&gt;
Signed-off-by: Qu Wenruo &lt;quwenruo@cn.fujitsu.com&gt;
Reviewed-by: Miao Xie &lt;miaoxie@huawei.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs</title>
<updated>2015-01-24T02:31:27+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2015-01-24T02:31:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=c4e00f1d31c4c83d15162782491689229bd92527'/>
<id>c4e00f1d31c4c83d15162782491689229bd92527</id>
<content type='text'>
Pull btrfs fixes from Chris Mason:
 "We have a few fixes in my for-linus branch.

  Qu Wenruo's batch fix a regression between some our merge window pull
  and the inode_cache feature.  The rest are smaller bugs"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
  btrfs: Don't call btrfs_start_transaction() on frozen fs to avoid deadlock.
  btrfs: Fix the bug that fs_info-&gt;pending_changes is never cleared.
  btrfs: fix state-&gt;private cast on 32 bit machines
  Btrfs: fix race deleting block group from space_info-&gt;ro_bgs list
  Btrfs: fix incorrect freeing in scrub_stripe
  btrfs: sync ioctl, handle errors after transaction start
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Pull btrfs fixes from Chris Mason:
 "We have a few fixes in my for-linus branch.

  Qu Wenruo's batch fix a regression between some our merge window pull
  and the inode_cache feature.  The rest are smaller bugs"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
  btrfs: Don't call btrfs_start_transaction() on frozen fs to avoid deadlock.
  btrfs: Fix the bug that fs_info-&gt;pending_changes is never cleared.
  btrfs: fix state-&gt;private cast on 32 bit machines
  Btrfs: fix race deleting block group from space_info-&gt;ro_bgs list
  Btrfs: fix incorrect freeing in scrub_stripe
  btrfs: sync ioctl, handle errors after transaction start
</pre>
</div>
</content>
</entry>
<entry>
<title>btrfs: Don't call btrfs_start_transaction() on frozen fs to avoid deadlock.</title>
<updated>2015-01-21T01:20:21+00:00</updated>
<author>
<name>Qu Wenruo</name>
<email>quwenruo@cn.fujitsu.com</email>
</author>
<published>2015-01-19T07:42:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=a53f4f8e9c8ebe6c9ee3b34c368913aae9876e22'/>
<id>a53f4f8e9c8ebe6c9ee3b34c368913aae9876e22</id>
<content type='text'>
Commit 6b5fe46dfa52 (btrfs: do commit in sync_fs if there are pending
changes) will call btrfs_start_transaction() in sync_fs(), to handle
some operations needed to be done in next transaction.

However this can cause deadlock if the filesystem is frozen, with the
following sys_r+w output:
[  143.255932] Call Trace:
[  143.255936]  [&lt;ffffffff816c0e09&gt;] schedule+0x29/0x70
[  143.255939]  [&lt;ffffffff811cb7f3&gt;] __sb_start_write+0xb3/0x100
[  143.255971]  [&lt;ffffffffa040ec06&gt;] start_transaction+0x2e6/0x5a0
[btrfs]
[  143.255992]  [&lt;ffffffffa040f1eb&gt;] btrfs_start_transaction+0x1b/0x20
[btrfs]
[  143.256003]  [&lt;ffffffffa03dc0ba&gt;] btrfs_sync_fs+0xca/0xd0 [btrfs]
[  143.256007]  [&lt;ffffffff811f7be0&gt;] sync_fs_one_sb+0x20/0x30
[  143.256011]  [&lt;ffffffff811cbd01&gt;] iterate_supers+0xe1/0xf0
[  143.256014]  [&lt;ffffffff811f7d75&gt;] sys_sync+0x55/0x90
[  143.256017]  [&lt;ffffffff816c49d2&gt;] system_call_fastpath+0x12/0x17
[  143.256111] Call Trace:
[  143.256114]  [&lt;ffffffff816c0e09&gt;] schedule+0x29/0x70
[  143.256119]  [&lt;ffffffff816c3405&gt;] rwsem_down_write_failed+0x1c5/0x2d0
[  143.256123]  [&lt;ffffffff8133f013&gt;] call_rwsem_down_write_failed+0x13/0x20
[  143.256131]  [&lt;ffffffff811caae8&gt;] thaw_super+0x28/0xc0
[  143.256135]  [&lt;ffffffff811db3e5&gt;] do_vfs_ioctl+0x3f5/0x540
[  143.256187]  [&lt;ffffffff811db5c1&gt;] SyS_ioctl+0x91/0xb0
[  143.256213]  [&lt;ffffffff816c49d2&gt;] system_call_fastpath+0x12/0x17

The reason is like the following:
(Holding s_umount)
VFS sync_fs staff:
|- btrfs_sync_fs()
   |- btrfs_start_transaction()
      |- sb_start_intwrite()
      (Waiting thaw_fs to unfreeze)
					VFS thaw_fs staff:
					thaw_fs()
					(Waiting sync_fs to release
					 s_umount)

So deadlock happens.
This can be easily triggered by fstest/generic/068 with inode_cache
mount option.

The fix is to check if the fs is frozen, if the fs is frozen, just
return and waiting for the next transaction.

Cc: David Sterba &lt;dsterba@suse.cz&gt;
Reported-by: Gui Hecheng &lt;guihc.fnst@cn.fujitsu.com&gt;
Signed-off-by: Qu Wenruo &lt;quwenruo@cn.fujitsu.com&gt;
[enhanced comment, changed to SB_FREEZE_WRITE]
Signed-off-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>
Commit 6b5fe46dfa52 (btrfs: do commit in sync_fs if there are pending
changes) will call btrfs_start_transaction() in sync_fs(), to handle
some operations needed to be done in next transaction.

However this can cause deadlock if the filesystem is frozen, with the
following sys_r+w output:
[  143.255932] Call Trace:
[  143.255936]  [&lt;ffffffff816c0e09&gt;] schedule+0x29/0x70
[  143.255939]  [&lt;ffffffff811cb7f3&gt;] __sb_start_write+0xb3/0x100
[  143.255971]  [&lt;ffffffffa040ec06&gt;] start_transaction+0x2e6/0x5a0
[btrfs]
[  143.255992]  [&lt;ffffffffa040f1eb&gt;] btrfs_start_transaction+0x1b/0x20
[btrfs]
[  143.256003]  [&lt;ffffffffa03dc0ba&gt;] btrfs_sync_fs+0xca/0xd0 [btrfs]
[  143.256007]  [&lt;ffffffff811f7be0&gt;] sync_fs_one_sb+0x20/0x30
[  143.256011]  [&lt;ffffffff811cbd01&gt;] iterate_supers+0xe1/0xf0
[  143.256014]  [&lt;ffffffff811f7d75&gt;] sys_sync+0x55/0x90
[  143.256017]  [&lt;ffffffff816c49d2&gt;] system_call_fastpath+0x12/0x17
[  143.256111] Call Trace:
[  143.256114]  [&lt;ffffffff816c0e09&gt;] schedule+0x29/0x70
[  143.256119]  [&lt;ffffffff816c3405&gt;] rwsem_down_write_failed+0x1c5/0x2d0
[  143.256123]  [&lt;ffffffff8133f013&gt;] call_rwsem_down_write_failed+0x13/0x20
[  143.256131]  [&lt;ffffffff811caae8&gt;] thaw_super+0x28/0xc0
[  143.256135]  [&lt;ffffffff811db3e5&gt;] do_vfs_ioctl+0x3f5/0x540
[  143.256187]  [&lt;ffffffff811db5c1&gt;] SyS_ioctl+0x91/0xb0
[  143.256213]  [&lt;ffffffff816c49d2&gt;] system_call_fastpath+0x12/0x17

The reason is like the following:
(Holding s_umount)
VFS sync_fs staff:
|- btrfs_sync_fs()
   |- btrfs_start_transaction()
      |- sb_start_intwrite()
      (Waiting thaw_fs to unfreeze)
					VFS thaw_fs staff:
					thaw_fs()
					(Waiting sync_fs to release
					 s_umount)

So deadlock happens.
This can be easily triggered by fstest/generic/068 with inode_cache
mount option.

The fix is to check if the fs is frozen, if the fs is frozen, just
return and waiting for the next transaction.

Cc: David Sterba &lt;dsterba@suse.cz&gt;
Reported-by: Gui Hecheng &lt;guihc.fnst@cn.fujitsu.com&gt;
Signed-off-by: Qu Wenruo &lt;quwenruo@cn.fujitsu.com&gt;
[enhanced comment, changed to SB_FREEZE_WRITE]
Signed-off-by: David Sterba &lt;dsterba@suse.cz&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>btrfs: Fix the bug that fs_info-&gt;pending_changes is never cleared.</title>
<updated>2015-01-21T01:19:40+00:00</updated>
<author>
<name>Qu Wenruo</name>
<email>quwenruo@cn.fujitsu.com</email>
</author>
<published>2015-01-20T09:05:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=6c9fe14f9d64cc12401a825a60ec5c5723496ca4'/>
<id>6c9fe14f9d64cc12401a825a60ec5c5723496ca4</id>
<content type='text'>
Fs_info-&gt;pending_changes is never cleared since the original code uses
cmpxchg(&amp;fs_info-&gt;pending_changes, 0, 0), which will only clear it if
pending_changes is already 0.

This will cause a lot of problem when mount it with inode_cache mount
option.
If the btrfs is mounted as inode_cache, pending_changes will always be
1, even when the fs is frozen.

Signed-off-by: Qu Wenruo &lt;quwenruo@cn.fujitsu.com&gt;
Reviewed-by: David Sterba &lt;dsterba@suse.cz&gt;
Signed-off-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>
Fs_info-&gt;pending_changes is never cleared since the original code uses
cmpxchg(&amp;fs_info-&gt;pending_changes, 0, 0), which will only clear it if
pending_changes is already 0.

This will cause a lot of problem when mount it with inode_cache mount
option.
If the btrfs is mounted as inode_cache, pending_changes will always be
1, even when the fs is frozen.

Signed-off-by: Qu Wenruo &lt;quwenruo@cn.fujitsu.com&gt;
Reviewed-by: David Sterba &lt;dsterba@suse.cz&gt;
Signed-off-by: David Sterba &lt;dsterba@suse.cz&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>btrfs: fix state-&gt;private cast on 32 bit machines</title>
<updated>2015-01-19T21:06:06+00:00</updated>
<author>
<name>Satoru Takeuchi</name>
<email>takeuchi_satoru@jp.fujitsu.com</email>
</author>
<published>2014-12-25T09:21:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=6e1103a6e9b19dbdc348077d04a546b626911fc5'/>
<id>6e1103a6e9b19dbdc348077d04a546b626911fc5</id>
<content type='text'>
Suppress the following warning displayed on building 32bit (i686) kernel.

===============================================================================
...
   CC [M]  fs/btrfs/extent_io.o
fs/btrfs/extent_io.c: In function ‘btrfs_free_io_failure_record’:
fs/btrfs/extent_io.c:2193:13: warning: cast to pointer from integer of
different size [-Wint-to-pointer-cast]
    failrec = (struct io_failure_record *)state-&gt;private;
...
===============================================================================

Signed-off-by: Satoru Takeuchi &lt;takeuchi_satoru@jp.fujitsu.com&gt;
Reported-by: Chris Murphy &lt;chris@colorremedies.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>
Suppress the following warning displayed on building 32bit (i686) kernel.

===============================================================================
...
   CC [M]  fs/btrfs/extent_io.o
fs/btrfs/extent_io.c: In function ‘btrfs_free_io_failure_record’:
fs/btrfs/extent_io.c:2193:13: warning: cast to pointer from integer of
different size [-Wint-to-pointer-cast]
    failrec = (struct io_failure_record *)state-&gt;private;
...
===============================================================================

Signed-off-by: Satoru Takeuchi &lt;takeuchi_satoru@jp.fujitsu.com&gt;
Reported-by: Chris Murphy &lt;chris@colorremedies.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Btrfs: fix race deleting block group from space_info-&gt;ro_bgs list</title>
<updated>2015-01-19T21:05:45+00:00</updated>
<author>
<name>Filipe Manana</name>
<email>fdmanana@suse.com</email>
</author>
<published>2015-01-16T13:24:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=75c68e9fbbdfc04467c9edcac76be998beaa630b'/>
<id>75c68e9fbbdfc04467c9edcac76be998beaa630b</id>
<content type='text'>
When removing a block group we were deleting it from its space_info's
ro_bgs list without the correct protection - the space info's spinlock.
Fix this by doing the list delete while holding the spinlock of the
corresponding space info, which is the correct lock for any operation
on that list.

This issue was introduced in the 3.19 kernel by the following change:

    Btrfs: move read only block groups onto their own list V2
    commit 633c0aad4c0243a506a3e8590551085ad78af82d

I ran into a kernel crash while a task was running statfs, which iterates
the space_info-&gt;ro_bgs list while holding the space info's spinlock,
and another task was deleting it from the same list, without holding that
spinlock, as part of the block group remove operation (while running the
function btrfs_remove_block_group). This happened often when running the
stress test xfstests/generic/038 I recently made.

Signed-off-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>
When removing a block group we were deleting it from its space_info's
ro_bgs list without the correct protection - the space info's spinlock.
Fix this by doing the list delete while holding the spinlock of the
corresponding space info, which is the correct lock for any operation
on that list.

This issue was introduced in the 3.19 kernel by the following change:

    Btrfs: move read only block groups onto their own list V2
    commit 633c0aad4c0243a506a3e8590551085ad78af82d

I ran into a kernel crash while a task was running statfs, which iterates
the space_info-&gt;ro_bgs list while holding the space info's spinlock,
and another task was deleting it from the same list, without holding that
spinlock, as part of the block group remove operation (while running the
function btrfs_remove_block_group). This happened often when running the
stress test xfstests/generic/038 I recently made.

Signed-off-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 incorrect freeing in scrub_stripe</title>
<updated>2015-01-19T21:05:44+00:00</updated>
<author>
<name>Tsutomu Itoh</name>
<email>t-itoh@jp.fujitsu.com</email>
</author>
<published>2015-01-09T08:37:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=379d6854a2092e38b6e56a8067d922e31461b7e2'/>
<id>379d6854a2092e38b6e56a8067d922e31461b7e2</id>
<content type='text'>
The address that should be freed is not 'ppath' but 'path'.

Signed-off-by: Tsutomu Itoh &lt;t-itoh@jp.fujitsu.com&gt;
Reviewed-by: Miao Xie &lt;miaoxie@huawei.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>
The address that should be freed is not 'ppath' but 'path'.

Signed-off-by: Tsutomu Itoh &lt;t-itoh@jp.fujitsu.com&gt;
Reviewed-by: Miao Xie &lt;miaoxie@huawei.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
