<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/fs, branch v4.0.6</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>Btrfs: fix regression in raid level conversion</title>
<updated>2015-06-23T00:03:37+00:00</updated>
<author>
<name>Chris Mason</name>
<email>clm@fb.com</email>
</author>
<published>2015-05-20T01:54:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=e8b62da46bb19a5e9e72de77dc36c1d5c5c50ab1'/>
<id>e8b62da46bb19a5e9e72de77dc36c1d5c5c50ab1</id>
<content type='text'>
commit 153c35b6cccc0c72de9fae06c8e2c8b2c47d79d4 upstream.

Commit 2f0810880f082fa8ba66ab2c33b02e4ff9770a5e changed
btrfs_set_block_group_ro to avoid trying to allocate new chunks with the
new raid profile during conversion.  This fixed failures when there was
no space on the drive to allocate a new chunk, but the metadata
reserves were sufficient to continue the conversion.

But this ended up causing a regression when the drive had plenty of
space to allocate new chunks, mostly because reduce_alloc_profile isn't
using the new raid profile.

Fixing btrfs_reduce_alloc_profile is a bigger patch.  For now, do a
partial revert of 2f0810880, and don't error out if we hit ENOSPC.

Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
Tested-by: Dave Sterba &lt;dsterba@suse.cz&gt;
Reported-by: Holger Hoffstaette &lt;holger.hoffstaette@googlemail.com&gt;
[adapted for stable kernel branch, v4.0.5]
Signed-off-by: David Sterba &lt;dsterba@suse.cz&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 153c35b6cccc0c72de9fae06c8e2c8b2c47d79d4 upstream.

Commit 2f0810880f082fa8ba66ab2c33b02e4ff9770a5e changed
btrfs_set_block_group_ro to avoid trying to allocate new chunks with the
new raid profile during conversion.  This fixed failures when there was
no space on the drive to allocate a new chunk, but the metadata
reserves were sufficient to continue the conversion.

But this ended up causing a regression when the drive had plenty of
space to allocate new chunks, mostly because reduce_alloc_profile isn't
using the new raid profile.

Fixing btrfs_reduce_alloc_profile is a bigger patch.  For now, do a
partial revert of 2f0810880, and don't error out if we hit ENOSPC.

Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
Tested-by: Dave Sterba &lt;dsterba@suse.cz&gt;
Reported-by: Holger Hoffstaette &lt;holger.hoffstaette@googlemail.com&gt;
[adapted for stable kernel branch, v4.0.5]
Signed-off-by: David Sterba &lt;dsterba@suse.cz&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Btrfs: fix uninit variable in clone ioctl</title>
<updated>2015-06-23T00:03:37+00:00</updated>
<author>
<name>Chris Mason</name>
<email>clm@fb.com</email>
</author>
<published>2015-04-11T12:09:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=1e24644ae5af0b11a9153c0b6d981c215d7c3585'/>
<id>1e24644ae5af0b11a9153c0b6d981c215d7c3585</id>
<content type='text'>
commit de249e66a73d696666281cd812087979c6fae552 upstream.

Commit 0d97a64e0 creates a new variable but doesn't always set it up.
This puts it back to the original method (key.offset + 1) for the cases
not covered by Filipe's new logic.

Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit de249e66a73d696666281cd812087979c6fae552 upstream.

Commit 0d97a64e0 creates a new variable but doesn't always set it up.
This puts it back to the original method (key.offset + 1) for the cases
not covered by Filipe's new logic.

Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>Btrfs: fix range cloning when same inode used as source and destination</title>
<updated>2015-06-23T00:03:36+00:00</updated>
<author>
<name>Filipe Manana</name>
<email>fdmanana@suse.com</email>
</author>
<published>2015-03-31T13:56:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=64b02777ad421be063075f483aa50ec54e729333'/>
<id>64b02777ad421be063075f483aa50ec54e729333</id>
<content type='text'>
commit df858e76723ace61342b118aa4302bd09de4e386 upstream.

