<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/fs/afs/file.c, branch v3.4.9</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>AFS: checking wrong bit in afs_readpages()</title>
<updated>2012-03-20T18:14:38+00:00</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@oracle.com</email>
</author>
<published>2012-03-20T16:58:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=ad2a8e6078a16d3b61b530f1447110841c36ae56'/>
<id>ad2a8e6078a16d3b61b530f1447110841c36ae56</id>
<content type='text'>
We should be testing "if (vnode-&gt;flags &amp; (1 &lt;&lt; 4))" instead of
"if (vnode-&gt;flags &amp; 4) {".  The current test checks if the data was
modified instead of deleted.

Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We should be testing "if (vnode-&gt;flags &amp; (1 &lt;&lt; 4))" instead of
"if (vnode-&gt;flags &amp; 4) {".  The current test checks if the data was
modified instead of deleted.

Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>AFS: Don't put struct file on the stack</title>
<updated>2010-05-21T22:31:28+00:00</updated>
<author>
<name>Al Viro</name>
<email>viro@ZenIV.linux.org.uk</email>
</author>
<published>2010-05-21T14:27:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=f6d335c08df48b318187a087c9c38ba3d416e115'/>
<id>f6d335c08df48b318187a087c9c38ba3d416e115</id>
<content type='text'>
Don't put struct file on the stack as it takes up quite a lot of space
and violates lifetime rules for struct file.

Rather than calling afs_readpage() indirectly from the directory routines by
way of read_mapping_page(), split afs_readpage() to have afs_page_filler()
that's given a key instead of a file and call read_cache_page(), specifying the
new function directly.  Use it in afs_readpages() as well.

Also make use of this in afs_mntpt_check_symlink() too for the same reason.

Reported-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Don't put struct file on the stack as it takes up quite a lot of space
and violates lifetime rules for struct file.

Rather than calling afs_readpage() indirectly from the directory routines by
way of read_mapping_page(), split afs_readpage() to have afs_page_filler()
that's given a key instead of a file and call read_cache_page(), specifying the
new function directly.  Use it in afs_readpages() as well.

Also make use of this in afs_mntpt_check_symlink() too for the same reason.

Reported-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h</title>
<updated>2010-03-30T13:02:32+00:00</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2010-03-24T08:04:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=5a0e3ad6af8660be21ca98a971cd00f331318c05'/>
<id>5a0e3ad6af8660be21ca98a971cd00f331318c05</id>
<content type='text'>
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files.  percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -&gt; slab.h dependency is about to be removed.  Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability.  As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

  http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
  only the necessary includes are there.  ie. if only gfp is used,
  gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
  blocks and try to put the new include such that its order conforms
  to its surrounding.  It's put in the include block which contains
  core kernel includes, in the same order that the rest are ordered -
  alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
  doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
  because the file doesn't have fitting include block), it prints out
  an error message indicating which .h file needs to be added to the
  file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
   over 4000 files, deleting around 700 includes and adding ~480 gfp.h
   and ~3000 slab.h inclusions.  The script emitted errors for ~400
   files.

2. Each error was manually checked.  Some didn't need the inclusion,
   some needed manual addition while adding it to implementation .h or
   embedding .c file was more appropriate for others.  This step added
   inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
   from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
   e.g. lib/decompress_*.c used malloc/free() wrappers around slab
   APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
   editing them as sprinkling gfp.h and slab.h inclusions around .h
   files could easily lead to inclusion dependency hell.  Most gfp.h
   inclusion directives were ignored as stuff from gfp.h was usually
   wildly available and often used in preprocessor macros.  Each
   slab.h inclusion directive was examined and added manually as
   necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
   were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
   distributed build env didn't work with gcov compiles) and a few
   more options had to be turned off depending on archs to make things
   build (like ipr on powerpc/64 which failed due to missing writeq).

   * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
   * powerpc and powerpc64 SMP allmodconfig
   * sparc and sparc64 SMP allmodconfig
   * ia64 SMP allmodconfig
   * s390 SMP allmodconfig
   * alpha SMP allmodconfig
   * um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
   a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Guess-its-ok-by: Christoph Lameter &lt;cl@linux-foundation.org&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Lee Schermerhorn &lt;Lee.Schermerhorn@hp.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files.  percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -&gt; slab.h dependency is about to be removed.  Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability.  As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

  http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
  only the necessary includes are there.  ie. if only gfp is used,
  gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
  blocks and try to put the new include such that its order conforms
  to its surrounding.  It's put in the include block which contains
  core kernel includes, in the same order that the rest are ordered -
  alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
  doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
  because the file doesn't have fitting include block), it prints out
  an error message indicating which .h file needs to be added to the
  file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
   over 4000 files, deleting around 700 includes and adding ~480 gfp.h
   and ~3000 slab.h inclusions.  The script emitted errors for ~400
   files.

