aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Moyer <jmoyer@redhat.com>2005-04-16 15:24:05 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 15:24:05 -0700
commitd345734267dbec642f4e34a9d392d2fd85b5fa9b (patch)
tree9a74f4b8292a696620f95933171ac5ddff970ef9
parent41aac24f8fb5a21ff3d0f6f56f85fad3cf0e88a9 (diff)
[PATCH] filemap_getpage can block when MAP_NONBLOCK specified
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; Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--mm/filemap.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index 439b2bea8e3..93595c327bb 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -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:
/*