[PATCH] reiser4: fix readpage_unix_file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Signed-off-by: Edward Shishkin <edward@xxxxxxxxxxx> 
---
 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);


[Index of Archives]     [Linux File System Development]     [Linux BTRFS]     [Linux NFS]     [Linux Filesystems]     [Ext4 Filesystem]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Resources]

  Powered by Linux