From: Nick Piggin <nickpiggin@yahoo.com.au>
To: linux-kernel <linux-kernel@vger.kernel.org>,
Linux Memory Management <linux-mm@kvack.org>,
Andrew Morton <akpm@osdl.org>, Jens Axboe <axboe@suse.de>
Subject: read_pages bug?
Date: Sun, 30 Apr 2006 22:08:45 +1000 [thread overview]
Message-ID: <4454A8CD.80907@yahoo.com.au> (raw)
[-- Attachment #1: Type: text/plain, Size: 284 bytes --]
Speaking of read_pages(), doesn't the AOP_TRUNCATED_PAGE case
cause a dangling page which can't get cleaned up because it
is not on the lru (and the file has presumably already been
truncated)?
(also, let's not worry about pretending we propogate errors)
--
SUSE Labs, Novell Inc.
[-- Attachment #2: mm-fix-ra-error.patch --]
[-- Type: text/plain, Size: 1463 bytes --]
Index: linux-2.6/mm/readahead.c
===================================================================
--- linux-2.6.orig/mm/readahead.c 2006-04-30 21:59:09.000000000 +1000
+++ linux-2.6/mm/readahead.c 2006-04-30 22:02:26.000000000 +1000
@@ -164,16 +164,15 @@ int read_cache_pages(struct address_spac
EXPORT_SYMBOL(read_cache_pages);
-static int read_pages(struct address_space *mapping, struct file *filp,
+static void read_pages(struct address_space *mapping, struct file *filp,
struct list_head *pages, unsigned nr_pages)
{
unsigned page_idx;
struct pagevec lru_pvec;
- int ret;
if (mapping->a_ops->readpages) {
- ret = mapping->a_ops->readpages(filp, mapping, pages, nr_pages);
- goto out;
+ mapping->a_ops->readpages(filp, mapping, pages, nr_pages);
+ return;
}
pagevec_init(&lru_pvec, 0);
@@ -182,19 +181,13 @@ static int read_pages(struct address_spa
list_del(&page->lru);
if (!add_to_page_cache(page, mapping,
page->index, GFP_KERNEL)) {
- ret = mapping->a_ops->readpage(filp, page);
- if (ret != AOP_TRUNCATED_PAGE) {
- if (!pagevec_add(&lru_pvec, page))
- __pagevec_lru_add(&lru_pvec);
- continue;
- } /* else fall through to release */
- }
- page_cache_release(page);
+ mapping->a_ops->readpage(filp, page);
+ if (!pagevec_add(&lru_pvec, page))
+ __pagevec_lru_add(&lru_pvec);
+ } else
+ page_cache_release(page);
}
pagevec_lru_add(&lru_pvec);
- ret = 0;
-out:
- return ret;
}
/*
reply other threads:[~2006-04-30 12:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4454A8CD.80907@yahoo.com.au \
--to=nickpiggin@yahoo.com.au \
--cc=akpm@osdl.org \
--cc=axboe@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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