Unionfs: mmap fixes
authorHugh Dickins <hugh@veritas.com>
Tue, 25 Dec 2007 20:31:13 +0000 (15:31 -0500)
committerErez Zadok <ezk@cs.sunysb.edu>
Sun, 27 Apr 2014 02:26:07 +0000 (22:26 -0400)
commite25d19cf9eb9e8afd160365acedaeb82212a90bc
treee02d27a2a1ce96aabd5913cb0443705f92833994
parentb1481b3f83c73bdcd83294b3ed4bb2e7b09f5bcf
Unionfs: mmap fixes

Remove !mapping_cap_writeback_dirty shortcircuit from unionfs_writepages.

It was introduced to avoid the stray AOP_WRITEPAGE_ACTIVATE coming from
shmem_writepage; but that has since been fixed in shmem_writepage and in
write_cache_pages.  It stayed because it looked like a good optimization,
not to waste time calling down to tmpfs when that would serve no purpose.

But in fact this optimization causes hangs when running LTP with unionfs
over tmpfs.  The problem is that the test comes at the wrong level: unionfs
has already declared in its default_backing_dev_info that it's playing by
cap_writeback_dirty rules.  If it does nothing here in its writepages, its
dirty pages accumulate and choke the system.  What's needed is to carry on
down and let its pages be cleaned while in turn they dirty the lower level.

And this now has an additional benefit for tmpfs, that a sync or pdflush
pushes these pages down to shmem_writepage, letting it match the filepage
coming from unionfs with the swap which may have been allocated earlier,
so it can free the duplication sooner than waiting for further pressure.

Remove unnecessary locking/code from prepare_write.  Handle if no lower
inodes in writepage.

Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
fs/unionfs/mmap.c