While searching for extents to clone we might find one where we only use
a part of it coming from its tail. If our destination inode is the same
the source inode, we end up removing the tail part of the extent item and
insert after a new one that point to the same extent with an adjusted
key file offset and data offset. After this we search for the next extent
item in the fs/subvol tree with a key that has an offset incremented by
one. But this second search leaves us at the new extent item we inserted
previously, and since that extent item has a non-zero data offset, it
it can make us call btrfs_drop_extents with an empty range (start == end)
which causes the following warning:

[23978.537119] WARNING: CPU: 6 PID: 16251 at fs/btrfs/file.c:550 btrfs_drop_extent_cache+0x43/0x385 [btrfs]()
(...)
[23978.557266] Call Trace:
[23978.557978]  [&lt;ffffffff81425fd9&gt;] dump_stack+0x4c/0x65
[23978.559191]  [&lt;ffffffff81045390&gt;] warn_slowpath_common+0xa1/0xbb
[23978.560699]  [&lt;ffffffffa047f0ea&gt;] ? btrfs_drop_extent_cache+0x43/0x385 [btrfs]
[23978.562389]  [&lt;ffffffff8104544d&gt;] warn_slowpath_null+0x1a/0x1c
[23978.563613]  [&lt;ffffffffa047f0ea&gt;] btrfs_drop_extent_cache+0x43/0x385 [btrfs]
[23978.565103]  [&lt;ffffffff810e3a18&gt;] ? time_hardirqs_off+0x15/0x28
[23978.566294]  [&lt;ffffffff81079ff8&gt;] ? trace_hardirqs_off+0xd/0xf
[23978.567438]  [&lt;ffffffffa047f73d&gt;] __btrfs_drop_extents+0x6b/0x9e1 [btrfs]
[23978.568702]  [&lt;ffffffff8107c03f&gt;] ? trace_hardirqs_on+0xd/0xf
[23978.569763]  [&lt;ffffffff811441c0&gt;] ? ____cache_alloc+0x69/0x2eb
[23978.570817]  [&lt;ffffffff81142269&gt;] ? virt_to_head_page+0x9/0x36
[23978.571872]  [&lt;ffffffff81143c15&gt;] ? cache_alloc_debugcheck_after.isra.42+0x16c/0x1cb
[23978.573466]  [&lt;ffffffff811420d5&gt;] ? kmemleak_alloc_recursive.constprop.52+0x16/0x18
[23978.574962]  [&lt;ffffffffa0480d07&gt;] btrfs_drop_extents+0x66/0x7f [btrfs]
[23978.576179]  [&lt;ffffffffa049aa35&gt;] btrfs_clone+0x516/0xaf5 [btrfs]
[23978.577311]  [&lt;ffffffffa04983dc&gt;] ? lock_extent_range+0x7b/0xcd [btrfs]
[23978.578520]  [&lt;ffffffffa049b2a2&gt;] btrfs_ioctl_clone+0x28e/0x39f [btrfs]
[23978.580282]  [&lt;ffffffffa049d9ae&gt;] btrfs_ioctl+0xb51/0x219a [btrfs]
(...)
[23978.591887] ---[ end trace 988ec2a653d03ed3 ]---

Then we attempt to insert a new extent item with a key that already
exists, which makes btrfs_insert_empty_item return -EEXIST resulting in
abortion of the current transaction:

