Skip to contentSkip to conversation

reiser4: fix readpage_unix_file

PATCH In review Edward Shishkin 2 participants 2 messages Aug 11, 2007 – Aug 13, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 reiser4: fix readpage_unix_file

Andrew,
please, apply.

Thanks,
Edward.

. 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.

---
 linux-2.6.23-rc1-mm1/fs/reiser4/plugin/file/file.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
fs/reiser4/plugin/file/file.c renamed from fs/reiser4/plugin/file/file.c.orig +6 -2
@@ -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);
#1 lore raw
Quoted 6 lines · Edward Shishkin

Andrew,
please, apply.

Thanks,
Edward.

Quoted 8 lines

. 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.

I applied this patch this weekend. It has fixed the problem I was having. My system backup completed without any of the invalid read errors and all files appear correct. Thank you.

Signature · 1 line
Zan Lynx <[email protected]>