<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/fs, branch v3.12.17</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/fs?h=v3.12.17</id>
<link rel='self' href='https://git.amat.us/linux/atom/fs?h=v3.12.17'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2014-04-03T08:32:30Z</updated>
<entry>
<title>mm: close PageTail race</title>
<updated>2014-04-03T08:32:30Z</updated>
<author>
<name>David Rientjes</name>
<email>rientjes@google.com</email>
</author>
<published>2014-03-03T23:38:18Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=9a110858ed2e494b8be683c6959113f73685eb1f'/>
<id>urn:sha1:9a110858ed2e494b8be683c6959113f73685eb1f</id>
<content type='text'>
commit 668f9abbd4334e6c29fa8acd71635c4f9101caa7 upstream.

Commit bf6bddf1924e ("mm: introduce compaction and migration for
ballooned pages") introduces page_count(page) into memory compaction
which dereferences page-&gt;first_page if PageTail(page).

This results in a very rare NULL pointer dereference on the
aforementioned page_count(page).  Indeed, anything that does
compound_head(), including page_count() is susceptible to racing with
prep_compound_page() and seeing a NULL or dangling page-&gt;first_page
pointer.

This patch uses Andrea's implementation of compound_trans_head() that
deals with such a race and makes it the default compound_head()
implementation.  This includes a read memory barrier that ensures that
if PageTail(head) is true that we return a head page that is neither
NULL nor dangling.  The patch then adds a store memory barrier to
prep_compound_page() to ensure page-&gt;first_page is set.

This is the safest way to ensure we see the head page that we are
expecting, PageTail(page) is already in the unlikely() path and the
memory barriers are unfortunately required.

Hugetlbfs is the exception, we don't enforce a store memory barrier
during init since no race is possible.

Signed-off-by: David Rientjes &lt;rientjes@google.com&gt;
Cc: Holger Kiehl &lt;Holger.Kiehl@dwd.de&gt;
Cc: Christoph Lameter &lt;cl@linux.com&gt;
Cc: Rafael Aquini &lt;aquini@redhat.com&gt;
Cc: Vlastimil Babka &lt;vbabka@suse.cz&gt;
Cc: Michal Hocko &lt;mhocko@suse.cz&gt;
Cc: Mel Gorman &lt;mgorman@suse.de&gt;
Cc: Andrea Arcangeli &lt;aarcange@redhat.com&gt;
Cc: Rik van Riel &lt;riel@redhat.com&gt;
Cc: "Kirill A. Shutemov" &lt;kirill.shutemov@linux.intel.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: Jiri Slaby &lt;jslaby@suse.cz&gt;
</content>
</entry>
<entry>
<title>make prepend_name() work correctly when called with negative *buflen</title>
<updated>2014-04-03T08:32:29Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2014-03-23T04:28:40Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=a41fd7536d9cbc81cf02033c3efa4078431fa4d0'/>
<id>urn:sha1:a41fd7536d9cbc81cf02033c3efa4078431fa4d0</id>
<content type='text'>
commit e825196d48d2b89a6ec3a8eff280098d2a78207e upstream.

In all callchains leading to prepend_name(), the value left in *buflen
is eventually discarded unused if prepend_name() has returned a negative.
So we are free to do what prepend() does, and subtract from *buflen
*before* checking for underflow (which turns into checking the sign
of subtraction result, of course).

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Signed-off-by: Jiri Slaby &lt;jslaby@suse.cz&gt;
</content>
</entry>
<entry>
<title>ext4: atomically set inode-&gt;i_flags in ext4_set_inode_flags()</title>
<updated>2014-04-03T08:32:22Z</updated>
<author>
<name>Theodore Ts'o</name>
<email>tytso@mit.edu</email>
</author>
<published>2014-03-30T14:20:01Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=710e5cbeeb6869bb0f1227ce3cba7374449fdeb4'/>
<id>urn:sha1:710e5cbeeb6869bb0f1227ce3cba7374449fdeb4</id>
<content type='text'>
commit 00a1a053ebe5febcfc2ec498bd894f035ad2aa06 upstream.

Use cmpxchg() to atomically set i_flags instead of clearing out the
S_IMMUTABLE, S_APPEND, etc. flags and then setting them from the
EXT4_IMMUTABLE_FL, EXT4_APPEND_FL flags, since this opens up a race
where an immutable file has the immutable flag cleared for a brief
window of time.

Reported-by: John Sullivan &lt;jsrhbz@kanargh.force9.co.uk&gt;
Signed-off-by: "Theodore Ts'o" &lt;tytso@mit.edu&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Jiri Slaby &lt;jslaby@suse.cz&gt;
</content>
</entry>
<entry>
<title>FS-Cache: Handle removal of unadded object to the fscache_object_list rb tree</title>
<updated>2014-04-03T08:32:20Z</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2014-02-17T15:01:47Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=c8a3d3bcd7dc2893790c38695a8ecd79c4fbad99'/>
<id>urn:sha1:c8a3d3bcd7dc2893790c38695a8ecd79c4fbad99</id>
<content type='text'>
commit 7026f1929e18921fd67bf478f475a8fdfdff16ae upstream.

When FS-Cache allocates an object, the following sequence of events can
occur:

 --&gt;fscache_alloc_object()
    --&gt;cachefiles_alloc_object() [via cache-&gt;ops-&gt;alloc_object]
    &lt;--[returns new object]
    --&gt;fscache_attach_object()
    &lt;--[failed]
    --&gt;cachefiles_put_object() [via cache-&gt;ops-&gt;put_object]
       --&gt;fscache_object_destroy()
          --&gt;fscache_objlist_remove()
             --&gt;rb_erase() to remove the object from fscache_object_list.

resulting in a crash in the rbtree code.

The problem is that the object is only added to fscache_object_list on
the success path of fscache_attach_object() where it calls
fscache_objlist_add().

So if fscache_attach_object() fails, the object won't have been added to
the objlist rbtree.  We do, however, unconditionally try to remove the
object from the tree.

Thanks to NeilBrown for finding this and suggesting this solution.

Reported-by: NeilBrown &lt;neilb@suse.de&gt;
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Tested-by: (a customer of) NeilBrown &lt;neilb@suse.de&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Jiri Slaby &lt;jslaby@suse.cz&gt;
</content>
</entry>
<entry>
<title>dlm: set zero linger time on sctp socket</title>
<updated>2014-04-03T08:32:19Z</updated>
<author>
<name>Dongmao Zhang</name>
<email>dmzhang@suse.com</email>
</author>
<published>2013-12-10T16:52:22Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=67ea60618db0ee32fb9fb37050e467612959d060'/>
<id>urn:sha1:67ea60618db0ee32fb9fb37050e467612959d060</id>
<content type='text'>
commit ece35848c1847cdf3dd07954578d3e99238ebbae upstream.

The recovery time for a failed node was taking a long
time because the failed node could not perform the full
shutdown process.  Removing the linger time speeds this
up.  The dlm does not care what happens to messages to
or from the failed node.

Signed-off-by: Dongmao Zhang &lt;dmzhang@suse.com&gt;
Signed-off-by: David Teigland &lt;teigland@redhat.com&gt;
Signed-off-by: Jiri Slaby &lt;jslaby@suse.cz&gt;
</content>
</entry>
<entry>
<title>NFSv4.1 free slot before resending I/O to MDS</title>
<updated>2014-04-03T08:32:19Z</updated>
<author>
<name>Andy Adamson</name>
<email>andros@netapp.com</email>
</author>
<published>2014-01-29T16:34:38Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=96ab13e36b6c1496193063b28fc6af3c722ef618'/>
<id>urn:sha1:96ab13e36b6c1496193063b28fc6af3c722ef618</id>
<content type='text'>
commit f9c96fcc501a43dbc292b17fc0ded4b54e63b79d upstream.

Fix a dynamic session slot leak where a slot is preallocated and I/O is
resent through the MDS.

Signed-off-by: Andy Adamson &lt;andros@netapp.com&gt;
Signed-off-by: Trond Myklebust &lt;trond.myklebust@primarydata.com&gt;
Signed-off-by: Jiri Slaby &lt;jslaby@suse.cz&gt;
</content>
</entry>
<entry>
<title>nfs: add memory barriers around NFS_INO_INVALID_DATA and NFS_INO_INVALIDATING</title>
<updated>2014-04-03T08:32:18Z</updated>
<author>
<name>Jeff Layton</name>
<email>jlayton@redhat.com</email>
</author>
<published>2014-01-28T18:47:46Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=fca36cf65b30ce5abb69284ba5404eb4d03f9545'/>
<id>urn:sha1:fca36cf65b30ce5abb69284ba5404eb4d03f9545</id>
<content type='text'>
commit 4db72b40fdbc706f8957e9773ae73b1574b8c694 upstream.

If the setting of NFS_INO_INVALIDATING gets reordered to before the
clearing of NFS_INO_INVALID_DATA, then another task may hit a race
window where both appear to be clear, even though the inode's pages are
still in need of invalidation. Fix this by adding the appropriate memory
barriers.

Signed-off-by: Jeff Layton &lt;jlayton@redhat.com&gt;
Signed-off-by: Trond Myklebust &lt;trond.myklebust@primarydata.com&gt;
Signed-off-by: Jiri Slaby &lt;jslaby@suse.cz&gt;
</content>
</entry>
<entry>
<title>NFS: Fix races in nfs_revalidate_mapping</title>
<updated>2014-04-03T08:32:17Z</updated>
<author>
<name>Trond Myklebust</name>
<email>trond.myklebust@primarydata.com</email>
</author>
<published>2014-01-28T14:37:16Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=2791fc92400a2a504eda346688eeb40949e5e1ba'/>
<id>urn:sha1:2791fc92400a2a504eda346688eeb40949e5e1ba</id>
<content type='text'>
commit 17dfeb9113397a6119091a491ef7182649f0c5a9 upstream.

Commit d529ef83c355f97027ff85298a9709fe06216a66 (NFS: fix the handling
of NFS_INO_INVALID_DATA flag in nfs_revalidate_mapping) introduces
a potential race, since it doesn't test the value of nfsi-&gt;cache_validity
and set the bitlock in nfsi-&gt;flags atomically.

Signed-off-by: Trond Myklebust &lt;trond.myklebust@primarydata.com&gt;
Cc: Jeff Layton &lt;jlayton@redhat.com&gt;
Signed-off-by: Jiri Slaby &lt;jslaby@suse.cz&gt;
</content>
</entry>
<entry>
<title>NFS: fix the handling of NFS_INO_INVALID_DATA flag in nfs_revalidate_mapping</title>
<updated>2014-04-03T08:32:17Z</updated>
<author>
<name>Jeff Layton</name>
<email>jlayton@redhat.com</email>
</author>
<published>2014-01-27T18:46:15Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=a18d760264c9ff07b35ec501403f037c2654cded'/>
<id>urn:sha1:a18d760264c9ff07b35ec501403f037c2654cded</id>
<content type='text'>
commit d529ef83c355f97027ff85298a9709fe06216a66 upstream.

There is a possible race in how the nfs_invalidate_mapping function is
handled.  Currently, we go and invalidate the pages in the file and then
clear NFS_INO_INVALID_DATA.

The problem is that it's possible for a stale page to creep into the
mapping after the page was invalidated (i.e., via readahead). If another
writer comes along and sets the flag after that happens but before
invalidate_inode_pages2 returns then we could clear the flag
without the cache having been properly invalidated.

So, we must clear the flag first and then invalidate the pages. Doing
this however, opens another race:

It's possible to have two concurrent read() calls that end up in
nfs_revalidate_mapping at the same time. The first one clears the
NFS_INO_INVALID_DATA flag and then goes to call nfs_invalidate_mapping.

Just before calling that though, the other task races in, checks the
flag and finds it cleared. At that point, it trusts that the mapping is
good and gets the lock on the page, allowing the read() to be satisfied
from the cache even though the data is no longer valid.

These effects are easily manifested by running diotest3 from the LTP
test suite on NFS. That program does a series of DIO writes and buffered
reads. The operations are serialized and page-aligned but the existing
code fails the test since it occasionally allows a read to come out of
the cache incorrectly. While mixing direct and buffered I/O isn't
recommended, I believe it's possible to hit this in other ways that just
use buffered I/O, though that situation is much harder to reproduce.

The problem is that the checking/clearing of that flag and the
invalidation of the mapping really need to be atomic. Fix this by
serializing concurrent invalidations with a bitlock.

At the same time, we also need to allow other places that check
NFS_INO_INVALID_DATA to check whether we might be in the middle of
invalidating the file, so fix up a couple of places that do that
to look for the new NFS_INO_INVALIDATING flag.

Doing this requires us to be careful not to set the bitlock
unnecessarily, so this code only does that if it believes it will
be doing an invalidation.

Signed-off-by: Jeff Layton &lt;jlayton@redhat.com&gt;
Signed-off-by: Trond Myklebust &lt;trond.myklebust@primarydata.com&gt;
Signed-off-by: Jiri Slaby &lt;jslaby@suse.cz&gt;
</content>
</entry>
<entry>
<title>pnfs: fix BUG in filelayout_recover_commit_reqs</title>
<updated>2014-04-03T08:32:16Z</updated>
<author>
<name>Weston Andros Adamson</name>
<email>dros@primarydata.com</email>
</author>
<published>2014-01-21T20:21:33Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=1b70c8f6bb164e25075e32d15ded960b97797a50'/>
<id>urn:sha1:1b70c8f6bb164e25075e32d15ded960b97797a50</id>
<content type='text'>
commit 471252cd8b34b0609973740b25dcd1ff01dc1889 upstream.

cond_resched_lock(cinfo-&gt;lock) is called everywhere else while holding
the cinfo-&gt;lock spinlock.  Not holding this lock while calling
transfer_commit_list in filelayout_recover_commit_reqs causes the BUG
below.

It's true that we can't hold this lock while calling pnfs_put_lseg,
because that might try to lock the inode lock - which might be the
same lock as cinfo-&gt;lock.

To reproduce, mount a 2 DS pynfs server and run an O_DIRECT command
that crosses a stripe boundary and is not page aligned, such as:

 dd if=/dev/zero of=/mnt/f bs=17000 count=1 oflag=direct

BUG: sleeping function called from invalid context at linux/fs/nfs/nfs4filelayout.c:1161
in_atomic(): 0, irqs_disabled(): 0, pid: 27, name: kworker/0:1
2 locks held by kworker/0:1/27:
 #0:  (events){.+.+.+}, at: [&lt;ffffffff810501d7&gt;] process_one_work+0x175/0x3a5
 #1:  ((&amp;dreq-&gt;work)){+.+...}, at: [&lt;ffffffff810501d7&gt;] process_one_work+0x175/0x3a5
CPU: 0 PID: 27 Comm: kworker/0:1 Not tainted 3.13.0-rc3-branch-dros_testing+ #21
Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 07/31/2013
Workqueue: events nfs_direct_write_schedule_work [nfs]
 0000000000000000 ffff88007a39bbb8 ffffffff81491256 ffff88007b87a130  ffff88007a39bbd8 ffffffff8105f103 ffff880079614000 ffff880079617d40  ffff88007a39bc20 ffffffffa011603e ffff880078988b98 0000000000000000
Call Trace:
 [&lt;ffffffff81491256&gt;] dump_stack+0x4d/0x66
 [&lt;ffffffff8105f103&gt;] __might_sleep+0x100/0x105
 [&lt;ffffffffa011603e&gt;] transfer_commit_list+0x94/0xf1 [nfs_layout_nfsv41_files]
 [&lt;ffffffffa01160d6&gt;] filelayout_recover_commit_reqs+0x3b/0x68 [nfs_layout_nfsv41_files]
 [&lt;ffffffffa00ba53a&gt;] nfs_direct_write_reschedule+0x9f/0x1d6 [nfs]
 [&lt;ffffffff810705df&gt;] ? mark_lock+0x1df/0x224
 [&lt;ffffffff8106e617&gt;] ? trace_hardirqs_off_caller+0x37/0xa4
 [&lt;ffffffff8106e691&gt;] ? trace_hardirqs_off+0xd/0xf
 [&lt;ffffffffa00ba8f8&gt;] nfs_direct_write_schedule_work+0x9d/0xb7 [nfs]
 [&lt;ffffffff810501d7&gt;] ? process_one_work+0x175/0x3a5
 [&lt;ffffffff81050258&gt;] process_one_work+0x1f6/0x3a5
 [&lt;ffffffff810501d7&gt;] ? process_one_work+0x175/0x3a5
 [&lt;ffffffff8105187e&gt;] worker_thread+0x149/0x1f5
 [&lt;ffffffff81051735&gt;] ? rescuer_thread+0x28d/0x28d
 [&lt;ffffffff81056d74&gt;] kthread+0xd2/0xda
 [&lt;ffffffff81056ca2&gt;] ? __kthread_parkme+0x61/0x61
 [&lt;ffffffff8149e66c&gt;] ret_from_fork+0x7c/0xb0
 [&lt;ffffffff81056ca2&gt;] ? __kthread_parkme+0x61/0x61

Signed-off-by: Weston Andros Adamson &lt;dros@primarydata.com&gt;
Signed-off-by: Trond Myklebust &lt;trond.myklebust@primarydata.com&gt;
Signed-off-by: Jiri Slaby &lt;jslaby@suse.cz&gt;
</content>
</entry>
</feed>
