<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/fscache/page.c, branch linux-3.17.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.17.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.17.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2014-09-17T21:41:40Z</updated>
<entry>
<title>FS-Cache: refcount becomes corrupt under vma pressure.</title>
<updated>2014-09-17T21:41:40Z</updated>
<author>
<name>Milosz Tanski</name>
</author>
<published>2014-08-13T16:58:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3e1199dcad004a40b55297a4736ccd1b9b81a952'/>
<id>urn:sha1:3e1199dcad004a40b55297a4736ccd1b9b81a952</id>
<content type='text'>
In rare cases under heavy VMA pressure the ref count for a fscache cookie
becomes corrupt. In this case we decrement ref count even if we fail before
incrementing the refcount.

FS-Cache: Assertion failed bnode-eca5f9c6/syslog
0 &gt; 0 is false
------------[ cut here ]------------
kernel BUG at fs/fscache/cookie.c:519!
invalid opcode: 0000 [#1] SMP
Call Trace:
[&lt;ffffffffa01ba060&gt;] __fscache_relinquish_cookie+0x50/0x220 [fscache]
[&lt;ffffffffa02d64ce&gt;] ceph_fscache_unregister_inode_cookie+0x3e/0x50 [ceph]
[&lt;ffffffffa02ae1d3&gt;] ceph_destroy_inode+0x33/0x200 [ceph]
[&lt;ffffffff811cf67e&gt;] ? __fsnotify_inode_delete+0xe/0x10
[&lt;ffffffff811a9e0c&gt;] destroy_inode+0x3c/0x70
[&lt;ffffffff811a9f51&gt;] evict+0x111/0x180
[&lt;ffffffff811aa763&gt;] iput+0x103/0x190
[&lt;ffffffff811a5de8&gt;] __dentry_kill+0x1c8/0x220
[&lt;ffffffff811a5f31&gt;] shrink_dentry_list+0xf1/0x250
[&lt;ffffffff811a762c&gt;] prune_dcache_sb+0x4c/0x60
[&lt;ffffffff811930af&gt;] super_cache_scan+0xff/0x170
[&lt;ffffffff8113d7a0&gt;] shrink_slab_node+0x140/0x2c0
[&lt;ffffffff8113f2da&gt;] shrink_slab+0x8a/0x130
[&lt;ffffffff81142572&gt;] balance_pgdat+0x3e2/0x5d0
[&lt;ffffffff811428ca&gt;] kswapd+0x16a/0x4a0
[&lt;ffffffff810a43f0&gt;] ? __wake_up_sync+0x20/0x20
[&lt;ffffffff81142760&gt;] ? balance_pgdat+0x5d0/0x5d0
[&lt;ffffffff81083e09&gt;] kthread+0xc9/0xe0
[&lt;ffffffff81010000&gt;] ? ftrace_raw_event_xen_mmu_release_ptpage+0x70/0x90
[&lt;ffffffff81083d40&gt;] ? flush_kthread_worker+0xb0/0xb0
[&lt;ffffffff8159f63c&gt;] ret_from_fork+0x7c/0xb0
[&lt;ffffffff81083d40&gt;] ? flush_kthread_worker+0xb0/0xb0
RIP [&lt;ffffffffa01b984b&gt;] __fscache_disable_cookie+0x1db/0x210 [fscache]
RSP &lt;ffff8803bc85f9b8&gt;
---[ end trace 254d0d7c74a01f25 ]---

Signed-off-by: Milosz Tanski &lt;milosz@adfin.com&gt;
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</content>
</entry>
<entry>
<title>FS-Cache: Timeout for releasepage()</title>
<updated>2014-08-27T14:24:06Z</updated>
<author>
<name>Milosz Tanski</name>
</author>
<published>2014-08-13T16:58:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9776de96e51565286da25c74d6f631abc50c63ef'/>
<id>urn:sha1:9776de96e51565286da25c74d6f631abc50c63ef</id>
<content type='text'>
This is meant to avoid a recusive hang caused by underlying filesystem trying
to grab a free page and causing a write-out.

INFO: task kworker/u30:7:28375 blocked for more than 120 seconds.
      Not tainted 3.15.0-virtual #74
"echo 0 &gt; /proc/sys/kernel/hung_task_timeout_secs" disables this message.
kworker/u30:7   D 0000000000000000     0 28375      2 0x00000000
Workqueue: fscache_operation fscache_op_work_func [fscache]
 ffff88000b147148 0000000000000046 0000000000000000 ffff88000b1471c8
 ffff8807aa031820 0000000000014040 ffff88000b147fd8 0000000000014040
 ffff880f0c50c860 ffff8807aa031820 ffff88000b147158 ffff88007be59cd0
Call Trace:
 [&lt;ffffffff815930e9&gt;] schedule+0x29/0x70
 [&lt;ffffffffa018bed5&gt;] __fscache_wait_on_page_write+0x55/0x90 [fscache]
 [&lt;ffffffff810a4350&gt;] ? __wake_up_sync+0x20/0x20
 [&lt;ffffffffa018c135&gt;] __fscache_maybe_release_page+0x65/0x1e0 [fscache]
 [&lt;ffffffffa02ad813&gt;] ceph_releasepage+0x83/0x100 [ceph]
 [&lt;ffffffff811635b0&gt;] ? anon_vma_fork+0x130/0x130
 [&lt;ffffffff8112cdd2&gt;] try_to_release_page+0x32/0x50
 [&lt;ffffffff81140096&gt;] shrink_page_list+0x7e6/0x9d0
 [&lt;ffffffff8113f278&gt;] ? isolate_lru_pages.isra.73+0x78/0x1e0
 [&lt;ffffffff81140932&gt;] shrink_inactive_list+0x252/0x4c0
 [&lt;ffffffff811412b1&gt;] shrink_lruvec+0x3e1/0x670
 [&lt;ffffffff8114157f&gt;] shrink_zone+0x3f/0x110
 [&lt;ffffffff81141b06&gt;] do_try_to_free_pages+0x1d6/0x450
 [&lt;ffffffff8114a939&gt;] ? zone_statistics+0x99/0xc0
 [&lt;ffffffff81141e44&gt;] try_to_free_pages+0xc4/0x180
 [&lt;ffffffff81136982&gt;] __alloc_pages_nodemask+0x6b2/0xa60
 [&lt;ffffffff811c1d4e&gt;] ? __find_get_block+0xbe/0x250
 [&lt;ffffffff810a405e&gt;] ? wake_up_bit+0x2e/0x40
 [&lt;ffffffff811740c3&gt;] alloc_pages_current+0xb3/0x180
 [&lt;ffffffff8112cf07&gt;] __page_cache_alloc+0xb7/0xd0
 [&lt;ffffffff8112da6c&gt;] grab_cache_page_write_begin+0x7c/0xe0
 [&lt;ffffffff81214072&gt;] ? ext4_mark_inode_dirty+0x82/0x220
 [&lt;ffffffff81214a89&gt;] ext4_da_write_begin+0x89/0x2d0
 [&lt;ffffffff8112c6ee&gt;] generic_perform_write+0xbe/0x1d0
 [&lt;ffffffff811a96b1&gt;] ? update_time+0x81/0xc0
 [&lt;ffffffff811ad4c2&gt;] ? mnt_clone_write+0x12/0x30
 [&lt;ffffffff8112e80e&gt;] __generic_file_aio_write+0x1ce/0x3f0
 [&lt;ffffffff8112ea8e&gt;] generic_file_aio_write+0x5e/0xe0
 [&lt;ffffffff8120b94f&gt;] ext4_file_write+0x9f/0x410
 [&lt;ffffffff8120af56&gt;] ? ext4_file_open+0x66/0x180
 [&lt;ffffffff8118f0da&gt;] do_sync_write+0x5a/0x90
 [&lt;ffffffffa025c6c9&gt;] cachefiles_write_page+0x149/0x430 [cachefiles]
 [&lt;ffffffff812cf439&gt;] ? radix_tree_gang_lookup_tag+0x89/0xd0
 [&lt;ffffffffa018c512&gt;] fscache_write_op+0x222/0x3b0 [fscache]
 [&lt;ffffffffa018b35a&gt;] fscache_op_work_func+0x3a/0x100 [fscache]
 [&lt;ffffffff8107bfe9&gt;] process_one_work+0x179/0x4a0
 [&lt;ffffffff8107d47b&gt;] worker_thread+0x11b/0x370
 [&lt;ffffffff8107d360&gt;] ? manage_workers.isra.21+0x2e0/0x2e0
 [&lt;ffffffff81083d69&gt;] kthread+0xc9/0xe0
 [&lt;ffffffff81010000&gt;] ? ftrace_raw_event_xen_mmu_release_ptpage+0x70/0x90
 [&lt;ffffffff81083ca0&gt;] ? flush_kthread_worker+0xb0/0xb0
 [&lt;ffffffff8159eefc&gt;] ret_from_fork+0x7c/0xb0
 [&lt;ffffffff81083ca0&gt;] ? flush_kthread_worker+0xb0/0xb0

Signed-off-by: Milosz Tanski &lt;milosz@adfin.com&gt;
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</content>
</entry>
<entry>
<title>sched: Remove proliferation of wait_on_bit() action functions</title>
<updated>2014-07-16T13:10:39Z</updated>
<author>
<name>NeilBrown</name>
</author>
<published>2014-07-07T05:16:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=743162013d40ca612b4cb53d3a200dff2d9ab26e'/>
<id>urn:sha1:743162013d40ca612b4cb53d3a200dff2d9ab26e</id>
<content type='text'>
The current "wait_on_bit" interface requires an 'action'
function to be provided which does the actual waiting.
There are over 20 such functions, many of them identical.
Most cases can be satisfied by one of just two functions, one
which uses io_schedule() and one which just uses schedule().

So:
 Rename wait_on_bit and        wait_on_bit_lock to
        wait_on_bit_action and wait_on_bit_lock_action
 to make it explicit that they need an action function.

 Introduce new wait_on_bit{,_lock} and wait_on_bit{,_lock}_io
 which are *not* given an action function but implicitly use
 a standard one.
 The decision to error-out if a signal is pending is now made
 based on the 'mode' argument rather than being encoded in the action
 function.

 All instances of the old wait_on_bit and wait_on_bit_lock which
 can use the new version have been changed accordingly and their
 action functions have been discarded.
 wait_on_bit{_lock} does not return any specific error code in the
 event of a signal so the caller must check for non-zero and
 interpolate their own error code as appropriate.

The wait_on_bit() call in __fscache_wait_on_invalidate() was
ambiguous as it specified TASK_UNINTERRUPTIBLE but used
fscache_wait_bit_interruptible as an action function.
David Howells confirms this should be uniformly
"uninterruptible"

The main remaining user of wait_on_bit{,_lock}_action is NFS
which needs to use a freezer-aware schedule() call.

A comment in fs/gfs2/glock.c notes that having multiple 'action'
functions is useful as they display differently in the 'wchan'
field of 'ps'. (and /proc/$PID/wchan).
As the new bit_wait{,_io} functions are tagged "__sched", they
will not show up at all, but something higher in the stack.  So
the distinction will still be visible, only with different
function names (gds2_glock_wait versus gfs2_glock_dq_wait in the
gfs2/glock.c case).

Since first version of this patch (against 3.15) two new action
functions appeared, on in NFS and one in CIFS.  CIFS also now
uses an action function that makes the same freezer aware
schedule call as NFS.

Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
Acked-by: David Howells &lt;dhowells@redhat.com&gt; (fscache, keys)
Acked-by: Steven Whitehouse &lt;swhiteho@redhat.com&gt; (gfs2)
Acked-by: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: Steve French &lt;sfrench@samba.org&gt;
Cc: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Link: http://lkml.kernel.org/r/20140707051603.28027.72349.stgit@notabene.brown
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
<entry>
<title>fs/fscache: convert printk to pr_foo()</title>
<updated>2014-06-04T23:53:51Z</updated>
<author>
<name>Fabian Frederick</name>
</author>
<published>2014-06-04T23:05:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=36dfd116edd48fa6174d5694c143f1d4bd81aba8'/>
<id>urn:sha1:36dfd116edd48fa6174d5694c143f1d4bd81aba8</id>
<content type='text'>
All printk converted to pr_foo() except internal.h: printk(KERN_DEBUG

Coalesce formats.

Add pr_fmt

Signed-off-by: Fabian Frederick &lt;fabf@skynet.be&gt;
Cc: David Howells &lt;dhowells@redhat.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>FS-Cache: Provide the ability to enable/disable cookies</title>
<updated>2013-09-27T17:40:25Z</updated>
<author>
<name>David Howells</name>
</author>
<published>2013-09-20T23:09:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=94d30ae90a00cafe686c1057be57f4885f963abf'/>
<id>urn:sha1:94d30ae90a00cafe686c1057be57f4885f963abf</id>
<content type='text'>
Provide the ability to enable and disable fscache cookies.  A disabled cookie
will reject or ignore further requests to:

	Acquire a child cookie
	Invalidate and update backing objects
	Check the consistency of a backing object
	Allocate storage for backing page
	Read backing pages
	Write to backing pages

but still allows:

	Checks/waits on the completion of already in-progress objects
	Uncaching of pages
	Relinquishment of cookies

Two new operations are provided:

 (1) Disable a cookie:

	void fscache_disable_cookie(struct fscache_cookie *cookie,
				    bool invalidate);

     If the cookie is not already disabled, this locks the cookie against other
     dis/enablement ops, marks the cookie as being disabled, discards or
     invalidates any backing objects and waits for cessation of activity on any
     associated object.

     This is a wrapper around a chunk split out of fscache_relinquish_cookie(),
     but it reinitialises the cookie such that it can be reenabled.

     All possible failures are handled internally.  The caller should consider
     calling fscache_uncache_all_inode_pages() afterwards to make sure all page
     markings are cleared up.

 (2) Enable a cookie:

	void fscache_enable_cookie(struct fscache_cookie *cookie,
				   bool (*can_enable)(void *data),
				   void *data)

     If the cookie is not already enabled, this locks the cookie against other
     dis/enablement ops, invokes can_enable() and, if the cookie is not an
     index cookie, will begin the procedure of acquiring backing objects.

     The optional can_enable() function is passed the data argument and returns
     a ruling as to whether or not enablement should actually be permitted to
     begin.

     All possible failures are handled internally.  The cookie will only be
     marked as enabled if provisional backing objects are allocated.

A later patch will introduce these to NFS.  Cookie enablement during nfs_open()
is then contingent on i_writecount &lt;= 0.  can_enable() checks for a race
between open(O_RDONLY) and open(O_WRONLY/O_RDWR).  This simplifies NFS's cookie
handling and allows us to get rid of open(O_RDONLY) accidentally introducing
caching to an inode that's open for writing already.

One operation has its API modified:

 (3) Acquire a cookie.

	struct fscache_cookie *fscache_acquire_cookie(
		struct fscache_cookie *parent,
		const struct fscache_cookie_def *def,
		void *netfs_data,
		bool enable);

     This now has an additional argument that indicates whether the requested
     cookie should be enabled by default.  It doesn't need the can_enable()
     function because the caller must prevent multiple calls for the same netfs
     object and it doesn't need to take the enablement lock because no one else
     can get at the cookie before this returns.

Signed-off-by: David Howells &lt;dhowells@redhat.com
</content>
</entry>
<entry>
<title>FS-Cache: Add use/unuse/wake cookie wrappers</title>
<updated>2013-09-27T17:40:25Z</updated>
<author>
<name>David Howells</name>
</author>
<published>2013-09-20T23:09:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8fb883f3e30065529e4f35d4b4f355193dcdb7a2'/>
<id>urn:sha1:8fb883f3e30065529e4f35d4b4f355193dcdb7a2</id>
<content type='text'>
Add wrapper functions for dealing with cookie-&gt;n_active:

 (*) __fscache_use_cookie() to increment it.

 (*) __fscache_unuse_cookie() to decrement and test against zero.

 (*) __fscache_wake_unused_cookie() to wake up anyone waiting for it to reach
     zero.

The second and third are split so that the third can be done after cookie-&gt;lock
has been released in case the waiter wakes up whilst we're still holding it and
tries to get it.

We will need to wake-on-zero once the cookie disablement patch is applied
because it will then be possible to see n_active become zero without the cookie
being relinquished.

Also move the cookie usement out of fscache_attr_changed_op() and into
fscache_attr_changed() and the operation struct so that cookie disablement
will be able to track it.

Whilst we're at it, only increment n_active if we're about to do
fscache_submit_op() so that we don't have to deal with undoing it if anything
earlier fails.  Possibly this should be moved into fscache_submit_op() which
could look at FSCACHE_OP_UNUSE_COOKIE.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</content>
</entry>
<entry>
<title>lib/radix-tree.c: make radix_tree_node_alloc() work correctly within interrupt</title>
<updated>2013-09-11T22:59:36Z</updated>
<author>
<name>Jan Kara</name>
</author>
<published>2013-09-11T21:26:05Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5e4c0d974139a98741b829b27cf38dc8f9284490'/>
<id>urn:sha1:5e4c0d974139a98741b829b27cf38dc8f9284490</id>
<content type='text'>
With users of radix_tree_preload() run from interrupt (block/blk-ioc.c is
one such possible user), the following race can happen:

radix_tree_preload()
...
radix_tree_insert()
  radix_tree_node_alloc()
    if (rtp-&gt;nr) {
      ret = rtp-&gt;nodes[rtp-&gt;nr - 1];
&lt;interrupt&gt;
...
radix_tree_preload()
...
radix_tree_insert()
  radix_tree_node_alloc()
    if (rtp-&gt;nr) {
      ret = rtp-&gt;nodes[rtp-&gt;nr - 1];

And we give out one radix tree node twice.  That clearly results in radix
tree corruption with different results (usually OOPS) depending on which
two users of radix tree race.

We fix the problem by making radix_tree_node_alloc() always allocate fresh
radix tree nodes when in interrupt.  Using preloading when in interrupt
doesn't make sense since all the allocations have to be atomic anyway and
we cannot steal nodes from process-context users because some users rely
on radix_tree_insert() succeeding after radix_tree_preload().
in_interrupt() check is somewhat ugly but we cannot simply key off passed
gfp_mask as that is acquired from root_gfp_mask() and thus the same for
all preload users.

Another part of the fix is to avoid node preallocation in
radix_tree_preload() when passed gfp_mask doesn't allow waiting.  Again,
preallocation in such case doesn't make sense and when preallocation would
happen in interrupt we could possibly leak some allocated nodes.  However,
some users of radix_tree_preload() require following radix_tree_insert()
to succeed.  To avoid unexpected effects for these users,
radix_tree_preload() only warns if passed gfp mask doesn't allow waiting
and we provide a new function radix_tree_maybe_preload() for those users
which get different gfp mask from different call sites and which are
prepared to handle radix_tree_insert() failure.

Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
Cc: Jens Axboe &lt;jaxboe@fusionio.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>fscache: Netfs function for cleanup post readpages</title>
<updated>2013-09-06T08:17:30Z</updated>
<author>
<name>Milosz Tanski</name>
</author>
<published>2013-08-21T21:30:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5a6f282a2052bb13171b53f03b34501cf72c33f1'/>
<id>urn:sha1:5a6f282a2052bb13171b53f03b34501cf72c33f1</id>
<content type='text'>
Currently the fscache code expect the netfs to call fscache_readpages_or_alloc
inside the aops readpages callback.  It marks all the pages in the list
provided by readahead with PG_private_2.  In the cases that the netfs fails to
read all the pages (which is legal) it ends up returning to the readahead and
triggering a BUG.  This happens because the page list still contains marked
pages.

This patch implements a simple fscache_readpages_cancel function that the netfs
should call before returning from readpages.  It will revoke the pages from the
underlying cache backend and unmark them.

The problem was originally worked out in the Ceph devel tree, but it also
occurs in CIFS.  It appears that NFS, AFS and 9P are okay as read_cache_pages()
will clean up the unprocessed pages in the case of an error.

This can be used to address the following oops:

[12410647.597278] BUG: Bad page state in process petabucket  pfn:3d504e
[12410647.597292] page:ffffea000f541380 count:0 mapcount:0 mapping:
	(null) index:0x0
[12410647.597298] page flags: 0x200000000001000(private_2)

...

[12410647.597334] Call Trace:
[12410647.597345]  [&lt;ffffffff815523f2&gt;] dump_stack+0x19/0x1b
[12410647.597356]  [&lt;ffffffff8111def7&gt;] bad_page+0xc7/0x120
[12410647.597359]  [&lt;ffffffff8111e49e&gt;] free_pages_prepare+0x10e/0x120
[12410647.597361]  [&lt;ffffffff8111fc80&gt;] free_hot_cold_page+0x40/0x170
[12410647.597363]  [&lt;ffffffff81123507&gt;] __put_single_page+0x27/0x30
[12410647.597365]  [&lt;ffffffff81123df5&gt;] put_page+0x25/0x40
[12410647.597376]  [&lt;ffffffffa02bdcf9&gt;] ceph_readpages+0x2e9/0x6e0 [ceph]
[12410647.597379]  [&lt;ffffffff81122a8f&gt;] __do_page_cache_readahead+0x1af/0x260
[12410647.597382]  [&lt;ffffffff81122ea1&gt;] ra_submit+0x21/0x30
[12410647.597384]  [&lt;ffffffff81118f64&gt;] filemap_fault+0x254/0x490
[12410647.597387]  [&lt;ffffffff8113a74f&gt;] __do_fault+0x6f/0x4e0
[12410647.597391]  [&lt;ffffffff810125bd&gt;] ? __switch_to+0x16d/0x4a0
[12410647.597395]  [&lt;ffffffff810865ba&gt;] ? finish_task_switch+0x5a/0xc0
[12410647.597398]  [&lt;ffffffff8113d856&gt;] handle_pte_fault+0xf6/0x930
[12410647.597401]  [&lt;ffffffff81008c33&gt;] ? pte_mfn_to_pfn+0x93/0x110
[12410647.597403]  [&lt;ffffffff81008cce&gt;] ? xen_pmd_val+0xe/0x10
[12410647.597405]  [&lt;ffffffff81005469&gt;] ? __raw_callee_save_xen_pmd_val+0x11/0x1e
[12410647.597407]  [&lt;ffffffff8113f361&gt;] handle_mm_fault+0x251/0x370
[12410647.597411]  [&lt;ffffffff812b0ac4&gt;] ? call_rwsem_down_read_failed+0x14/0x30
[12410647.597414]  [&lt;ffffffff8155bffa&gt;] __do_page_fault+0x1aa/0x550
[12410647.597418]  [&lt;ffffffff8108011d&gt;] ? up_write+0x1d/0x20
[12410647.597422]  [&lt;ffffffff8113141c&gt;] ? vm_mmap_pgoff+0xbc/0xe0
[12410647.597425]  [&lt;ffffffff81143bb8&gt;] ? SyS_mmap_pgoff+0xd8/0x240
[12410647.597427]  [&lt;ffffffff8155c3ae&gt;] do_page_fault+0xe/0x10
[12410647.597431]  [&lt;ffffffff81558818&gt;] page_fault+0x28/0x30

Signed-off-by: Milosz Tanski &lt;milosz@adfin.com&gt;
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</content>
</entry>
<entry>
<title>FS-Cache: Add interface to check consistency of a cached object</title>
<updated>2013-09-06T08:17:30Z</updated>
<author>
<name>David Howells</name>
</author>
<published>2013-08-21T21:29:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=da9803bc8812f5bd3b26baaa90e515b843c65ff7'/>
<id>urn:sha1:da9803bc8812f5bd3b26baaa90e515b843c65ff7</id>
<content type='text'>
Extend the fscache netfs API so that the netfs can ask as to whether a cache
object is up to date with respect to its corresponding netfs object:

	int fscache_check_consistency(struct fscache_cookie *cookie)

This will call back to the netfs to check whether the auxiliary data associated
with a cookie is correct.  It returns 0 if it is and -ESTALE if it isn't; it
may also return -ENOMEM and -ERESTARTSYS.

The backends now have to implement a mandatory operation pointer:

	int (*check_consistency)(struct fscache_object *object)

that corresponds to the above API call.  FS-Cache takes care of pinning the
object and the cookie in memory and managing this call with respect to the
object state.

Original-author: Hongyi Jia &lt;jiayisuse@gmail.com&gt;
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
cc: Hongyi Jia &lt;jiayisuse@gmail.com&gt;
cc: Milosz Tanski &lt;milosz@adfin.com&gt;
</content>
</entry>
<entry>
<title>FS-Cache: The retrieval remaining-pages counter needs to be atomic_t</title>
<updated>2013-06-19T13:16:47Z</updated>
<author>
<name>David Howells</name>
</author>
<published>2013-05-21T12:44:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1bb4b7f98f361132ea322834515334d95b93c184'/>
<id>urn:sha1:1bb4b7f98f361132ea322834515334d95b93c184</id>
<content type='text'>
struct fscache_retrieval contains a count of the number of pages that still
need some processing (n_pages).  This is decremented as the pages are
processed.

However, this needs to be atomic as fscache_retrieval_complete() (I think) just
occasionally may be called from cachefiles_read_backing_file() and
cachefiles_read_copier() simultaneously.

This happens when an fscache_read_or_alloc_pages() request containing a lot of
pages (say a couple of hundred) is being processed.  The read on each backing
page is dispatched individually because we need to insert a monitor into the
waitqueue to catch when the read completes.  However, under low-memory
conditions, we might be forced to wait in the allocator - and this gives the
I/O on the backing page a chance to complete first.

When the I/O completes, fscache_enqueue_retrieval() chucks the retrieval onto
the workqueue without waiting for the operation to finish the initial I/O
dispatch (we want to release any pages we can as soon as we can), thus both can
end up running simultaneously and potentially attempting to partially complete
the retrieval simultaneously (ENOMEM may occur, backing pages may already be in
the page cache).

This was demonstrated by parallelling the non-atomic counter with an atomic
counter and printing both of them when the assertion fails.  At this point, the
atomic counter has reached zero, but the non-atomic counter has not.

To fix this, make the counter an atomic_t.

This results in the following bug appearing

	FS-Cache: Assertion failed
	3 == 5 is false
	------------[ cut here ]------------
	kernel BUG at fs/fscache/operation.c:421!

or

	FS-Cache: Assertion failed
	3 == 5 is false
	------------[ cut here ]------------
	kernel BUG at fs/fscache/operation.c:414!

With a backtrace like the following:

RIP: 0010:[&lt;ffffffffa0211b1d&gt;] fscache_put_operation+0x1ad/0x240 [fscache]
Call Trace:
 [&lt;ffffffffa0213185&gt;] fscache_retrieval_work+0x55/0x270 [fscache]
 [&lt;ffffffffa0213130&gt;] ? fscache_retrieval_work+0x0/0x270 [fscache]
 [&lt;ffffffff81090b10&gt;] worker_thread+0x170/0x2a0
 [&lt;ffffffff81096d10&gt;] ? autoremove_wake_function+0x0/0x40
 [&lt;ffffffff810909a0&gt;] ? worker_thread+0x0/0x2a0
 [&lt;ffffffff81096966&gt;] kthread+0x96/0xa0
 [&lt;ffffffff8100c0ca&gt;] child_rip+0xa/0x20
 [&lt;ffffffff810968d0&gt;] ? kthread+0x0/0xa0
 [&lt;ffffffff8100c0c0&gt;] ? child_rip+0x0/0x20

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Reviewed-and-tested-By: Milosz Tanski &lt;milosz@adfin.com&gt;
Acked-by: Jeff Layton &lt;jlayton@redhat.com&gt;
</content>
</entry>
</feed>
