<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/fs, branch v3.4.100</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>ext4: clarify error count warning messages</title>
<updated>2014-07-17T22:39:50+00:00</updated>
<author>
<name>Theodore Ts'o</name>
<email>tytso@mit.edu</email>
</author>
<published>2014-07-05T22:40:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=ef018263c824ec34d06419502555dbd8889e8182'/>
<id>ef018263c824ec34d06419502555dbd8889e8182</id>
<content type='text'>
commit ae0f78de2c43b6fadd007c231a352b13b5be8ed2 upstream.

Make it clear that values printed are times, and that it is error
since last fsck. Also add note about fsck version required.

Signed-off-by: Pavel Machek &lt;pavel@ucw.cz&gt;
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
Reviewed-by: Andreas Dilger &lt;adilger@dilger.ca&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 ae0f78de2c43b6fadd007c231a352b13b5be8ed2 upstream.

Make it clear that values printed are times, and that it is error
since last fsck. Also add note about fsck version required.

Signed-off-by: Pavel Machek &lt;pavel@ucw.cz&gt;
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
Reviewed-by: Andreas Dilger &lt;adilger@dilger.ca&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>nfsd: fix rare symlink decoding bug</title>
<updated>2014-07-09T17:51:20+00:00</updated>
<author>
<name>J. Bruce Fields</name>
<email>bfields@redhat.com</email>
</author>
<published>2014-06-19T20:44:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=a22a7e7ba7d3b7f4288bfde1f9ab552905366f32'/>
<id>a22a7e7ba7d3b7f4288bfde1f9ab552905366f32</id>
<content type='text'>
commit 76f47128f9b33af1e96819746550d789054c9664 upstream.

An NFS operation that creates a new symlink includes the symlink data,
which is xdr-encoded as a length followed by the data plus 0 to 3 bytes
of zero-padding as required to reach a 4-byte boundary.

The vfs, on the other hand, wants null-terminated data.

The simple way to handle this would be by copying the data into a newly
allocated buffer with space for the final null.

The current nfsd_symlink code tries to be more clever by skipping that
step in the (likely) case where the byte following the string is already
0.

But that assumes that the byte following the string is ours to look at.
In fact, it might be the first byte of a page that we can't read, or of
some object that another task might modify.

Worse, the NFSv4 code tries to fix the problem by actually writing to
that byte.

In the NFSv2/v3 cases this actually appears to be safe:

	- nfs3svc_decode_symlinkargs explicitly null-terminates the data
	  (after first checking its length and copying it to a new
	  page).
	- NFSv2 limits symlinks to 1k.  The buffer holding the rpc
	  request is always at least a page, and the link data (and
	  previous fields) have maximum lengths that prevent the request
	  from reaching the end of a page.

In the NFSv4 case the CREATE op is potentially just one part of a long
compound so can end up on the end of a page if you're unlucky.

The minimal fix here is to copy and null-terminate in the NFSv4 case.
The nfsd_symlink() interface here seems too fragile, though.  It should
really either do the copy itself every time or just require a
null-terminated string.

Reported-by: Jeff Layton &lt;jlayton@primarydata.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.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 76f47128f9b33af1e96819746550d789054c9664 upstream.

An NFS operation that creates a new symlink includes the symlink data,
which is xdr-encoded as a length followed by the data plus 0 to 3 bytes
of zero-padding as required to reach a 4-byte boundary.

The vfs, on the other hand, wants null-terminated data.

The simple way to handle this would be by copying the data into a newly
allocated buffer with space for the final null.

The current nfsd_symlink code tries to be more clever by skipping that
step in the (likely) case where the byte following the string is already
0.

But that assumes that the byte following the string is ours to look at.
In fact, it might be the first byte of a page that we can't read, or of
some object that another task might modify.

Worse, the NFSv4 code tries to fix the problem by actually writing to
that byte.