2. Each error was manually checked.  Some didn't need the inclusion,
   some needed manual addition while adding it to implementation .h or
   embedding .c file was more appropriate for others.  This step added
   inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
   from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
   e.g. lib/decompress_*.c used malloc/free() wrappers around slab
   APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
   editing them as sprinkling gfp.h and slab.h inclusions around .h
   files could easily lead to inclusion dependency hell.  Most gfp.h
   inclusion directives were ignored as stuff from gfp.h was usually
   wildly available and often used in preprocessor macros.  Each
   slab.h inclusion directive was examined and added manually as
   necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
   were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
   distributed build env didn't work with gcov compiles) and a few
   more options had to be turned off depending on archs to make things
   build (like ipr on powerpc/64 which failed due to missing writeq).

   * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
   * powerpc and powerpc64 SMP allmodconfig
   * sparc and sparc64 SMP allmodconfig
   * ia64 SMP allmodconfig
   * s390 SMP allmodconfig
   * alpha SMP allmodconfig
   * um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
   a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Guess-its-ok-by: Christoph Lameter &lt;cl@linux-foundation.org&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Lee Schermerhorn &lt;Lee.Schermerhorn@hp.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>FS-Cache: Handle pages pending storage that get evicted under OOM conditions</title>
<updated>2009-11-19T18:11:35+00:00</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2009-11-19T18:11:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=201a15428bd54f83eccec8b7c64a04b8f9431204'/>
<id>201a15428bd54f83eccec8b7c64a04b8f9431204</id>
<content type='text'>
Handle netfs pages that the vmscan algorithm wants to evict from the pagecache
under OOM conditions, but that are waiting for write to the cache.  Under these
conditions, vmscan calls the releasepage() function of the netfs, asking if a
page can be discarded.

