From: Pete Zaitcev <zaitcev@redhat.com>
To: <brugolsky@telemetry-investments.com>
Cc: zaitcev@redhat.com, SteveD@redhat.com,
linux-kernel@vger.kernel.org, <torvalds@osdl.org>
Subject: Re: [PATCH] nfs client O_DIRECT oops
Date: Mon, 28 Feb 2005 17:00:16 -0800 [thread overview]
Message-ID: <20050228170016.0c26a109@localhost.localdomain> (raw)
In-Reply-To: <42236AC6.6000609@RedHat.com>
On Mon, 28 Feb 2005 14:02:30 -0500, Steve Dickson <SteveD@redhat.com> wrote:
> Discovered using AKPM's ext3-tools: odwrite -ko 0 16385 foo
> Signed-off-by: Bill Rugolsky <brugolsky@telemetry-investments.com>
> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
The root cause of the bug is that the code violates the principle of the
least surprise, which in this case is: if a function fails, you do not have
to clean up for that function. Therefore, Bill's fix papers over instead
of fixing.
This is how I think it should have been fixed:
--- linux-2.6.9-5.EL/fs/nfs/direct.c 2004-10-18 14:55:07.000000000 -0700
+++ linux-2.6.9-5.EL-nfs/fs/nfs/direct.c 2005-02-28 16:48:54.000000000 -0800
@@ -86,6 +86,8 @@
page_count, (rw == READ), 0,
*pages, NULL);
up_read(¤t->mm->mmap_sem);
+ if (result < 0)
+ kfree(*pages);
}
return result;
}
@@ -211,7 +213,6 @@
page_count = nfs_get_user_pages(READ, user_addr, size, &pages);
if (page_count < 0) {
- nfs_free_user_pages(pages, 0, 0);
if (tot_bytes > 0)
break;
return page_count;
@@ -377,7 +378,6 @@
page_count = nfs_get_user_pages(WRITE, user_addr, size, &pages);
if (page_count < 0) {
- nfs_free_user_pages(pages, 0, 0);
if (tot_bytes > 0)
break;
return page_count;
Best wishes,
-- Pete
next parent reply other threads:[~2005-03-01 1:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <42236AC6.6000609@RedHat.com>
2005-03-01 1:00 ` Pete Zaitcev [this message]
2005-03-01 1:17 ` Linus Torvalds
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=20050228170016.0c26a109@localhost.localdomain \
--to=zaitcev@redhat.com \
--cc=SteveD@redhat.com \
--cc=brugolsky@telemetry-investments.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®