In the NFSv2/v3 cases this actually appears to be safe:

	- nfs3svc_decode_symlinkargs explicitly null-terminates the data
	  (after first checking its length and copying it to a new
	  page).
	- NFSv2 limits symlinks to 1k.  The buffer holding the rpc
	  request is always at least a page, and the link data (and
	  previous fields) have maximum lengths that prevent the request
	  from reaching the end of a page.

In the NFSv4 case the CREATE op is potentially just one part of a long
compound so can end up on the end of a page if you're unlucky.

The minimal fix here is to copy and null-terminate in the NFSv4 case.
The nfsd_symlink() interface here seems too fragile, though.  It should
really either do the copy itself every time or just require a
null-terminated string.

Reported-by: Jeff Layton &lt;jlayton@primarydata.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>CIFS: fix mount failure with broken pathnames when smb3 mount with mapchars option</title>
<updated>2014-07-09T17:51:20+00:00</updated>
<author>
<name>Steve French</name>
<email>smfrench@gmail.com</email>
</author>
<published>2014-06-23T01:38:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=6e44d311e993f364bbf4d99e2b6beac25f03bdbe'/>
<id>6e44d311e993f364bbf4d99e2b6beac25f03bdbe</id>
<content type='text'>
commit ce36d9ab3bab06b7b5522f5c8b68fac231b76ffb upstream.

When we SMB3 mounted with mapchars (to allow reserved characters : \ / &gt; &lt; * ?
via the Unicode Windows to POSIX remap range) empty paths
(eg when we open "" to query the root of the SMB3 directory on mount) were not
null terminated so we sent garbarge as a path name on empty paths which caused
SMB2/SMB2.1/SMB3 mounts to fail when mapchars was specified.  mapchars is
particularly important since Unix Extensions for SMB3 are not supported (yet)

Signed-off-by: Steve French &lt;smfrench@gmail.com&gt;
Reviewed-by: David Disseldorp &lt;ddiss@suse.de&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 ce36d9ab3bab06b7b5522f5c8b68fac231b76ffb upstream.

When we SMB3 mounted with mapchars (to allow reserved characters : \ / &gt; &lt; * ?
via the Unicode Windows to POSIX remap range) empty paths
(eg when we open "" to query the root of the SMB3 directory on mount) were not
null terminated so we sent garbarge as a path name on empty paths which caused
SMB2/SMB2.1/SMB3 mounts to fail when mapchars was specified.  mapchars is
particularly important since Unix Extensions for SMB3 are not supported (yet)

Signed-off-by: Steve French &lt;smfrench@gmail.com&gt;
Reviewed-by: David Disseldorp &lt;ddiss@suse.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>nfsd: getattr for FATTR4_WORD0_FILES_AVAIL needs the statfs buffer</title>
<updated>2014-07-07T01:49:19+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.toradex.cn/cgit/linux-toradex.git/commit/?id=bdef8307cc822a0121698ad619d1fdb3191795ba'/>
<id>bdef8307cc822a0121698ad619d1fdb3191795ba</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: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&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: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>nfsd4: fix FREE_STATEID lockowner leak</title>
<updated>2014-07-07T01:49:19+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.toradex.cn/cgit/linux-toradex.git/commit/?id=eb55ed0cdd1bcb9bfba644c1d577b8b008de92b5'/>
<id>eb55ed0cdd1bcb9bfba644c1d577b8b008de92b5</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: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&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: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>UBIFS: Remove incorrect assertion in shrink_tnc()</title>
<updated>2014-07-07T01:49:19+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.toradex.cn/cgit/linux-toradex.git/commit/?id=0834497455a06f7772e82a812e05dff446472b21'/>
<id>0834497455a06f7772e82a812e05dff446472b21</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: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&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: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>btrfs: fix use of uninit "ret" in end_extent_writepage()</title>
<updated>2014-07-01T03:01:33+00:00</updated>
<author>
<name>Eric Sandeen</name>
<email>sandeen@redhat.com</email>
</author>
<published>2014-06-12T05:39:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=e18bac2cae5d6efa474611a2dc825b7749760af4'/>
<id>e18bac2cae5d6efa474611a2dc825b7749760af4</id>
<content type='text'>
commit 3e2426bd0eb980648449e7a2f5a23e3cd3c7725c upstream.