[23978.594355] WARNING: CPU: 6 PID: 16251 at fs/btrfs/super.c:260 __btrfs_abort_transaction+0x52/0x114 [btrfs]()
(...)
[23978.622589] Call Trace:
[23978.623181]  [&lt;ffffffff81425fd9&gt;] dump_stack+0x4c/0x65
[23978.624359]  [&lt;ffffffff81045390&gt;] warn_slowpath_common+0xa1/0xbb
[23978.625573]  [&lt;ffffffffa044ab6c&gt;] ? __btrfs_abort_transaction+0x52/0x114 [btrfs]
[23978.626971]  [&lt;ffffffff810453f0&gt;] warn_slowpath_fmt+0x46/0x48
[23978.628003]  [&lt;ffffffff8108a6c8&gt;] ? vprintk_default+0x1d/0x1f
[23978.629138]  [&lt;ffffffffa044ab6c&gt;] __btrfs_abort_transaction+0x52/0x114 [btrfs]
[23978.630528]  [&lt;ffffffffa049ad1b&gt;] btrfs_clone+0x7fc/0xaf5 [btrfs]
[23978.631635]  [&lt;ffffffffa04983dc&gt;] ? lock_extent_range+0x7b/0xcd [btrfs]
[23978.632886]  [&lt;ffffffffa049b2a2&gt;] btrfs_ioctl_clone+0x28e/0x39f [btrfs]
[23978.634119]  [&lt;ffffffffa049d9ae&gt;] btrfs_ioctl+0xb51/0x219a [btrfs]
(...)
[23978.647714] ---[ end trace 988ec2a653d03ed4 ]---

This is wrong because we should not process the extent item that we just
inserted previously, and instead process the extent item that follows it
in the tree

For example for the test case I wrote for fstests:

   bs=$((64 * 1024))
   mkfs.btrfs -f -l $bs -O ^no-holes /dev/sdc
   mount /dev/sdc /mnt

   xfs_io -f -c "pwrite -S 0xaa $(($bs * 2)) $(($bs * 2))" /mnt/foo

   $CLONER_PROG -s $((3 * $bs)) -d $((267 * $bs)) -l 0 /mnt/foo /mnt/foo
   $CLONER_PROG -s $((217 * $bs)) -d $((95 * $bs)) -l 0 /mnt/foo /mnt/foo

The second clone call fails with -EEXIST, because when we process the
first extent item (offset 262144), we drop part of it (counting from the
end) and then insert a new extent item with a key greater then the key we
found. The next time we search the tree we search for a key with offset
262144 + 1, which leaves us at the new extent item we have just inserted
but we think it refers to an extent that we need to clone.

Fix this by ensuring the next search key uses an offset corresponding to
the offset of the key we found previously plus the data length of the
corresponding extent item. This ensures we skip new extent items that we
inserted and works for the case of implicit holes too (NO_HOLES feature).

A test case for fstests follows soon.

Signed-off-by: Filipe Manana &lt;fdmanana@suse.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit df858e76723ace61342b118aa4302bd09de4e386 upstream.

While searching for extents to clone we might find one where we only use
a part of it coming from its tail. If our destination inode is the same
the source inode, we end up removing the tail part of the extent item and
insert after a new one that point to the same extent with an adjusted
key file offset and data offset. After this we search for the next extent
item in the fs/subvol tree with a key that has an offset incremented by
one. But this second search leaves us at the new extent item we inserted
previously, and since that extent item has a non-zero data offset, it
it can make us call btrfs_drop_extents with an empty range (start == end)
which causes the following warning:

[23978.537119] WARNING: CPU: 6 PID: 16251 at fs/btrfs/file.c:550 btrfs_drop_extent_cache+0x43/0x385 [btrfs]()
(...)
[23978.557266] Call Trace:
[23978.557978]  [&lt;ffffffff81425fd9&gt;] dump_stack+0x4c/0x65
[23978.559191]  [&lt;ffffffff81045390&gt;] warn_slowpath_common+0xa1/0xbb
[23978.560699]  [&lt;ffffffffa047f0ea&gt;] ? btrfs_drop_extent_cache+0x43/0x385 [btrfs]
[23978.562389]  [&lt;ffffffff8104544d&gt;] warn_slowpath_null+0x1a/0x1c
[23978.563613]  [&lt;ffffffffa047f0ea&gt;] btrfs_drop_extent_cache+0x43/0x385 [btrfs]
[23978.565103]  [&lt;ffffffff810e3a18&gt;] ? time_hardirqs_off+0x15/0x28
[23978.566294]  [&lt;ffffffff81079ff8&gt;] ? trace_hardirqs_off+0xd/0xf
[23978.567438]  [&lt;ffffffffa047f73d&gt;] __btrfs_drop_extents+0x6b/0x9e1 [btrfs]
[23978.568702]  [&lt;ffffffff8107c03f&gt;] ? trace_hardirqs_on+0xd/0xf
[23978.569763]  [&lt;ffffffff811441c0&gt;] ? ____cache_alloc+0x69/0x2eb
[23978.570817]  [&lt;ffffffff81142269&gt;] ? virt_to_head_page+0x9/0x36
[23978.571872]  [&lt;ffffffff81143c15&gt;] ? cache_alloc_debugcheck_after.isra.42+0x16c/0x1cb
[23978.573466]  [&lt;ffffffff811420d5&gt;] ? kmemleak_alloc_recursive.constprop.52+0x16/0x18
[23978.574962]  [&lt;ffffffffa0480d07&gt;] btrfs_drop_extents+0x66/0x7f [btrfs]
[23978.576179]  [&lt;ffffffffa049aa35&gt;] btrfs_clone+0x516/0xaf5 [btrfs]
[23978.577311]  [&lt;ffffffffa04983dc&gt;] ? lock_extent_range+0x7b/0xcd [btrfs]
[23978.578520]  [&lt;ffffffffa049b2a2&gt;] btrfs_ioctl_clone+0x28e/0x39f [btrfs]
[23978.580282]  [&lt;ffffffffa049d9ae&gt;] btrfs_ioctl+0xb51/0x219a [btrfs]
(...)
[23978.591887] ---[ end trace 988ec2a653d03ed3 ]---

Then we attempt to insert a new extent item with a key that already
exists, which makes btrfs_insert_empty_item return -EEXIST resulting in
abortion of the current transaction:

[23978.594355] WARNING: CPU: 6 PID: 16251 at fs/btrfs/super.c:260 __btrfs_abort_transaction+0x52/0x114 [btrfs]()
(...)
[23978.622589] Call Trace:
[23978.623181]  [&lt;ffffffff81425fd9&gt;] dump_stack+0x4c/0x65
[23978.624359]  [&lt;ffffffff81045390&gt;] warn_slowpath_common+0xa1/0xbb
[23978.625573]  [&lt;ffffffffa044ab6c&gt;] ? __btrfs_abort_transaction+0x52/0x114 [btrfs]
[23978.626971]  [&lt;ffffffff810453f0&gt;] warn_slowpath_fmt+0x46/0x48
[23978.628003]  [&lt;ffffffff8108a6c8&gt;] ? vprintk_default+0x1d/0x1f
[23978.629138]  [&lt;ffffffffa044ab6c&gt;] __btrfs_abort_transaction+0x52/0x114 [btrfs]
[23978.630528]  [&lt;ffffffffa049ad1b&gt;] btrfs_clone+0x7fc/0xaf5 [btrfs]
[23978.631635]  [&lt;ffffffffa04983dc&gt;] ? lock_extent_range+0x7b/0xcd [btrfs]
[23978.632886]  [&lt;ffffffffa049b2a2&gt;] btrfs_ioctl_clone+0x28e/0x39f [btrfs]
[23978.634119]  [&lt;ffffffffa049d9ae&gt;] btrfs_ioctl+0xb51/0x219a [btrfs]
(...)
[23978.647714] ---[ end trace 988ec2a653d03ed4 ]---

This is wrong because we should not process the extent item that we just
inserted previously, and instead process the extent item that follows it
in the tree

For example for the test case I wrote for fstests:

   bs=$((64 * 1024))
   mkfs.btrfs -f -l $bs -O ^no-holes /dev/sdc
   mount /dev/sdc /mnt

   xfs_io -f -c "pwrite -S 0xaa $(($bs * 2)) $(($bs * 2))" /mnt/foo

   $CLONER_PROG -s $((3 * $bs)) -d $((267 * $bs)) -l 0 /mnt/foo /mnt/foo
   $CLONER_PROG -s $((217 * $bs)) -d $((95 * $bs)) -l 0 /mnt/foo /mnt/foo

