Commit 26a4480e authored by Hirofumi Ogawa's avatar Hirofumi Ogawa Committed by Linus Torvalds

[PATCH] cont_prepare_write() fix

When cont_prepare_write() is padding out the "hole" with zeroed pages it
doesn't increase i_size at the same time.  If writeback comes in during the
execution of cont_prepare_write(), block_write_full_page() will think that
these pages are outside i_size and will just clean the page without writing
it.

Fix that up by using generic_commit_write(), which will advance i_size for
each page as it is dirtied.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 68569b74
...@@ -2224,8 +2224,7 @@ int cont_prepare_write(struct page *page, unsigned offset, ...@@ -2224,8 +2224,7 @@ int cont_prepare_write(struct page *page, unsigned offset,
memset(kaddr+zerofrom, 0, PAGE_CACHE_SIZE-zerofrom); memset(kaddr+zerofrom, 0, PAGE_CACHE_SIZE-zerofrom);
flush_dcache_page(new_page); flush_dcache_page(new_page);
kunmap_atomic(kaddr, KM_USER0); kunmap_atomic(kaddr, KM_USER0);
__block_commit_write(inode, new_page, generic_commit_write(NULL, new_page, zerofrom, PAGE_CACHE_SIZE);
zerofrom, PAGE_CACHE_SIZE);
unlock_page(new_page); unlock_page(new_page);
page_cache_release(new_page); page_cache_release(new_page);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment