<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/fs, branch v3.2.61</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 double free in find_lock_delalloc_range</title>
<updated>2014-07-11T12:33:48+00:00</updated>
<author>
<name>Chris Mason</name>
<email>clm@fb.com</email>
</author>
<published>2014-05-21T12:49:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=232270aa2ac2e463afd41cd38665ddb275277d79'/>
<id>232270aa2ac2e463afd41cd38665ddb275277d79</id>
<content type='text'>
commit 7d78874273463a784759916fc3e0b4e2eb141c70 upstream.

We need to NULL the cached_state after freeing it, otherwise
we might free it again if find_delalloc_range doesn't find anything.

Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 7d78874273463a784759916fc3e0b4e2eb141c70 upstream.

We need to NULL the cached_state after freeing it, otherwise
we might free it again if find_delalloc_range doesn't find anything.

Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>nfsd4: fix FREE_STATEID lockowner leak</title>
<updated>2014-07-11T12:33:48+00:00</updated>
<author>
<name>J. Bruce Fields</name>
<email>bfields@redhat.com</email>
</author>
<published>2014-05-27T15:14:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=858454485f3794190a6dcffcd1866cc21a952fd1'/>
<id>858454485f3794190a6dcffcd1866cc21a952fd1</id>
<content type='text'>
commit 48385408b45523d9a432c66292d47ef43efcbb94 upstream.

27b11428b7de ("nfsd4: remove lockowner when removing lock stateid")
introduced a memory leak.

Reported-by: Jeff Layton &lt;jeff.layton@primarydata.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 48385408b45523d9a432c66292d47ef43efcbb94 upstream.

27b11428b7de ("nfsd4: remove lockowner when removing lock stateid")
introduced a memory leak.

Reported-by: Jeff Layton &lt;jeff.layton@primarydata.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>nfsd4: use recall_lock for delegation hashing</title>
<updated>2014-07-11T12:33:46+00:00</updated>
<author>
<name>Benny Halevy</name>
<email>bhalevy@primarydata.com</email>
</author>
<published>2014-05-30T13:09:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=ba1ef838a9e275933683edbd08b6e2226f16e351'/>
<id>ba1ef838a9e275933683edbd08b6e2226f16e351</id>
<content type='text'>
commit 931ee56c67573eb4e51c8a4e78598d965b8b059e upstream.

This fixes a bug in the handling of the fi_delegations list.

nfs4_setlease does not hold the recall_lock when adding to it. The
client_mutex is held, which prevents against concurrent list changes,
but nfsd_break_deleg_cb does not hold while walking it. New delegations
could theoretically creep onto the list while we're walking it there.

