All of lore.kernel.org
 help / color / mirror / Atom feed
From: Edward Shishkin <edward@namesys.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Vladimir V. Saveliev" <vs@namesys.com>, Zan Lynx <zlynx@acm.org>,
	reiserfs-devel <reiserfs-devel@vger.kernel.org>
Subject: [PATCH] reiser4: fix readpage_unix_file
Date: Sun, 12 Aug 2007 00:02:23 +0400	[thread overview]
Message-ID: <46BE15CF.50605@namesys.com> (raw)

[-- 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);


             reply	other threads:[~2007-08-11 20:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-11 20:02 Edward Shishkin [this message]
2007-08-13 16:37 ` [PATCH] reiser4: fix readpage_unix_file Zan Lynx

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46BE15CF.50605@namesys.com \
    --to=edward@namesys.com \
    --cc=akpm@linux-foundation.org \
    --cc=reiserfs-devel@vger.kernel.org \
    --cc=vs@namesys.com \
    --cc=zlynx@acm.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.