The problem is typified by the following trace of a stuck process:

	kslowd005     D 0000000000000000     0  4253      2 0x00000080
	 ffff88001b14f370 0000000000000046 ffff880020d0d000 0000000000000007
	 0000000000000006 0000000000000001 ffff88001b14ffd8 ffff880020d0d2a8
	 000000000000ddf0 00000000000118c0 00000000000118c0 ffff880020d0d2a8
	Call Trace:
	 [&lt;ffffffffa00782d8&gt;] __fscache_wait_on_page_write+0x8b/0xa7 [fscache]
	 [&lt;ffffffff8104c0f1&gt;] ? autoremove_wake_function+0x0/0x34
	 [&lt;ffffffffa0078240&gt;] ? __fscache_check_page_write+0x63/0x70 [fscache]
	 [&lt;ffffffffa00b671d&gt;] nfs_fscache_release_page+0x4e/0xc4 [nfs]
	 [&lt;ffffffffa00927f0&gt;] nfs_release_page+0x3c/0x41 [nfs]
	 [&lt;ffffffff810885d3&gt;] try_to_release_page+0x32/0x3b
	 [&lt;ffffffff81093203&gt;] shrink_page_list+0x316/0x4ac
	 [&lt;ffffffff8109372b&gt;] shrink_inactive_list+0x392/0x67c
	 [&lt;ffffffff813532fa&gt;] ? __mutex_unlock_slowpath+0x100/0x10b
	 [&lt;ffffffff81058df0&gt;] ? trace_hardirqs_on_caller+0x10c/0x130
	 [&lt;ffffffff8135330e&gt;] ? mutex_unlock+0x9/0xb
	 [&lt;ffffffff81093aa2&gt;] shrink_list+0x8d/0x8f
	 [&lt;ffffffff81093d1c&gt;] shrink_zone+0x278/0x33c
	 [&lt;ffffffff81052d6c&gt;] ? ktime_get_ts+0xad/0xba
	 [&lt;ffffffff81094b13&gt;] try_to_free_pages+0x22e/0x392
	 [&lt;ffffffff81091e24&gt;] ? isolate_pages_global+0x0/0x212
	 [&lt;ffffffff8108e743&gt;] __alloc_pages_nodemask+0x3dc/0x5cf
	 [&lt;ffffffff81089529&gt;] grab_cache_page_write_begin+0x65/0xaa
	 [&lt;ffffffff8110f8c0&gt;] ext3_write_begin+0x78/0x1eb
	 [&lt;ffffffff81089ec5&gt;] generic_file_buffered_write+0x109/0x28c
	 [&lt;ffffffff8103cb69&gt;] ? current_fs_time+0x22/0x29
	 [&lt;ffffffff8108a509&gt;] __generic_file_aio_write+0x350/0x385
	 [&lt;ffffffff8108a588&gt;] ? generic_file_aio_write+0x4a/0xae
	 [&lt;ffffffff8108a59e&gt;] generic_file_aio_write+0x60/0xae
	 [&lt;ffffffff810b2e82&gt;] do_sync_write+0xe3/0x120
	 [&lt;ffffffff8104c0f1&gt;] ? autoremove_wake_function+0x0/0x34
	 [&lt;ffffffff810b18e1&gt;] ? __dentry_open+0x1a5/0x2b8
	 [&lt;ffffffff810b1a76&gt;] ? dentry_open+0x82/0x89
	 [&lt;ffffffffa00e693c&gt;] cachefiles_write_page+0x298/0x335 [cachefiles]
	 [&lt;ffffffffa0077147&gt;] fscache_write_op+0x178/0x2c2 [fscache]
	 [&lt;ffffffffa0075656&gt;] fscache_op_execute+0x7a/0xd1 [fscache]
	 [&lt;ffffffff81082093&gt;] slow_work_execute+0x18f/0x2d1
	 [&lt;ffffffff8108239a&gt;] slow_work_thread+0x1c5/0x308
	 [&lt;ffffffff8104c0f1&gt;] ? autoremove_wake_function+0x0/0x34
	 [&lt;ffffffff810821d5&gt;] ? slow_work_thread+0x0/0x308
	 [&lt;ffffffff8104be91&gt;] kthread+0x7a/0x82
	 [&lt;ffffffff8100beda&gt;] child_rip+0xa/0x20
	 [&lt;ffffffff8100b87c&gt;] ? restore_args+0x0/0x30
	 [&lt;ffffffff8102ef83&gt;] ? tg_shares_up+0x171/0x227
	 [&lt;ffffffff8104be17&gt;] ? kthread+0x0/0x82
	 [&lt;ffffffff8100bed0&gt;] ? child_rip+0x0/0x20