The second clone call fails with -EEXIST, because when we process the
first extent item (offset 262144), we drop part of it (counting from the
end) and then insert a new extent item with a key greater then the key we
found. The next time we search the tree we search for a key with offset
262144 + 1, which leaves us at the new extent item we have just inserted
but we think it refers to an extent that we need to clone.

Fix this by ensuring the next search key uses an offset corresponding to
the offset of the key we found previously plus the data length of the
corresponding extent item. This ensures we skip new extent items that we
inserted and works for the case of implicit holes too (NO_HOLES feature).

A test case for fstests follows soon.

Signed-off-by: Filipe Manana &lt;fdmanana@suse.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>btrfs: cleanup orphans while looking up default subvolume</title>
<updated>2015-06-23T00:03:36+00:00</updated>
<author>
<name>Jeff Mahoney</name>
<email>jeffm@suse.com</email>
</author>
<published>2015-03-20T18:02:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=845f2c2fdf8a351d98e8d12371a713a785333982'/>
<id>845f2c2fdf8a351d98e8d12371a713a785333982</id>
<content type='text'>
commit 727b9784b6085c99c2f836bf4fcc2848dc9cf904 upstream.

Orphans in the fs tree are cleaned up via open_ctree and subvolume
orphans are cleaned via btrfs_lookup_dentry -- except when a default
subvolume is in use.  The name for the default subvolume uses a manual
lookup that doesn't trigger orphan cleanup and needs to trigger it
manually as well. This doesn't apply to the remount case since the
subvolumes are cleaned up by walking the root radix tree.

Signed-off-by: Jeff Mahoney &lt;jeffm@suse.com&gt;
Reviewed-by: David Sterba &lt;dsterba@suse.cz&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 727b9784b6085c99c2f836bf4fcc2848dc9cf904 upstream.

Orphans in the fs tree are cleaned up via open_ctree and subvolume
orphans are cleaned via btrfs_lookup_dentry -- except when a default
subvolume is in use.  The name for the default subvolume uses a manual
lookup that doesn't trigger orphan cleanup and needs to trigger it
manually as well. This doesn't apply to the remount case since the
subvolumes are cleaned up by walking the root radix tree.

Signed-off-by: Jeff Mahoney &lt;jeffm@suse.com&gt;
Reviewed-by: David Sterba &lt;dsterba@suse.cz&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>btrfs: incorrect handling for fiemap_fill_next_extent return</title>
<updated>2015-06-23T00:03:36+00:00</updated>
<author>
<name>Chengyu Song</name>
<email>csong84@gatech.edu</email>
</author>
<published>2015-03-24T22:12:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=2c45304d93598f1049e8d4d9bd44218b200befea'/>
<id>2c45304d93598f1049e8d4d9bd44218b200befea</id>
<content type='text'>
commit 26e726afe01c1c82072cf23a5ed89ce25f39d9f2 upstream.

fiemap_fill_next_extent returns 0 on success, -errno on error, 1 if this was
the last extent that will fit in user array. If 1 is returned, the return
value may eventually returned to user space, which should not happen, according
to manpage of ioctl.

Signed-off-by: Chengyu Song &lt;csong84@gatech.edu&gt;
Reviewed-by: David Sterba &lt;dsterba@suse.cz&gt;
Reviewed-by: Liu Bo &lt;bo.li.liu@oracle.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 26e726afe01c1c82072cf23a5ed89ce25f39d9f2 upstream.

fiemap_fill_next_extent returns 0 on success, -errno on error, 1 if this was
the last extent that will fit in user array. If 1 is returned, the return
value may eventually returned to user space, which should not happen, according
to manpage of ioctl.

