public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Ram Pai <linuxram@us.ibm.com>
Cc: Hugh Dickins <hugh@veritas.com>, Gergely Tamas <dice@mfa.kfki.hu>,
	Denis Vlasenko <vda@port.imtp.ilyichevsk.odessa.ua>,
	Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org
Subject: Re: data loss in 2.6.9-rc1-mm1
Date: Sat, 28 Aug 2004 14:35:14 +1000	[thread overview]
Message-ID: <41300B82.8080203@yahoo.com.au> (raw)
In-Reply-To: <1093640668.11648.50.camel@dyn319181.beaverton.ibm.com>

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

Ram Pai wrote:
> 
> got it!  Everything got changed to the new convention except that
> the calculation of 'nr' just before the check "nr <= offset" .
> 
> I have generated this patch which takes care of that and hence fixes the
> data loss problem as well. I guess it is cleaner too. 
> 
> This patch is generated w.r.t 2.6.8.1. If everybody blesses this patch I
> will forward it to Andrew.

It looks like it should be OK... but at what point does it become
simpler to use my patch which just moves the original calculation
up, and does it again if we have to ->readpage()?

(assuming you agree that it solves the problem)


[-- Attachment #2: mm-gmr-fix.patch --]
[-- Type: text/x-patch, Size: 1565 bytes --]




---

 linux-2.6-npiggin/mm/filemap.c |   29 ++++++++++++++++++-----------
 1 files changed, 18 insertions(+), 11 deletions(-)

diff -puN mm/filemap.c~mm-gmr-fix mm/filemap.c
--- linux-2.6/mm/filemap.c~mm-gmr-fix	2004-08-28 14:14:02.000000000 +1000
+++ linux-2.6-npiggin/mm/filemap.c	2004-08-28 14:32:59.000000000 +1000
@@ -724,6 +724,15 @@ void do_generic_mapping_read(struct addr
 		struct page *page;
 		unsigned long nr, ret;
 
+		/* nr is the maximum number of bytes to copy from this page */
+		nr = PAGE_CACHE_SIZE;
+		if (index == end_index) {
+			nr = isize & ~PAGE_CACHE_MASK;
+			if (nr <= offset)
+				goto out;
+		}
+		nr = nr - offset;
+
 		cond_resched();
 		page_cache_readahead(mapping, &ra, filp, index);
 
@@ -736,17 +745,6 @@ find_page:
 		if (!PageUptodate(page))
 			goto page_not_up_to_date;
 page_ok:
-		/* nr is the maximum number of bytes to copy from this page */
-		nr = PAGE_CACHE_SIZE;
-		if (index == end_index) {
-			nr = isize & ~PAGE_CACHE_MASK;
-			if (nr <= offset) {
-				page_cache_release(page);
-				goto out;
-			}
-		}
-		nr = nr - offset;
-
 		/* If users can be writing to this page using arbitrary
 		 * virtual addresses, take care about potential aliasing
 		 * before reading the page on the kernel side.
@@ -826,6 +824,15 @@ readpage:
 			page_cache_release(page);
 			goto out;
 		}
+		nr = PAGE_CACHE_SIZE;
+		if (index == end_index) {
+			nr = isize & ~PAGE_CACHE_MASK;
+			if (nr <= offset) {
+				page_cache_release(page);
+				goto out;
+			}
+		}
+		nr = nr - offset;
 		goto page_ok;
 
 readpage_error:

_

  reply	other threads:[~2004-08-28  4:36 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-27 10:55 data loss in 2.6.9-rc1-mm1 Gergely Tamas
2004-08-27 11:05 ` Anton Altaparmakov
2004-08-27 11:40   ` Gergely Tamas
2004-08-27 12:35   ` Fabio Coatti
2004-08-27 11:17 ` Tim Schmielau
2004-08-27 11:43   ` Gergely Tamas
2004-08-27 11:37 ` Mikael Pettersson
2004-08-27 11:55 ` Denis Vlasenko
2004-08-27 13:56   ` Hugh Dickins
2004-08-27 14:18     ` Gergely Tamas
2004-08-27 15:36       ` Fabio Coatti
2004-08-27 18:30     ` Ram Pai
2004-08-27 19:08       ` Hugh Dickins
2004-08-27 21:04         ` Ram Pai
2004-08-28  4:35           ` Nick Piggin [this message]
2004-08-28  5:01             ` Ram Pai
2004-08-28  5:42               ` Andrew Morton
2004-08-28  5:54               ` Nick Piggin
2004-08-28  9:44                 ` Rafael J. Wysocki
2004-08-28  9:45                   ` Andrew Morton
2004-08-28 10:18                     ` Nick Piggin
2004-08-28 10:47                       ` Rafael J. Wysocki
2004-08-28 14:52                 ` Hugh Dickins
2004-08-29  1:30                   ` Nick Piggin
2004-08-31  6:25                     ` Ram Pai
2004-08-31  6:39                       ` Andrew Morton
  -- strict thread matches above, loose matches on Subject: below --
2004-08-28 12:05 Joachim Bremer

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=41300B82.8080203@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=akpm@osdl.org \
    --cc=dice@mfa.kfki.hu \
    --cc=hugh@veritas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxram@us.ibm.com \
    --cc=vda@port.imtp.ilyichevsk.odessa.ua \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox