All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] reiser4: fix readpage_unix_file
@ 2007-08-11 20:02 Edward Shishkin
  2007-08-13 16:37 ` Zan Lynx
  0 siblings, 1 reply; 2+ messages in thread
From: Edward Shishkin @ 2007-08-11 20:02 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Vladimir V. Saveliev, Zan Lynx, reiserfs-devel

[-- Attachment #1: Type: text/plain, Size: 40 bytes --]

Andrew,
please, apply.

Thanks,
Edward.

[-- Attachment #2: reiser4-fix-readpage_unix_file.patch --]
[-- Type: text/x-patch, Size: 1118 bytes --]

. 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 <edward@namesys.com> 
---
 linux-2.6.23-rc1-mm1/fs/reiser4/plugin/file/file.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

--- linux-2.6.23-rc1-mm1/fs/reiser4/plugin/file/file.c.orig
+++ linux-2.6.23-rc1-mm1/fs/reiser4/plugin/file/file.c
@@ -1436,9 +1436,11 @@
 	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;
@@ -1625,6 +1627,8 @@
 		if (unlikely(ret))
 			goto exit;
 		lock_page(page);
+		if (PageUptodate(page))
+			goto unlock;
 		cbk_done = 1;
 	}
 	ret = zload(rc->coord.node);


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-08-13 16:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-11 20:02 [PATCH] reiser4: fix readpage_unix_file Edward Shishkin
2007-08-13 16:37 ` Zan Lynx

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.