Signed-off-by: Chengyu Song &lt;csong84@gatech.edu&gt;
Reviewed-by: David Sterba &lt;dsterba@suse.cz&gt;
Reviewed-by: Liu Bo &lt;bo.li.liu@oracle.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>Btrfs: send, don't leave without decrementing clone root's send_progress</title>
<updated>2015-06-23T00:03:36+00:00</updated>
<author>
<name>Filipe Manana</name>
<email>fdmanana@suse.com</email>
</author>
<published>2015-03-02T20:53:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=3a1e1ca1ba46fef415b663b44dae50cf1c0447f0'/>
<id>3a1e1ca1ba46fef415b663b44dae50cf1c0447f0</id>
<content type='text'>
commit 2f1f465ae6da244099af55c066e5355abd8ff620 upstream.

If the clone root was not readonly or the dead flag was set on it, we were
leaving without decrementing the root's send_progress counter (and before
we just incremented it). If a concurrent snapshot deletion was in progress
and ended up being aborted, it would be impossible to later attempt to
delete again the snapshot, since the root's send_in_progress counter could
never go back to 0.

We were also setting clone_sources_to_rollback to i + 1 too early - if we
bailed out because the clone root we got is not readonly or flagged as dead
we ended up later derreferencing a null pointer because we didn't assign
the clone root to sctx-&gt;clone_roots[i].root:

		for (i = 0; sctx &amp;&amp; i &lt; clone_sources_to_rollback; i++)
			btrfs_root_dec_send_in_progress(
					sctx-&gt;clone_roots[i].root);

So just don't increment the send_in_progress counter if the root is readonly
or flagged as dead.

Signed-off-by: Filipe Manana &lt;fdmanana@suse.com&gt;
Reviewed-by: David Sterba &lt;dsterba@suse.cz&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 2f1f465ae6da244099af55c066e5355abd8ff620 upstream.

If the clone root was not readonly or the dead flag was set on it, we were
leaving without decrementing the root's send_progress counter (and before
we just incremented it). If a concurrent snapshot deletion was in progress
and ended up being aborted, it would be impossible to later attempt to
delete again the snapshot, since the root's send_in_progress counter could
never go back to 0.

We were also setting clone_sources_to_rollback to i + 1 too early - if we
bailed out because the clone root we got is not readonly or flagged as dead
we ended up later derreferencing a null pointer because we didn't assign
the clone root to sctx-&gt;clone_roots[i].root:

		for (i = 0; sctx &amp;&amp; i &lt; clone_sources_to_rollback; i++)
			btrfs_root_dec_send_in_progress(
					sctx-&gt;clone_roots[i].root);

So just don't increment the send_in_progress counter if the root is readonly
or flagged as dead.

Signed-off-by: Filipe Manana &lt;fdmanana@suse.com&gt;
Reviewed-by: David Sterba &lt;dsterba@suse.cz&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>Btrfs: send, add missing check for dead clone root</title>
<updated>2015-06-23T00:03:36+00:00</updated>
<author>
<name>Filipe Manana</name>
<email>fdmanana@suse.com</email>
</author>
<published>2015-03-02T20:53:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=146a4565fa80cb586abcda5575922d5ac71162c9'/>
<id>146a4565fa80cb586abcda5575922d5ac71162c9</id>
<content type='text'>
commit 5cc2b17e80cf5770f2e585c2d90fd8af1b901258 upstream.

After we locked the root's root item, a concurrent snapshot deletion
call might have set the dead flag on it. So check if the dead flag
is set and abort if it is, just like we do for the parent root.

Signed-off-by: Filipe Manana &lt;fdmanana@suse.com&gt;
Reviewed-by: David Sterba &lt;dsterba@suse.cz&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 5cc2b17e80cf5770f2e585c2d90fd8af1b901258 upstream.

After we locked the root's root item, a concurrent snapshot deletion
call might have set the dead flag on it. So check if the dead flag
is set and abort if it is, just like we do for the parent root.

