* [patch] filemap_getpage can block when MAP_NONBLOCK specified
@ 2005-03-30 20:15 Jeff Moyer
0 siblings, 0 replies; only message in thread
From: Jeff Moyer @ 2005-03-30 20:15 UTC (permalink / raw)
To: linux-kernel
Hello,
We will return NULL from filemap_getpage when a page does not exist in the
page cache and MAP_NONBLOCK is specified, here:
page = find_get_page(mapping, pgoff);
if (!page) {
if (nonblock)
return NULL;
goto no_cached_page;
}
But we forget to do so when the page in the cache is not uptodate. The
following could result in a blocking call:
/*
* Ok, found a page in the page cache, now we need to check
* that it's up-to-date.
*/
if (!PageUptodate(page))
goto page_not_uptodate;
Patch attached.
Thanks,
Jeff
--- linux-2.6.11/mm/filemap.c.orig 2005-03-30 14:57:02.252975936 -0500
+++ linux-2.6.11/mm/filemap.c 2005-03-30 15:02:51.808835368 -0500
@@ -1379,8 +1379,13 @@ retry_find:
* Ok, found a page in the page cache, now we need to check
* that it's up-to-date.
*/
- if (!PageUptodate(page))
+ if (!PageUptodate(page)) {
+ if (nonblock) {
+ page_cache_release(page);
+ return NULL;
+ }
goto page_not_uptodate;
+ }
success:
/*
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-03-30 20:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-30 20:15 [patch] filemap_getpage can block when MAP_NONBLOCK specified Jeff Moyer
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®