]> git.karo-electronics.de Git - karo-tx-linux.git/commit
nilfs2: fix data loss in mmap page write for hole blocks
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Sun, 27 Mar 2011 13:50:49 +0000 (22:50 +0900)
committerPaul Gortmaker <paul.gortmaker@windriver.com>
Wed, 14 Mar 2012 14:56:56 +0000 (10:56 -0400)
commit58066c381153035a6707222e374a5438438f5a3b
treef07715be3e893c1a95a6e62ac24be2794a15e321
parent966347cc1137aba0f641c2d00fda974d6d51391c
nilfs2: fix data loss in mmap page write for hole blocks

commit 34094537943113467faee98fe67c8a3d3f9a0a8b upstream.

From the result of a function test of mmap, mmap write to shared pages
turned out to be broken for hole blocks.  It doesn't write out filled
blocks and the data will be lost after umount.  This is due to a bug
that the target file is not queued for log writer when filling hole
blocks.

Also, nilfs_page_mkwrite function exits normal code path even after
successfully filled hole blocks due to a change of block_page_mkwrite
function; just after nilfs was merged into the mainline,
block_page_mkwrite() started to return VM_FAULT_LOCKED instead of zero
by the patch "mm: close page_mkwrite races" (commit:
b827e496c893de0c).  The current nilfs_page_mkwrite() is not handling
this value properly.

This corrects nilfs_page_mkwrite() and will resolve the data loss
problem in mmap write.

[This should be applied to every kernel since 2.6.30 but a fix is
 needed for 2.6.37 and prior kernels]

[PG: add sb as 1st arg to nilfs_set_file_dirty() as per 34 codebase]

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Tested-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
fs/nilfs2/file.c