Signed-off-by: Filipe Manana &lt;fdmanana@suse.com&gt;
Reviewed-by: David Sterba &lt;dsterba@suse.cz&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>aio: fix serial draining in exit_aio()</title>
<updated>2015-06-23T00:03:20+00:00</updated>
<author>
<name>Jens Axboe</name>
<email>axboe@fb.com</email>
</author>
<published>2015-04-15T17:17:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=b393b2aa50b3f85cab80fd11de00849917861b93'/>
<id>b393b2aa50b3f85cab80fd11de00849917861b93</id>
<content type='text'>
commit dc48e56d761610da4ea1088d1bea0a030b8e3e43 upstream.

exit_aio() currently serializes killing io contexts. Each context
killing ends up having to do percpu_ref_kill(), which in turns has
to wait for an RCU grace period. This can take a long time, depending
on the number of contexts. And there's no point in doing them serially,
when we could be waiting for all of them in one fell swoop.

This patches makes my fio thread offload test case exit 0.2s instead
of almost 6s.

Reviewed-by: Jeff Moyer &lt;jmoyer@redhat.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit dc48e56d761610da4ea1088d1bea0a030b8e3e43 upstream.

exit_aio() currently serializes killing io contexts. Each context
killing ends up having to do percpu_ref_kill(), which in turns has
to wait for an RCU grace period. This can take a long time, depending
on the number of contexts. And there's no point in doing them serially,
when we could be waiting for all of them in one fell swoop.

This patches makes my fio thread offload test case exit 0.2s instead
of almost 6s.

Reviewed-by: Jeff Moyer &lt;jmoyer@redhat.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>fs/binfmt_elf.c:load_elf_binary(): return -EINVAL on zero-length mappings</title>
<updated>2015-06-06T15:21:09+00:00</updated>
<author>
<name>Andrew Morton</name>
<email>akpm@linux-foundation.org</email>
</author>
<published>2015-05-28T22:44:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=073aba98f6a2235e2ac4a8402b1a131ab032876e'/>
<id>073aba98f6a2235e2ac4a8402b1a131ab032876e</id>
<content type='text'>
commit 2b1d3ae940acd11be44c6eced5873d47c2e00ffa upstream.

load_elf_binary() returns `retval', not `error'.

Fixes: a87938b2e246b81b4fb ("fs/binfmt_elf.c: fix bug in loading of PIE binaries")
Reported-by: James Hogan &lt;james.hogan@imgtec.com&gt;
Cc: Michael Davidson &lt;md@google.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 2b1d3ae940acd11be44c6eced5873d47c2e00ffa upstream.

load_elf_binary() returns `retval', not `error'.

Fixes: a87938b2e246b81b4fb ("fs/binfmt_elf.c: fix bug in loading of PIE binaries")
Reported-by: James Hogan &lt;james.hogan@imgtec.com&gt;
Cc: Michael Davidson &lt;md@google.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>vfs: read file_handle only once in handle_to_path</title>
<updated>2015-06-06T15:21:09+00:00</updated>
<author>
<name>Sasha Levin</name>
<email>sasha.levin@oracle.com</email>
</author>
<published>2015-01-28T20:30:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=d38e166a121b62819e13b32560ef8673c8467535'/>
<id>d38e166a121b62819e13b32560ef8673c8467535</id>
<content type='text'>
commit 161f873b89136eb1e69477c847d5a5033239d9ba upstream.

We used to read file_handle twice.  Once to get the amount of extra
bytes, and once to fetch the entire structure.

This may be problematic since we do size verifications only after the
first read, so if the number of extra bytes changes in userspace between
the first and second calls, we'll have an incoherent view of
file_handle.

Instead, read the constant size once, and copy that over to the final
structure without having to re-read it again.

Signed-off-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
Cc: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 161f873b89136eb1e69477c847d5a5033239d9ba upstream.

We used to read file_handle twice.  Once to get the amount of extra
bytes, and once to fetch the entire structure.

This may be problematic since we do size verifications only after the
first read, so if the number of extra bytes changes in userspace between
the first and second calls, we'll have an incoherent view of
file_handle.

Instead, read the constant size once, and copy that over to the final
structure without having to re-read it again.

Signed-off-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
Cc: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
</feed>
