<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/fs/cachefiles, branch v3.11</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v3.11</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v3.11'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2013-07-03T23:07:31Z</updated>
<entry>
<title>mm: remove lru parameter from __pagevec_lru_add and remove parts of pagevec API</title>
<updated>2013-07-03T23:07:31Z</updated>
<author>
<name>Mel Gorman</name>
<email>mgorman@suse.de</email>
</author>
<published>2013-07-03T22:02:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a0b8cab3b9b2efadabdcff264c450ca515e2619c'/>
<id>urn:sha1:a0b8cab3b9b2efadabdcff264c450ca515e2619c</id>
<content type='text'>
Now that the LRU to add a page to is decided at LRU-add time, remove the
misleading lru parameter from __pagevec_lru_add.  A consequence of this
is that the pagevec_lru_add_file, pagevec_lru_add_anon and similar
helpers are misleading as the caller no longer has direct control over
what LRU the page is added to.  Unused helpers are removed by this patch
and existing users of pagevec_lru_add_file() are converted to use
lru_cache_add_file() directly and use the per-cpu pagevecs instead of
creating their own pagevec.

Signed-off-by: Mel Gorman &lt;mgorman@suse.de&gt;
Reviewed-by: Jan Kara &lt;jack@suse.cz&gt;
Reviewed-by: Rik van Riel &lt;riel@redhat.com&gt;
Acked-by: Johannes Weiner &lt;hannes@cmpxchg.org&gt;
Cc: Alexey Lyahkov &lt;alexey.lyashkov@gmail.com&gt;
Cc: Andrew Perepechko &lt;anserper@ya.ru&gt;
Cc: Robin Dong &lt;sanbai@taobao.com&gt;
Cc: Theodore Tso &lt;tytso@mit.edu&gt;
Cc: Hugh Dickins &lt;hughd@google.com&gt;
Cc: Rik van Riel &lt;riel@redhat.com&gt;
Cc: Bernd Schubert &lt;bernd.schubert@fastmail.fm&gt;
Cc: David Howells &lt;dhowells@redhat.com&gt;
Cc: Trond Myklebust &lt;Trond.Myklebust@netapp.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>cachefiles: remove unused macro list_to_page()</title>
<updated>2013-06-19T13:16:47Z</updated>
<author>
<name>Haicheng Li</name>
<email>haicheng.li@linux.intel.com</email>
</author>
<published>2013-05-16T01:25:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2144bc78d41fe31ba58ffdd48571a54d3ca6b5fe'/>
<id>urn:sha1:2144bc78d41fe31ba58ffdd48571a54d3ca6b5fe</id>
<content type='text'>
Signed-off-by: Haicheng Li &lt;haicheng.li@linux.intel.com&gt;
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Tested-By: Milosz Tanski &lt;milosz@adfin.com&gt;
Acked-by: Jeff Layton &lt;jlayton@redhat.com&gt;
</content>
</entry>
<entry>
<title>FS-Cache: Simplify cookie retention for fscache_objects, fixing oops</title>
<updated>2013-06-19T13:16:47Z</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2013-05-10T18:50:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1362729b169b7903c7e739dbe7904994b0d8c47f'/>
<id>urn:sha1:1362729b169b7903c7e739dbe7904994b0d8c47f</id>
<content type='text'>
Simplify the way fscache cache objects retain their cookie.  The way I
implemented the cookie storage handling made synchronisation a pain (ie. the
object state machine can't rely on the cookie actually still being there).

Instead of the the object being detached from the cookie and the cookie being
freed in __fscache_relinquish_cookie(), we defer both operations:

 (*) The detachment of the object from the list in the cookie now takes place
     in fscache_drop_object() and is thus governed by the object state machine
     (fscache_detach_from_cookie() has been removed).

 (*) The release of the cookie is now in fscache_object_destroy() - which is
     called by the cache backend just before it frees the object.

This means that the fscache_cookie struct is now available to the cache all the
way through from -&gt;alloc_object() to -&gt;drop_object() and -&gt;put_object() -
meaning that it's no longer necessary to take object-&gt;lock to guarantee access.

However, __fscache_relinquish_cookie() doesn't wait for the object to go all
the way through to destruction before letting the netfs proceed.  That would
massively slow down the netfs.  Since __fscache_relinquish_cookie() leaves the
cookie around, in must therefore break all attachments to the netfs - which
includes -&gt;def, -&gt;netfs_data and any outstanding page read/writes.

To handle this, struct fscache_cookie now has an n_active counter:

 (1) This starts off initialised to 1.

 (2) Any time the cache needs to get at the netfs data, it calls
     fscache_use_cookie() to increment it - if it is not zero.  If it was zero,
     then access is not permitted.

 (3) When the cache has finished with the data, it calls fscache_unuse_cookie()
     to decrement it.  This does a wake-up on it if it reaches 0.

 (4) __fscache_relinquish_cookie() decrements n_active and then waits for it to
     reach 0.  The initialisation to 1 in step (1) ensures that we only get
     wake ups when we're trying to get rid of the cookie.

This leaves __fscache_relinquish_cookie() a lot simpler.


***
This fixes a problem in the current code whereby if fscache_invalidate() is
followed sufficiently quickly by fscache_relinquish_cookie() then it is
possible for __fscache_relinquish_cookie() to have detached the cookie from the
object and cleared the pointer before a thread is dispatched to process the
invalidation state in the object state machine.

Since the pending write clearance was deferred to the invalidation state to
make it asynchronous, we need to either wait in relinquishment for the stores
tree to be cleared in the invalidation state or we need to handle the clearance
in relinquishment.

Further, if the relinquishment code does clear the tree, then the invalidation
state need to make the clearance contingent on still having the cookie to hand
(since that's where the tree is rooted) and we have to prevent the cookie from
disappearing for the duration.

This can lead to an oops like the following:

BUG: unable to handle kernel NULL pointer dereference at 000000000000000c
...
RIP: 0010:[&lt;ffffffff8151023e&gt;] _spin_lock+0xe/0x30
...
CR2: 000000000000000c ...
...
Process kslowd002 (...)
....
Call Trace:
 [&lt;ffffffffa01c3278&gt;] fscache_invalidate_writes+0x38/0xd0 [fscache]
 [&lt;ffffffff810096f0&gt;] ? __switch_to+0xd0/0x320
 [&lt;ffffffff8105e759&gt;] ? find_busiest_queue+0x69/0x150
 [&lt;ffffffff8110ddd4&gt;] ? slow_work_enqueue+0x104/0x180
 [&lt;ffffffffa01c1303&gt;] fscache_object_slow_work_execute+0x5e3/0x9d0 [fscache]
 [&lt;ffffffff81096b67&gt;] ? bit_waitqueue+0x17/0xd0
 [&lt;ffffffff8110e233&gt;] slow_work_execute+0x233/0x310
 [&lt;ffffffff8110e515&gt;] slow_work_thread+0x205/0x360
 [&lt;ffffffff81096ca0&gt;] ? autoremove_wake_function+0x0/0x40
 [&lt;ffffffff8110e310&gt;] ? slow_work_thread+0x0/0x360
 [&lt;ffffffff81096936&gt;] kthread+0x96/0xa0
 [&lt;ffffffff8100c0ca&gt;] child_rip+0xa/0x20
 [&lt;ffffffff810968a0&gt;] ? kthread+0x0/0xa0
 [&lt;ffffffff8100c0c0&gt;] ? child_rip+0x0/0x20

The parameter to fscache_invalidate_writes() was object-&gt;cookie which is NULL.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Tested-By: Milosz Tanski &lt;milosz@adfin.com&gt;
Acked-by: Jeff Layton &lt;jlayton@redhat.com&gt;
</content>
</entry>
<entry>
<title>FS-Cache: Fix object state machine to have separate work and wait states</title>
<updated>2013-06-19T13:16:47Z</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2013-05-10T18:50:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=caaef6900befb45689b1d1831ce3c7e7fb5b504f'/>
<id>urn:sha1:caaef6900befb45689b1d1831ce3c7e7fb5b504f</id>
<content type='text'>
Fix object state machine to have separate work and wait states as that makes
it easier to envision.

There are now three kinds of state:

 (1) Work state.  This is an execution state.  No event processing is performed
     by a work state.  The function attached to a work state returns a pointer
     indicating the next state to which the OSM should transition.  Returning
     NO_TRANSIT repeats the current state, but goes back to the scheduler
     first.

 (2) Wait state.  This is an event processing state.  No execution is
     performed by a wait state.  Wait states are just tables of "if event X
     occurs, clear it and transition to state Y".  The dispatcher returns to
     the scheduler if none of the events in which the wait state has an
     interest are currently pending.

 (3) Out-of-band state.  This is a special work state.  Transitions to normal
     states can be overridden when an unexpected event occurs (eg. I/O error).
     Instead the dispatcher disables and clears the OOB event and transits to
     the specified work state.  This then acts as an ordinary work state,
     though object-&gt;state points to the overridden destination.  Returning
     NO_TRANSIT resumes the overridden transition.

In addition, the states have names in their definitions, so there's no need for
tables of state names.  Further, the EV_REQUEUE event is no longer necessary as
that is automatic for work states.

Since the states are now separate structs rather than values in an enum, it's
not possible to use comparisons other than (non-)equality between them, so use
some object-&gt;flags to indicate what phase an object is in.

The EV_RELEASE, EV_RETIRE and EV_WITHDRAW events have been squished into one
(EV_KILL).  An object flag now carries the information about retirement.

Similarly, the RELEASING, RECYCLING and WITHDRAWING states have been merged
into an KILL_OBJECT state and additional states have been added for handling
waiting dependent objects (JUMPSTART_DEPS and KILL_DEPENDENTS).

A state has also been added for synchronising with parent object initialisation
(WAIT_FOR_PARENT) and another for initiating look up (PARENT_READY).

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Tested-By: Milosz Tanski &lt;milosz@adfin.com&gt;
Acked-by: Jeff Layton &lt;jlayton@redhat.com&gt;
</content>
</entry>
<entry>
<title>FS-Cache: Wrap checks on object state</title>
<updated>2013-06-19T13:16:47Z</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2013-05-10T18:50:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=493f7bc11457bc1f6fbf25a4b2bdf215ebaf050f'/>
<id>urn:sha1:493f7bc11457bc1f6fbf25a4b2bdf215ebaf050f</id>
<content type='text'>
Wrap checks on object state (mostly outside of fs/fscache/object.c) with
inline functions so that the mechanism can be replaced.

Some of the state checks within object.c are left as-is as they will be
replaced.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Tested-By: Milosz Tanski &lt;milosz@adfin.com&gt;
Acked-by: Jeff Layton &lt;jlayton@redhat.com&gt;
</content>
</entry>
<entry>
<title>CacheFiles: name i_mutex lock class explicitly</title>
<updated>2013-06-19T13:16:47Z</updated>
<author>
<name>J. Bruce Fields</name>
<email>bfields@redhat.com</email>
</author>
<published>2013-05-10T18:50:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6bd5e82b099c3d633905098b3c0af808ced73d85'/>
<id>urn:sha1:6bd5e82b099c3d633905098b3c0af808ced73d85</id>
<content type='text'>
Just some cleanup.

(And note the caller of this function may, for example, call vfs_unlink
on a child, so the "1" (I_MUTEX_PARENT) really was what was intended
here.)

Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Tested-By: Milosz Tanski &lt;milosz@adfin.com&gt;
Acked-by: Jeff Layton &lt;jlayton@redhat.com&gt;
</content>
</entry>
<entry>
<title>lift sb_start_write() out of -&gt;write()</title>
<updated>2013-04-09T18:12:56Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2013-03-20T17:04:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=03d95eb2f2578083a3f6286262e1cb5d88a00c02'/>
<id>urn:sha1:03d95eb2f2578083a3f6286262e1cb5d88a00c02</id>
<content type='text'>
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>FS-Cache: Mark cancellation of in-progress operation</title>
<updated>2012-12-20T22:34:00Z</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2012-12-13T20:03:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1f372dff1da37e2b36ae9085368fa46896398598'/>
<id>urn:sha1:1f372dff1da37e2b36ae9085368fa46896398598</id>
<content type='text'>
Mark as cancelled an operation that is in progress rather than pending at the
time it is cancelled, and call fscache_complete_op() to cancel an operation so
that blocked ops can be started.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</content>
</entry>
<entry>
<title>FS-Cache: Don't mask off the object event mask when printing it</title>
<updated>2012-12-20T22:08:53Z</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2012-12-05T13:34:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c2d35bfe4b508451b75b5b6bc60a08dbdc44f952'/>
<id>urn:sha1:c2d35bfe4b508451b75b5b6bc60a08dbdc44f952</id>
<content type='text'>
Don't mask off the object event mask when printing it.  That way it can be seen
if threre are bits set that shouldn't be.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</content>
</entry>
<entry>
<title>CacheFiles: Add missing retrieval completions</title>
<updated>2012-12-20T22:07:40Z</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2012-12-05T13:34:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b4cf1e08c8ac95eff65faa53904f7f13ac78194b'/>
<id>urn:sha1:b4cf1e08c8ac95eff65faa53904f7f13ac78194b</id>
<content type='text'>
CacheFiles is missing some calls to fscache_retrieval_complete() in the error
handling/collision paths of its reader functions.

This can be seen by the following assertion tripping in fscache_put_operation()
whereby the operation being destroyed is still in the in-progress state and has
not been cancelled or completed:

FS-Cache: Assertion failed
3 == 5 is false
------------[ cut here ]------------
kernel BUG at fs/fscache/operation.c:408!
invalid opcode: 0000 [#1] SMP
CPU 2
Modules linked in: xfs ioatdma dca loop joydev evdev
psmouse dcdbas pcspkr serio_raw i5000_edac edac_core i5k_amb shpchp
pci_hotplug sg sr_mod]

Pid: 8062, comm: httpd Not tainted 3.1.0-rc8 #1 Dell Inc. PowerEdge 1950/0DT097
RIP: 0010:[&lt;ffffffff81197b24&gt;]  [&lt;ffffffff81197b24&gt;] fscache_put_operation+0x304/0x330
RSP: 0018:ffff880062f739d8  EFLAGS: 00010296
RAX: 0000000000000025 RBX: ffff8800c5122e84 RCX: ffffffff81ddf040
RDX: 00000000ffffffff RSI: 0000000000000082 RDI: ffffffff81ddef30
RBP: ffff880062f739f8 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000003 R12: ffff8800c5122e40
R13: ffff880037a2cd20 R14: ffff880087c7a058 R15: ffff880087c7a000
FS:  00007f63dcf636e0(0000) GS:ffff88022fc80000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f0c0a91f000 CR3: 0000000062ec2000 CR4: 00000000000006e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process httpd (pid: 8062, threadinfo ffff880062f72000, task ffff880087e58000)
Stack:
 ffff880062f73bf8 0000000000000000 ffff880062f73bf8 ffff880037a2cd20
 ffff880062f73a68 ffffffff8119aa7e ffff88006540e000 ffff880062f73ad4
 ffff88008e9a4308 ffff880037a2cd20 ffff880062f73a48 ffff8800c5122e40
Call Trace:
 [&lt;ffffffff8119aa7e&gt;] __fscache_read_or_alloc_pages+0x1fe/0x530
 [&lt;ffffffff81250780&gt;] __nfs_readpages_from_fscache+0x70/0x1c0
 [&lt;ffffffff8123142a&gt;] nfs_readpages+0xca/0x1e0
 [&lt;ffffffff815f3c06&gt;] ? rpc_do_put_task+0x36/0x50
 [&lt;ffffffff8122755b&gt;] ? alloc_nfs_open_context+0x4b/0x110
 [&lt;ffffffff815ecd1a&gt;] ? rpc_call_sync+0x5a/0x70
 [&lt;ffffffff810e7e9a&gt;] __do_page_cache_readahead+0x1ca/0x270
 [&lt;ffffffff810e7f61&gt;] ra_submit+0x21/0x30
 [&lt;ffffffff810e818d&gt;] ondemand_readahead+0x11d/0x250
 [&lt;ffffffff810e83b6&gt;] page_cache_sync_readahead+0x36/0x60
 [&lt;ffffffff810dffa4&gt;] generic_file_aio_read+0x454/0x770
 [&lt;ffffffff81224ce1&gt;] nfs_file_read+0xe1/0x130
 [&lt;ffffffff81121bd9&gt;] do_sync_read+0xd9/0x120
 [&lt;ffffffff8114088f&gt;] ? mntput+0x1f/0x40
 [&lt;ffffffff811238cb&gt;] ? fput+0x1cb/0x260
 [&lt;ffffffff81122938&gt;] vfs_read+0xc8/0x180
 [&lt;ffffffff81122af5&gt;] sys_read+0x55/0x90

Reported-by: Mark Moseley &lt;moseleymark@gmail.com&gt;
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</content>
</entry>
</feed>