Signed-off-by: Benny Halevy &lt;bhalevy@primarydata.com&gt;
Signed-off-by: Jeff Layton &lt;jlayton@primarydata.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
[bwh: Backported to 3.2:
 - Adjust context
 - Also remove a list_del_init() in nfs4_setlease() which would now be
   before the corresponding list_add()
 - Drop change to nfsd_find_all_delegations(), which doesn't exist]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 931ee56c67573eb4e51c8a4e78598d965b8b059e upstream.

This fixes a bug in the handling of the fi_delegations list.

nfs4_setlease does not hold the recall_lock when adding to it. The
client_mutex is held, which prevents against concurrent list changes,
but nfsd_break_deleg_cb does not hold while walking it. New delegations
could theoretically creep onto the list while we're walking it there.

Signed-off-by: Benny Halevy &lt;bhalevy@primarydata.com&gt;
Signed-off-by: Jeff Layton &lt;jlayton@primarydata.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
[bwh: Backported to 3.2:
 - Adjust context
 - Also remove a list_del_init() in nfs4_setlease() which would now be
   before the corresponding list_add()
 - Drop change to nfsd_find_all_delegations(), which doesn't exist]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>UBIFS: Remove incorrect assertion in shrink_tnc()</title>
<updated>2014-07-11T12:33:45+00:00</updated>
<author>
<name>hujianyang</name>
<email>hujianyang@huawei.com</email>
</author>
<published>2014-05-31T03:39:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=a1c97ac5c17df2a74c711b87849044ed2bce6949'/>
<id>a1c97ac5c17df2a74c711b87849044ed2bce6949</id>
<content type='text'>
commit 72abc8f4b4e8574318189886de627a2bfe6cd0da upstream.

I hit the same assert failed as Dolev Raviv reported in Kernel v3.10
shows like this:

[ 9641.164028] UBIFS assert failed in shrink_tnc at 131 (pid 13297)
[ 9641.234078] CPU: 1 PID: 13297 Comm: mmap.test Tainted: G           O 3.10.40 #1
[ 9641.234116] [&lt;c0011a6c&gt;] (unwind_backtrace+0x0/0x12c) from [&lt;c000d0b0&gt;] (show_stack+0x20/0x24)
[ 9641.234137] [&lt;c000d0b0&gt;] (show_stack+0x20/0x24) from [&lt;c0311134&gt;] (dump_stack+0x20/0x28)
[ 9641.234188] [&lt;c0311134&gt;] (dump_stack+0x20/0x28) from [&lt;bf22425c&gt;] (shrink_tnc_trees+0x25c/0x350 [ubifs])
[ 9641.234265] [&lt;bf22425c&gt;] (shrink_tnc_trees+0x25c/0x350 [ubifs]) from [&lt;bf2245ac&gt;] (ubifs_shrinker+0x25c/0x310 [ubifs])
[ 9641.234307] [&lt;bf2245ac&gt;] (ubifs_shrinker+0x25c/0x310 [ubifs]) from [&lt;c00cdad8&gt;] (shrink_slab+0x1d4/0x2f8)
[ 9641.234327] [&lt;c00cdad8&gt;] (shrink_slab+0x1d4/0x2f8) from [&lt;c00d03d0&gt;] (do_try_to_free_pages+0x300/0x544)
[ 9641.234344] [&lt;c00d03d0&gt;] (do_try_to_free_pages+0x300/0x544) from [&lt;c00d0a44&gt;] (try_to_free_pages+0x2d0/0x398)
[ 9641.234363] [&lt;c00d0a44&gt;] (try_to_free_pages+0x2d0/0x398) from [&lt;c00c6a60&gt;] (__alloc_pages_nodemask+0x494/0x7e8)
[ 9641.234382] [&lt;c00c6a60&gt;] (__alloc_pages_nodemask+0x494/0x7e8) from [&lt;c00f62d8&gt;] (new_slab+0x78/0x238)
[ 9641.234400] [&lt;c00f62d8&gt;] (new_slab+0x78/0x238) from [&lt;c031081c&gt;] (__slab_alloc.constprop.42+0x1a4/0x50c)
[ 9641.234419] [&lt;c031081c&gt;] (__slab_alloc.constprop.42+0x1a4/0x50c) from [&lt;c00f80e8&gt;] (kmem_cache_alloc_trace+0x54/0x188)
[ 9641.234459] [&lt;c00f80e8&gt;] (kmem_cache_alloc_trace+0x54/0x188) from [&lt;bf227908&gt;] (do_readpage+0x168/0x468 [ubifs])
[ 9641.234553] [&lt;bf227908&gt;] (do_readpage+0x168/0x468 [ubifs]) from [&lt;bf2296a0&gt;] (ubifs_readpage+0x424/0x464 [ubifs])
[ 9641.234606] [&lt;bf2296a0&gt;] (ubifs_readpage+0x424/0x464 [ubifs]) from [&lt;c00c17c0&gt;] (filemap_fault+0x304/0x418)
[ 9641.234638] [&lt;c00c17c0&gt;] (filemap_fault+0x304/0x418) from [&lt;c00de694&gt;] (__do_fault+0xd4/0x530)
[ 9641.234665] [&lt;c00de694&gt;] (__do_fault+0xd4/0x530) from [&lt;c00e10c0&gt;] (handle_pte_fault+0x480/0xf54)
[ 9641.234690] [&lt;c00e10c0&gt;] (handle_pte_fault+0x480/0xf54) from [&lt;c00e2bf8&gt;] (handle_mm_fault+0x140/0x184)
[ 9641.234716] [&lt;c00e2bf8&gt;] (handle_mm_fault+0x140/0x184) from [&lt;c0316688&gt;] (do_page_fault+0x150/0x3ac)
[ 9641.234737] [&lt;c0316688&gt;] (do_page_fault+0x150/0x3ac) from [&lt;c000842c&gt;] (do_DataAbort+0x3c/0xa0)
[ 9641.234759] [&lt;c000842c&gt;] (do_DataAbort+0x3c/0xa0) from [&lt;c0314e38&gt;] (__dabt_usr+0x38/0x40)

After analyzing the code, I found a condition that may cause this failed
in correct operations. Thus, I think this assertion is wrong and should be
removed.

Suppose there are two clean znodes and one dirty znode in TNC. So the
per-filesystem atomic_t @clean_zn_cnt is (2). If commit start, dirty_znode
is set to COW_ZNODE in get_znodes_to_commit() in case of potentially ops
on this znode. We clear COW bit and DIRTY bit in write_index() without
@tnc_mutex locked. We don't increase @clean_zn_cnt in this place. As the
comments in write_index() shows, if another process hold @tnc_mutex and
dirty this znode after we clean it, @clean_zn_cnt would be decreased to (1).
We will increase @clean_zn_cnt to (2) with @tnc_mutex locked in
free_obsolete_znodes() to keep it right.

If shrink_tnc() performs between decrease and increase, it will release
other 2 clean znodes it holds and found @clean_zn_cnt is less than zero
(1 - 2 = -1), then hit the assertion. Because free_obsolete_znodes() will
soon correct @clean_zn_cnt and no harm to fs in this case, I think this
assertion could be removed.

2 clean zondes and 1 dirty znode, @clean_zn_cnt == 2

Thread A (commit)         Thread B (write or others)       Thread C (shrinker)
-&gt;write_index
   -&gt;clear_bit(DIRTY_NODE)
   -&gt;clear_bit(COW_ZNODE)

            @clean_zn_cnt == 2
                          -&gt;mutex_locked(&amp;tnc_mutex)
                          -&gt;dirty_cow_znode
                              -&gt;!ubifs_zn_cow(znode)
                              -&gt;!test_and_set_bit(DIRTY_NODE)
                              -&gt;atomic_dec(&amp;clean_zn_cnt)
                          -&gt;mutex_unlocked(&amp;tnc_mutex)

            @clean_zn_cnt == 1
                                                           -&gt;mutex_locked(&amp;tnc_mutex)
                                                           -&gt;shrink_tnc
                                                             -&gt;destroy_tnc_subtree
                                                             -&gt;atomic_sub(&amp;clean_zn_cnt, 2)
                                                             -&gt;ubifs_assert  &lt;- hit
                                                           -&gt;mutex_unlocked(&amp;tnc_mutex)

            @clean_zn_cnt == -1
-&gt;mutex_lock(&amp;tnc_mutex)
-&gt;free_obsolete_znodes
   -&gt;atomic_inc(&amp;clean_zn_cnt)
-&gt;mutux_unlock(&amp;tnc_mutex)

            @clean_zn_cnt == 0 (correct after shrink)

Signed-off-by: hujianyang &lt;hujianyang@huawei.com&gt;
Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 72abc8f4b4e8574318189886de627a2bfe6cd0da upstream.

I hit the same assert failed as Dolev Raviv reported in Kernel v3.10
shows like this:

[ 9641.164028] UBIFS assert failed in shrink_tnc at 131 (pid 13297)
[ 9641.234078] CPU: 1 PID: 13297 Comm: mmap.test Tainted: G           O 3.10.40 #1
[ 9641.234116] [&lt;c0011a6c&gt;] (unwind_backtrace+0x0/0x12c) from [&lt;c000d0b0&gt;] (show_stack+0x20/0x24)
[ 9641.234137] [&lt;c000d0b0&gt;] (show_stack+0x20/0x24) from [&lt;c0311134&gt;] (dump_stack+0x20/0x28)
[ 9641.234188] [&lt;c0311134&gt;] (dump_stack+0x20/0x28) from [&lt;bf22425c&gt;] (shrink_tnc_trees+0x25c/0x350 [ubifs])
[ 9641.234265] [&lt;bf22425c&gt;] (shrink_tnc_trees+0x25c/0x350 [ubifs]) from [&lt;bf2245ac&gt;] (ubifs_shrinker+0x25c/0x310 [ubifs])
[ 9641.234307] [&lt;bf2245ac&gt;] (ubifs_shrinker+0x25c/0x310 [ubifs]) from [&lt;c00cdad8&gt;] (shrink_slab+0x1d4/0x2f8)
[ 9641.234327] [&lt;c00cdad8&gt;] (shrink_slab+0x1d4/0x2f8) from [&lt;c00d03d0&gt;] (do_try_to_free_pages+0x300/0x544)
[ 9641.234344] [&lt;c00d03d0&gt;] (do_try_to_free_pages+0x300/0x544) from [&lt;c00d0a44&gt;] (try_to_free_pages+0x2d0/0x398)
[ 9641.234363] [&lt;c00d0a44&gt;] (try_to_free_pages+0x2d0/0x398) from [&lt;c00c6a60&gt;] (__alloc_pages_nodemask+0x494/0x7e8)
[ 9641.234382] [&lt;c00c6a60&gt;] (__alloc_pages_nodemask+0x494/0x7e8) from [&lt;c00f62d8&gt;] (new_slab+0x78/0x238)
[ 9641.234400] [&lt;c00f62d8&gt;] (new_slab+0x78/0x238) from [&lt;c031081c&gt;] (__slab_alloc.constprop.42+0x1a4/0x50c)
[ 9641.234419] [&lt;c031081c&gt;] (__slab_alloc.constprop.42+0x1a4/0x50c) from [&lt;c00f80e8&gt;] (kmem_cache_alloc_trace+0x54/0x188)
[ 9641.234459] [&lt;c00f80e8&gt;] (kmem_cache_alloc_trace+0x54/0x188) from [&lt;bf227908&gt;] (do_readpage+0x168/0x468 [ubifs])
[ 9641.234553] [&lt;bf227908&gt;] (do_readpage+0x168/0x468 [ubifs]) from [&lt;bf2296a0&gt;] (ubifs_readpage+0x424/0x464 [ubifs])
[ 9641.234606] [&lt;bf2296a0&gt;] (ubifs_readpage+0x424/0x464 [ubifs]) from [&lt;c00c17c0&gt;] (filemap_fault+0x304/0x418)
[ 9641.234638] [&lt;c00c17c0&gt;] (filemap_fault+0x304/0x418) from [&lt;c00de694&gt;] (__do_fault+0xd4/0x530)
[ 9641.234665] [&lt;c00de694&gt;] (__do_fault+0xd4/0x530) from [&lt;c00e10c0&gt;] (handle_pte_fault+0x480/0xf54)
[ 9641.234690] [&lt;c00e10c0&gt;] (handle_pte_fault+0x480/0xf54) from [&lt;c00e2bf8&gt;] (handle_mm_fault+0x140/0x184)
[ 9641.234716] [&lt;c00e2bf8&gt;] (handle_mm_fault+0x140/0x184) from [&lt;c0316688&gt;] (do_page_fault+0x150/0x3ac)
[ 9641.234737] [&lt;c0316688&gt;] (do_page_fault+0x150/0x3ac) from [&lt;c000842c&gt;] (do_DataAbort+0x3c/0xa0)
[ 9641.234759] [&lt;c000842c&gt;] (do_DataAbort+0x3c/0xa0) from [&lt;c0314e38&gt;] (__dabt_usr+0x38/0x40)

After analyzing the code, I found a condition that may cause this failed
in correct operations. Thus, I think this assertion is wrong and should be
removed.

Suppose there are two clean znodes and one dirty znode in TNC. So the
per-filesystem atomic_t @clean_zn_cnt is (2). If commit start, dirty_znode
is set to COW_ZNODE in get_znodes_to_commit() in case of potentially ops
on this znode. We clear COW bit and DIRTY bit in write_index() without
@tnc_mutex locked. We don't increase @clean_zn_cnt in this place. As the
comments in write_index() shows, if another process hold @tnc_mutex and
dirty this znode after we clean it, @clean_zn_cnt would be decreased to (1).
We will increase @clean_zn_cnt to (2) with @tnc_mutex locked in
free_obsolete_znodes() to keep it right.

If shrink_tnc() performs between decrease and increase, it will release
other 2 clean znodes it holds and found @clean_zn_cnt is less than zero
(1 - 2 = -1), then hit the assertion. Because free_obsolete_znodes() will
soon correct @clean_zn_cnt and no harm to fs in this case, I think this
assertion could be removed.

2 clean zondes and 1 dirty znode, @clean_zn_cnt == 2

Thread A (commit)         Thread B (write or others)       Thread C (shrinker)
-&gt;write_index
   -&gt;clear_bit(DIRTY_NODE)
   -&gt;clear_bit(COW_ZNODE)

            @clean_zn_cnt == 2
                          -&gt;mutex_locked(&amp;tnc_mutex)
                          -&gt;dirty_cow_znode
                              -&gt;!ubifs_zn_cow(znode)
                              -&gt;!test_and_set_bit(DIRTY_NODE)
                              -&gt;atomic_dec(&amp;clean_zn_cnt)
                          -&gt;mutex_unlocked(&amp;tnc_mutex)

            @clean_zn_cnt == 1
                                                           -&gt;mutex_locked(&amp;tnc_mutex)
                                                           -&gt;shrink_tnc
                                                             -&gt;destroy_tnc_subtree
                                                             -&gt;atomic_sub(&amp;clean_zn_cnt, 2)
                                                             -&gt;ubifs_assert  &lt;- hit
                                                           -&gt;mutex_unlocked(&amp;tnc_mutex)

            @clean_zn_cnt == -1
-&gt;mutex_lock(&amp;tnc_mutex)
-&gt;free_obsolete_znodes
   -&gt;atomic_inc(&amp;clean_zn_cnt)
-&gt;mutux_unlock(&amp;tnc_mutex)

            @clean_zn_cnt == 0 (correct after shrink)

Signed-off-by: hujianyang &lt;hujianyang@huawei.com&gt;
Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>nfsd: getattr for FATTR4_WORD0_FILES_AVAIL needs the statfs buffer</title>
<updated>2014-07-11T12:33:44+00:00</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2014-05-28T08:46:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=ad6a6b22ba8e575317467a7ed7ed6c4d24b0fbdf'/>
<id>ad6a6b22ba8e575317467a7ed7ed6c4d24b0fbdf</id>
<content type='text'>
commit 12337901d654415d9f764b5f5ba50052e9700f37 upstream.

Note nobody's ever noticed because the typical client probably never
requests FILES_AVAIL without also requesting something else on the list.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 12337901d654415d9f764b5f5ba50052e9700f37 upstream.

Note nobody's ever noticed because the typical client probably never
requests FILES_AVAIL without also requesting something else on the list.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ext4: fix wrong assert in ext4_mb_normalize_request()</title>
<updated>2014-07-11T12:33:38+00:00</updated>
<author>
<name>Maurizio Lombardi</name>
<email>mlombard@redhat.com</email>
</author>
<published>2014-05-27T16:48:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=2b3169d262706a577fe4ffdaaad7599cb529d3e1'/>
<id>2b3169d262706a577fe4ffdaaad7599cb529d3e1</id>
<content type='text'>
commit b5b60778558cafad17bbcbf63e0310bd3c68eb17 upstream.

The variable "size" is expressed as number of blocks and not as
number of clusters, this could trigger a kernel panic when using
ext4 with the size of a cluster different from the size of a block.

Signed-off-by: Maurizio Lombardi &lt;mlombard@redhat.com&gt;
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit b5b60778558cafad17bbcbf63e0310bd3c68eb17 upstream.

The variable "size" is expressed as number of blocks and not as
number of clusters, this could trigger a kernel panic when using
ext4 with the size of a cluster different from the size of a block.

Signed-off-by: Maurizio Lombardi &lt;mlombard@redhat.com&gt;
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ext4: fix zeroing of page during writeback</title>
<updated>2014-07-11T12:33:37+00:00</updated>
<author>
<name>Jan Kara</name>
<email>jack@suse.cz</email>
</author>
<published>2014-05-27T16:48:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=69c9183261e692f6901de00b5e7024a58d69849c'/>
<id>69c9183261e692f6901de00b5e7024a58d69849c</id>
<content type='text'>
commit eeece469dedadf3918bad50ad80f4616a0064e90 upstream.

Tail of a page straddling inode size must be zeroed when being written
out due to POSIX requirement that modifications of mmaped page beyond
inode size must not be written to the file. ext4_bio_write_page() did
this only for blocks fully beyond inode size but didn't properly zero
blocks partially beyond inode size. Fix this.

The problem has been uncovered by mmap_11-4 test in openposix test suite
(part of LTP).

Reported-by: Xiaoguang Wang &lt;wangxg.fnst@cn.fujitsu.com&gt;
Fixes: 5a0dc7365c240
Fixes: bd2d0210cf22f
Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
[bwh: Backported to 3.2:
 - Adjust context
 - block_end was used instead of block_start + blocksize]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit eeece469dedadf3918bad50ad80f4616a0064e90 upstream.

Tail of a page straddling inode size must be zeroed when being written
out due to POSIX requirement that modifications of mmaped page beyond
inode size must not be written to the file. ext4_bio_write_page() did
this only for blocks fully beyond inode size but didn't properly zero
blocks partially beyond inode size. Fix this.

The problem has been uncovered by mmap_11-4 test in openposix test suite
(part of LTP).

Reported-by: Xiaoguang Wang &lt;wangxg.fnst@cn.fujitsu.com&gt;
Fixes: 5a0dc7365c240
Fixes: bd2d0210cf22f
Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
[bwh: Backported to 3.2:
 - Adjust context
 - block_end was used instead of block_start + blocksize]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>reiserfs: call truncate_setsize under tailpack mutex</title>
<updated>2014-07-11T12:33:35+00:00</updated>
<author>
<name>Jeff Mahoney</name>
<email>jeffm@suse.com</email>
</author>
<published>2014-05-21T17:28:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=4e6efff9b1e11c0e825a025f308a6322ca3241e5'/>
<id>4e6efff9b1e11c0e825a025f308a6322ca3241e5</id>
<content type='text'>
commit 22e7478ddbcb670e33fab72d0bbe7c394c3a2c84 upstream.

Prior to commit 0e4f6a791b1e (Fix reiserfs_file_release()), reiserfs
truncates serialized on i_mutex. They mostly still do, with the exception
of reiserfs_file_release. That blocks out other writers via the tailpack
mutex and the inode openers counter adjusted in reiserfs_file_open.

However, NFS will call reiserfs_setattr without having called -&gt;open, so
we end up with a race when nfs is calling -&gt;setattr while another
process is releasing the file. Ultimately, it triggers the
BUG_ON(inode-&gt;i_size != new_file_size) check in maybe_indirect_to_direct.

The solution is to pull the lock into reiserfs_setattr to encompass the
truncate_setsize call as well.

Signed-off-by: Jeff Mahoney &lt;jeffm@suse.com&gt;
Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 22e7478ddbcb670e33fab72d0bbe7c394c3a2c84 upstream.

Prior to commit 0e4f6a791b1e (Fix reiserfs_file_release()), reiserfs
truncates serialized on i_mutex. They mostly still do, with the exception
of reiserfs_file_release. That blocks out other writers via the tailpack
mutex and the inode openers counter adjusted in reiserfs_file_open.

However, NFS will call reiserfs_setattr without having called -&gt;open, so
we end up with a race when nfs is calling -&gt;setattr while another
process is releasing the file. Ultimately, it triggers the
BUG_ON(inode-&gt;i_size != new_file_size) check in maybe_indirect_to_direct.

The solution is to pull the lock into reiserfs_setattr to encompass the
truncate_setsize call as well.

Signed-off-by: Jeff Mahoney &lt;jeffm@suse.com&gt;
Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>reiserfs: drop vmtruncate</title>
<updated>2014-07-11T12:33:35+00:00</updated>
<author>
<name>Marco Stornelli</name>
<email>marco.stornelli@gmail.com</email>
</author>
<published>2012-12-15T10:47:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=f6975fe1d8ca4f40768575a8e7b8360e7fa48a45'/>
<id>f6975fe1d8ca4f40768575a8e7b8360e7fa48a45</id>
<content type='text'>
commit cfac4b47c664e207740880d6492938761c53d74b upstream.

Removed vmtruncate

Signed-off-by: Marco Stornelli &lt;marco.stornelli@gmail.com&gt;
Reviewed-by: Jan Kara &lt;jack@suse.cz&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
[bwh: Backported to 3.2: adjust filename]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit cfac4b47c664e207740880d6492938761c53d74b upstream.

Removed vmtruncate

Signed-off-by: Marco Stornelli &lt;marco.stornelli@gmail.com&gt;
Reviewed-by: Jan Kara &lt;jack@suse.cz&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
[bwh: Backported to 3.2: adjust filename]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>UBIFS: fix an mmap and fsync race condition</title>
<updated>2014-07-11T12:33:34+00:00</updated>
<author>
<name>hujianyang</name>
<email>hujianyang@huawei.com</email>
</author>
<published>2014-04-30T06:06:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=2e87c9895d55ef1df895b766d207f52da391680e'/>
<id>2e87c9895d55ef1df895b766d207f52da391680e</id>
<content type='text'>
commit 691a7c6f28ac90cccd0dbcf81348ea90b211bdd0 upstream.

There is a race condition in UBIFS:

Thread A (mmap)                        Thread B (fsync)

-&gt;__do_fault                           -&gt;write_cache_pages
   -&gt; ubifs_vm_page_mkwrite
       -&gt; budget_space
       -&gt; lock_page
       -&gt; release/convert_page_budget
       -&gt; SetPagePrivate
       -&gt; TestSetPageDirty
       -&gt; unlock_page
                                       -&gt; lock_page
                                           -&gt; TestClearPageDirty
                                           -&gt; ubifs_writepage
                                               -&gt; do_writepage
                                                   -&gt; release_budget
                                                   -&gt; ClearPagePrivate
                                                   -&gt; unlock_page
   -&gt; !(ret &amp; VM_FAULT_LOCKED)
   -&gt; lock_page
   -&gt; set_page_dirty
       -&gt; ubifs_set_page_dirty
           -&gt; TestSetPageDirty (set page dirty without budgeting)
   -&gt; unlock_page

This leads to situation where we have a diry page but no budget allocated for
this page, so further write-back may fail with -ENOSPC.

In this fix we return from page_mkwrite without performing unlock_page. We
return VM_FAULT_LOCKED instead. After doing this, the race above will not
happen.

Signed-off-by: hujianyang &lt;hujianyang@huawei.com&gt;
Tested-by: Laurence Withers &lt;lwithers@guralp.com&gt;
Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 691a7c6f28ac90cccd0dbcf81348ea90b211bdd0 upstream.

There is a race condition in UBIFS:

Thread A (mmap)                        Thread B (fsync)

-&gt;__do_fault                           -&gt;write_cache_pages
   -&gt; ubifs_vm_page_mkwrite
       -&gt; budget_space
       -&gt; lock_page
       -&gt; release/convert_page_budget
       -&gt; SetPagePrivate
       -&gt; TestSetPageDirty
       -&gt; unlock_page
                                       -&gt; lock_page
                                           -&gt; TestClearPageDirty
                                           -&gt; ubifs_writepage
                                               -&gt; do_writepage
                                                   -&gt; release_budget
                                                   -&gt; ClearPagePrivate
                                                   -&gt; unlock_page
   -&gt; !(ret &amp; VM_FAULT_LOCKED)
   -&gt; lock_page
   -&gt; set_page_dirty
       -&gt; ubifs_set_page_dirty
           -&gt; TestSetPageDirty (set page dirty without budgeting)
   -&gt; unlock_page

This leads to situation where we have a diry page but no budget allocated for
this page, so further write-back may fail with -ENOSPC.

In this fix we return from page_mkwrite without performing unlock_page. We
return VM_FAULT_LOCKED instead. After doing this, the race above will not
happen.

Signed-off-by: hujianyang &lt;hujianyang@huawei.com&gt;
Tested-by: Laurence Withers &lt;lwithers@guralp.com&gt;
Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
</feed>