In the above backtrace, the following is happening:

 (1) A page storage operation is being executed by a slow-work thread
     (fscache_write_op()).

 (2) FS-Cache farms the operation out to the cache to perform
     (cachefiles_write_page()).

 (3) CacheFiles is then calling Ext3 to perform the actual write, using Ext3's
     standard write (do_sync_write()) under KERNEL_DS directly from the netfs
     page.

 (4) However, for Ext3 to perform the write, it must allocate some memory, in
     particular, it must allocate at least one page cache page into which it
     can copy the data from the netfs page.

 (5) Under OOM conditions, the memory allocator can't immediately come up with
     a page, so it uses vmscan to find something to discard
     (try_to_free_pages()).

 (6) vmscan finds a clean netfs page it might be able to discard (possibly the
     one it's trying to write out).

 (7) The netfs is called to throw the page away (nfs_release_page()) - but it's
     called with __GFP_WAIT, so the netfs decides to wait for the store to
     complete (__fscache_wait_on_page_write()).

 (8) This blocks a slow-work processing thread - possibly against itself.

The system ends up stuck because it can't write out any netfs pages to the
cache without allocating more memory.

To avoid this, we make FS-Cache cancel some writes that aren't in the middle of
actually being performed.  This means that some data won't make it into the
cache this time.  To support this, a new FS-Cache function is added
fscache_maybe_release_page() that replaces what the netfs releasepage()
functions used to do with respect to the cache.

The decisions fscache_maybe_release_page() makes are counted and displayed
through /proc/fs/fscache/stats on a line labelled "VmScan".  There are four
counters provided: "nos=N" - pages that weren't pending storage; "gon=N" -
pages that were pending storage when we first looked, but weren't by the time
we got the object lock; "bsy=N" - pages that we ignored as they were actively
being written when we looked; and "can=N" - pages that we cancelled the storage
of.

What I'd really like to do is alter the behaviour of the cancellation
heuristics, depending on how necessary it is to expel pages.  If there are
plenty of other pages that aren't waiting to be written to the cache that
could be ejected first, then it would be nice to hold up on immediate
cancellation of cache writes - but I don't see a way of doing that.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Handle netfs pages that the vmscan algorithm wants to evict from the pagecache
under OOM conditions, but that are waiting for write to the cache.  Under these
conditions, vmscan calls the releasepage() function of the netfs, asking if a
page can be discarded.

The problem is typified by the following trace of a stuck process:

	kslowd005     D 0000000000000000     0  4253      2 0x00000080
	 ffff88001b14f370 0000000000000046 ffff880020d0d000 0000000000000007
	 0000000000000006 0000000000000001 ffff88001b14ffd8 ffff880020d0d2a8
	 000000000000ddf0 00000000000118c0 00000000000118c0 ffff880020d0d2a8
	Call Trace:
	 [&lt;ffffffffa00782d8&gt;] __fscache_wait_on_page_write+0x8b/0xa7 [fscache]
	 [&lt;ffffffff8104c0f1&gt;] ? autoremove_wake_function+0x0/0x34
	 [&lt;ffffffffa0078240&gt;] ? __fscache_check_page_write+0x63/0x70 [fscache]
	 [&lt;ffffffffa00b671d&gt;] nfs_fscache_release_page+0x4e/0xc4 [nfs]
	 [&lt;ffffffffa00927f0&gt;] nfs_release_page+0x3c/0x41 [nfs]
	 [&lt;ffffffff810885d3&gt;] try_to_release_page+0x32/0x3b
	 [&lt;ffffffff81093203&gt;] shrink_page_list+0x316/0x4ac
	 [&lt;ffffffff8109372b&gt;] shrink_inactive_list+0x392/0x67c
	 [&lt;ffffffff813532fa&gt;] ? __mutex_unlock_slowpath+0x100/0x10b
	 [&lt;ffffffff81058df0&gt;] ? trace_hardirqs_on_caller+0x10c/0x130
	 [&lt;ffffffff8135330e&gt;] ? mutex_unlock+0x9/0xb
	 [&lt;ffffffff81093aa2&gt;] shrink_list+0x8d/0x8f
	 [&lt;ffffffff81093d1c&gt;] shrink_zone+0x278/0x33c
	 [&lt;ffffffff81052d6c&gt;] ? ktime_get_ts+0xad/0xba
	 [&lt;ffffffff81094b13&gt;] try_to_free_pages+0x22e/0x392
	 [&lt;ffffffff81091e24&gt;] ? isolate_pages_global+0x0/0x212
	 [&lt;ffffffff8108e743&gt;] __alloc_pages_nodemask+0x3dc/0x5cf
	 [&lt;ffffffff81089529&gt;] grab_cache_page_write_begin+0x65/0xaa
	 [&lt;ffffffff8110f8c0&gt;] ext3_write_begin+0x78/0x1eb
	 [&lt;ffffffff81089ec5&gt;] generic_file_buffered_write+0x109/0x28c
	 [&lt;ffffffff8103cb69&gt;] ? current_fs_time+0x22/0x29
	 [&lt;ffffffff8108a509&gt;] __generic_file_aio_write+0x350/0x385
	 [&lt;ffffffff8108a588&gt;] ? generic_file_aio_write+0x4a/0xae
	 [&lt;ffffffff8108a59e&gt;] generic_file_aio_write+0x60/0xae
	 [&lt;ffffffff810b2e82&gt;] do_sync_write+0xe3/0x120
	 [&lt;ffffffff8104c0f1&gt;] ? autoremove_wake_function+0x0/0x34
	 [&lt;ffffffff810b18e1&gt;] ? __dentry_open+0x1a5/0x2b8
	 [&lt;ffffffff810b1a76&gt;] ? dentry_open+0x82/0x89
	 [&lt;ffffffffa00e693c&gt;] cachefiles_write_page+0x298/0x335 [cachefiles]
	 [&lt;ffffffffa0077147&gt;] fscache_write_op+0x178/0x2c2 [fscache]
	 [&lt;ffffffffa0075656&gt;] fscache_op_execute+0x7a/0xd1 [fscache]
	 [&lt;ffffffff81082093&gt;] slow_work_execute+0x18f/0x2d1
	 [&lt;ffffffff8108239a&gt;] slow_work_thread+0x1c5/0x308
	 [&lt;ffffffff8104c0f1&gt;] ? autoremove_wake_function+0x0/0x34
	 [&lt;ffffffff810821d5&gt;] ? slow_work_thread+0x0/0x308
	 [&lt;ffffffff8104be91&gt;] kthread+0x7a/0x82
	 [&lt;ffffffff8100beda&gt;] child_rip+0xa/0x20
	 [&lt;ffffffff8100b87c&gt;] ? restore_args+0x0/0x30
	 [&lt;ffffffff8102ef83&gt;] ? tg_shares_up+0x171/0x227
	 [&lt;ffffffff8104be17&gt;] ? kthread+0x0/0x82
	 [&lt;ffffffff8100bed0&gt;] ? child_rip+0x0/0x20

In the above backtrace, the following is happening:

 (1) A page storage operation is being executed by a slow-work thread
     (fscache_write_op()).

 (2) FS-Cache farms the operation out to the cache to perform
     (cachefiles_write_page()).

 (3) CacheFiles is then calling Ext3 to perform the actual write, using Ext3's
     standard write (do_sync_write()) under KERNEL_DS directly from the netfs
     page.

 (4) However, for Ext3 to perform the write, it must allocate some memory, in
     particular, it must allocate at least one page cache page into which it
     can copy the data from the netfs page.

 (5) Under OOM conditions, the memory allocator can't immediately come up with
     a page, so it uses vmscan to find something to discard
     (try_to_free_pages()).

 (6) vmscan finds a clean netfs page it might be able to discard (possibly the
     one it's trying to write out).

 (7) The netfs is called to throw the page away (nfs_release_page()) - but it's
     called with __GFP_WAIT, so the netfs decides to wait for the store to
     complete (__fscache_wait_on_page_write()).

 (8) This blocks a slow-work processing thread - possibly against itself.

The system ends up stuck because it can't write out any netfs pages to the
cache without allocating more memory.

To avoid this, we make FS-Cache cancel some writes that aren't in the middle of
actually being performed.  This means that some data won't make it into the
cache this time.  To support this, a new FS-Cache function is added
fscache_maybe_release_page() that replaces what the netfs releasepage()
functions used to do with respect to the cache.

The decisions fscache_maybe_release_page() makes are counted and displayed
through /proc/fs/fscache/stats on a line labelled "VmScan".  There are four
counters provided: "nos=N" - pages that weren't pending storage; "gon=N" -
pages that were pending storage when we first looked, but weren't by the time
we got the object lock; "bsy=N" - pages that we ignored as they were actively
being written when we looked; and "can=N" - pages that we cancelled the storage
of.

What I'd really like to do is alter the behaviour of the cancellation
heuristics, depending on how necessary it is to expel pages.  If there are
plenty of other pages that aren't waiting to be written to the cache that
could be ejected first, then it would be nice to hold up on immediate
cancellation of cache writes - but I don't see a way of doing that.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>AFS: Stop readlink() on AFS crashing due to NULL 'file' ptr</title>
<updated>2009-08-27T19:22:08+00:00</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2009-08-27T12:09:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=9886e836a6a5dbd273dc55b17e713f0a188d137f'/>
<id>9886e836a6a5dbd273dc55b17e713f0a188d137f</id>
<content type='text'>
kAFS crashes when asked to read a symbolic link because page_getlink()
passes a NULL file pointer to read_mapping_page(), but afs_readpage()
expects a file pointer from which to extract a key.

Modify afs_readpage() to request the appropriate key from the calling
process's keyrings if a file struct is not supplied with one attached.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Acked-by: Anton Blanchard &lt;anton@samba.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
kAFS crashes when asked to read a symbolic link because page_getlink()
passes a NULL file pointer to read_mapping_page(), but afs_readpage()
expects a file pointer from which to extract a key.

Modify afs_readpage() to request the appropriate key from the calling
process's keyrings if a file struct is not supplied with one attached.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Acked-by: Anton Blanchard &lt;anton@samba.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>AFS: Guard afs_file_readpage_read_complete() definition with CONFIG_AFS_FSCACHE</title>
<updated>2009-04-17T16:55:19+00:00</updated>
<author>
<name>Matt Kraai</name>
<email>kraai@ftbfs.org</email>
</author>
<published>2009-04-17T11:56:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=6566abdbd0566fc1b5950c9f87ef57c7443d6fa8'/>
<id>6566abdbd0566fc1b5950c9f87ef57c7443d6fa8</id>
<content type='text'>
If CONFIG_AFS_FSCACHE is not defined, the following warning is displayed when
fs/afs/file.c is compiled:

 fs/afs/file.c:111: warning: ‘afs_file_readpage_read_complete’ defined but not used

This occurs because all calls to this function are guarded by
CONFIG_AFS_FSCACHE.  Thus, guard its definition as well.

Signed-off-by: Matt Kraai &lt;kraai@ftbfs.org&gt;
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If CONFIG_AFS_FSCACHE is not defined, the following warning is displayed when
fs/afs/file.c is compiled:

 fs/afs/file.c:111: warning: ‘afs_file_readpage_read_complete’ defined but not used

This occurs because all calls to this function are guarded by
CONFIG_AFS_FSCACHE.  Thus, guard its definition as well.

Signed-off-by: Matt Kraai &lt;kraai@ftbfs.org&gt;
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>FS-Cache: Make kAFS use FS-Cache</title>
<updated>2009-04-03T15:42:41+00:00</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2009-04-03T15:42:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=9b3f26c9110dcea62716aca9b8c68ceb482227ef'/>
<id>9b3f26c9110dcea62716aca9b8c68ceb482227ef</id>
<content type='text'>
The attached patch makes the kAFS filesystem in fs/afs/ use FS-Cache, and
through it any attached caches.  The kAFS filesystem will use caching
automatically if it's available.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Acked-by: Steve Dickson &lt;steved@redhat.com&gt;
Acked-by: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
Acked-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Tested-by: Daire Byrne &lt;Daire.Byrne@framestore.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The attached patch makes the kAFS filesystem in fs/afs/ use FS-Cache, and
through it any attached caches.  The kAFS filesystem will use caching
automatically if it's available.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Acked-by: Steve Dickson &lt;steved@redhat.com&gt;
Acked-by: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
Acked-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Tested-by: Daire Byrne &lt;Daire.Byrne@framestore.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>afs: convert to new aops</title>
<updated>2008-10-16T18:21:48+00:00</updated>
<author>
<name>Nick Piggin</name>
<email>npiggin@suse.de</email>
</author>
<published>2008-10-16T05:04:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=15b4650e55e06d2cc05115767551cd3ace875431'/>
<id>15b4650e55e06d2cc05115767551cd3ace875431</id>
<content type='text'>
Cannot assume writes will fully complete, so this conversion goes the easy
way and always brings the page uptodate before the write.

[dhowells@redhat.com: style tweaks]
Signed-off-by: Nick Piggin &lt;npiggin@suse.de&gt;
Acked-by: 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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Cannot assume writes will fully complete, so this conversion goes the easy
way and always brings the page uptodate before the write.

[dhowells@redhat.com: style tweaks]
Signed-off-by: Nick Piggin &lt;npiggin@suse.de&gt;
Acked-by: 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;
</pre>
</div>
</content>
</entry>
<entry>
<title>AFS: implement file locking</title>
<updated>2007-07-16T16:05:43+00:00</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2007-07-16T06:40:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=e8d6c554126b830217c5e9f549e0e21f865a0a8a'/>
<id>e8d6c554126b830217c5e9f549e0e21f865a0a8a</id>
<content type='text'>
Implement file locking for AFS.

Signed-off-by: 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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Implement file locking for AFS.

Signed-off-by: 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;
</pre>
</div>
</content>
</entry>
<entry>
<title>sendfile: remove .sendfile from filesystems that use generic_file_sendfile()</title>
<updated>2007-07-10T06:04:13+00:00</updated>
<author>
<name>Jens Axboe</name>
<email>jens.axboe@oracle.com</email>
</author>
<published>2007-06-01T09:49:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=5ffc4ef45b3b0a57872f631b4e4ceb8ace0d7496'/>
<id>5ffc4ef45b3b0a57872f631b4e4ceb8ace0d7496</id>
<content type='text'>
They can use generic_file_splice_read() instead. Since sys_sendfile() now
prefers that, there should be no change in behaviour.

Signed-off-by: Jens Axboe &lt;jens.axboe@oracle.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
They can use generic_file_splice_read() instead. Since sys_sendfile() now
prefers that, there should be no change in behaviour.

Signed-off-by: Jens Axboe &lt;jens.axboe@oracle.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
