From: Edward Shishkin . If nominated (by VFS) page is out of file size, then fill it by zeros instead of returning -EINVAL (this prevents returning an unexpected error (-EINVAL) by some apps that don't check file size). . Check if the page became uptodate while it was being unlocked. Signed-off-by: Edward Shishkin Cc: Zan Lynx Cc: "Vladimir V. Saveliev" Signed-off-by: Andrew Morton --- fs/reiser4/plugin/file/file.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff -puN fs/reiser4/plugin/file/file.c~reiser4-fix-readpage_unix_file fs/reiser4/plugin/file/file.c --- a/fs/reiser4/plugin/file/file.c~reiser4-fix-readpage_unix_file +++ a/fs/reiser4/plugin/file/file.c @@ -1435,9 +1435,11 @@ int readpage_unix_file(struct file *file assert("vs-1061", page->mapping && page->mapping->host); if (page->mapping->host->i_size <= page_offset(page)) { - /* page is out of file already */ + /* page is out of file */ + zero_user_page(page, 0, PAGE_CACHE_SIZE, KM_USER0); + SetPageUptodate(page); unlock_page(page); - return -EINVAL; + return 0; } inode = page->mapping->host; @@ -1624,6 +1626,8 @@ static int uf_readpages_filler(void * da if (unlikely(ret)) goto exit; lock_page(page); + if (PageUptodate(page)) + goto unlock; cbk_done = 1; } ret = zload(rc->coord.node); _