tree ce0c1d8c68f6f28166d42a34ef9c09294cdc0065
parent 200649c8b05ec4512faa584881ceeef5a2b15742
author Jeff Moyer <[EMAIL PROTECTED]> Tue Apr 12 08:24:40 2005
committer Linus Torvalds <[EMAIL PROTECTED]> Tue Apr 12 08:24:40 2005

[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 <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>

 filemap.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletion(-)

Index: mm/filemap.c
===================================================================
--- 3363f304913080a784a46dafc588a69430d52839/mm/filemap.c  (mode:100644 
sha1:183fc4e5028cabba48b51a6608430183b7d78948)
+++ ce0c1d8c68f6f28166d42a34ef9c09294cdc0065/mm/filemap.c  (mode:100644 
sha1:e4f79b0a7544180ee65b2ea98fa50c32bafd2aa2)
@@ -1379,8 +1379,13 @@
         * 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:
        /*
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to