From: Ram Pai <linuxram@us.ibm.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Phillip Lougher <phillip@lougher.demon.co.uk>,
<nickpiggin@yahoo.com.au>, <linux-kernel@vger.kernel.org>,
<viro@parcelfarce.linux.theplanet.co.uk>
Subject: [PATCH] Re: [PATCH] VFS readahead bug in 2.6.8-rc[1-3]
Date: Mon, 16 Aug 2004 00:55:45 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.44.0408160052110.20970-200000@localhost.localdomain> (raw)
In-Reply-To: <20040806124609.3d489a0d.akpm@osdl.org>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 755 bytes --]
On Fri, 6 Aug 2004, Andrew Morton wrote:
> Phillip Lougher <phillip@lougher.demon.co.uk> wrote:
> >
> > Nick Piggin wrote:
> >
> > > No, I suggest you start to code assuming this interface does
> > > what it does. I didn't say there is no bug here, but nobody
> > > else's filesystem breaks.
> > >
> >
> > To stop this silly argument from escalating, I will patch my code.
> >
>
> Well I don't think it's silly.
>
> We are deterministically asking the fs to read a page which lies outside
> EOF, and we shouldn't. If for no other reason than that the ever-popular
> "read a million 4k files" workload will consume extra CPU and twice the
> pagecache.
Andrew,
Enclosed a patch developed with Nick Piggin. It takes care of the
bug.
Thanks,
RP
[-- Attachment #2: Type: TEXT/PLAIN, Size: 611 bytes --]
--- ram/linux-2.6.8.1/mm/filemap.c 2004-08-14 03:56:25.000000000 -0700
+++ linux-2.6.8.1/mm/filemap.c 2004-08-16 07:56:31.912038720 -0700
@@ -665,14 +665,18 @@ void do_generic_mapping_read(struct addr
offset = *ppos & ~PAGE_CACHE_MASK;
isize = i_size_read(inode);
- end_index = isize >> PAGE_CACHE_SHIFT;
- if (index > end_index)
+ if (!isize)
goto out;
+
+ end_index = isize >> PAGE_CACHE_SHIFT;
for (;;) {
struct page *page;
unsigned long nr, ret;
+ if (index > end_index)
+ goto out;
+
cond_resched();
page_cache_readahead(mapping, &ra, filp, index);
next prev parent reply other threads:[~2004-08-16 7:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-05 17:50 Phillip Lougher
2004-08-06 0:55 ` Nick Piggin
2004-08-06 2:19 ` Nick Piggin
2004-08-06 16:58 ` Phillip Lougher
2004-08-06 18:58 ` Nick Piggin
2004-08-06 19:14 ` Phillip Lougher
2004-08-06 19:31 ` viro
2004-08-06 19:18 ` Phillip Lougher
2004-08-06 19:46 ` Andrew Morton
2004-08-16 7:55 ` Ram Pai [this message]
2004-08-07 14:21 ` Pozsar Balazs
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=Pine.LNX.4.44.0408160052110.20970-200000@localhost.localdomain \
--to=linuxram@us.ibm.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nickpiggin@yahoo.com.au \
--cc=phillip@lougher.demon.co.uk \
--cc=viro@parcelfarce.linux.theplanet.co.uk \
/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®