If this condition in end_extent_writepage() is false:

	if (tree-&gt;ops &amp;&amp; tree-&gt;ops-&gt;writepage_end_io_hook)

we will then test an uninitialized "ret" at:

	ret = ret &lt; 0 ? ret : -EIO;

The test for ret is for the case where -&gt;writepage_end_io_hook
failed, and we'd choose that ret as the error; but if
there is no -&gt;writepage_end_io_hook, nothing sets ret.

Initializing ret to 0 should be sufficient; if
writepage_end_io_hook wasn't set, (!uptodate) means
non-zero err was passed in, so we choose -EIO in that case.

Signed-of-by: Eric Sandeen &lt;sandeen@redhat.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 3e2426bd0eb980648449e7a2f5a23e3cd3c7725c upstream.

If this condition in end_extent_writepage() is false:

	if (tree-&gt;ops &amp;&amp; tree-&gt;ops-&gt;writepage_end_io_hook)

we will then test an uninitialized "ret" at:

	ret = ret &lt; 0 ? ret : -EIO;

The test for ret is for the case where -&gt;writepage_end_io_hook
failed, and we'd choose that ret as the error; but if
there is no -&gt;writepage_end_io_hook, nothing sets ret.

Initializing ret to 0 should be sufficient; if
writepage_end_io_hook wasn't set, (!uptodate) means
non-zero err was passed in, so we choose -EIO in that case.

Signed-of-by: Eric Sandeen &lt;sandeen@redhat.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: use right type to get real comparison</title>
<updated>2014-07-01T03:01:33+00:00</updated>
<author>
<name>Liu Bo</name>
<email>bo.li.liu@oracle.com</email>
</author>
<published>2014-06-08T11:04:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=64b84ef0258d03d80d2581b7f44b7630e945e612'/>
<id>64b84ef0258d03d80d2581b7f44b7630e945e612</id>
<content type='text'>
commit cd857dd6bc2ae9ecea14e75a34e8a8fdc158e307 upstream.

We want to make sure the point is still within the extent item, not to verify
the memory it's pointing to.

Signed-off-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 cd857dd6bc2ae9ecea14e75a34e8a8fdc158e307 upstream.

We want to make sure the point is still within the extent item, not to verify
the memory it's pointing to.

Signed-off-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>fs: btrfs: volumes.c: Fix for possible null pointer dereference</title>
<updated>2014-07-01T03:01:33+00:00</updated>
<author>
<name>Rickard Strandqvist</name>
<email>rickard_strandqvist@spectrumdigital.se</email>
</author>
<published>2014-05-22T20:43:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=8f1dd63b01d0ab74032c77cad7a664da8a59dc2c'/>
<id>8f1dd63b01d0ab74032c77cad7a664da8a59dc2c</id>
<content type='text'>
commit 8321cf2596d283821acc466377c2b85bcd3422b7 upstream.

There is otherwise a risk of a possible null pointer dereference.

Was largely found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist &lt;rickard_strandqvist@spectrumdigital.se&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 8321cf2596d283821acc466377c2b85bcd3422b7 upstream.

There is otherwise a risk of a possible null pointer dereference.

Was largely found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist &lt;rickard_strandqvist@spectrumdigital.se&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: fix double free in find_lock_delalloc_range</title>
<updated>2014-07-01T03:01:33+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.toradex.cn/cgit/linux-toradex.git/commit/?id=a25ebe211246ea835f165c371d744f2d65260d64'/>
<id>a25ebe211246ea835f165c371d744f2d65260d64</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: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&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: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

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