]> Pileus Git - ~andy/linux/commitdiff
Btrfs: Check for NULL page in extent_range_uptodate
authorMitch Harder <mitch.harder@sabayonlinux.org>
Thu, 26 Jan 2012 20:01:11 +0000 (15:01 -0500)
committerChris Mason <chris.mason@oracle.com>
Thu, 26 Jan 2012 20:01:11 +0000 (15:01 -0500)
A user has encountered a NULL pointer kernel oops in btrfs when
encountering media errors.  The problem has been identified
as an unhandled NULL pointer returned from find_get_page().
This modification simply checks for a NULL page, and returns
with an error if found (the extent_range_uptodate() function
returns 1 on errors).

After testing this patch, the user reported that the error with
the NULL pointer oops was solved.  However, there is still a
remaining problem with a thread becoming stuck in
wait_on_page_locked(page) in the read_extent_buffer_pages(...)
function in extent_io.c

       for (i = start_i; i < num_pages; i++) {
               page = extent_buffer_page(eb, i);
               wait_on_page_locked(page);
               if (!PageUptodate(page))
                       ret = -EIO;
       }

This patch leaves the issue with the locked page yet to be resolved.

Signed-off-by: Mitch Harder <mitch.harder@sabayonlinux.org>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/extent_io.c

index 9d09a4f81875817ebc45a7c5b80cbe6008061b22..fcf77e1ded40e8d47ed8f64742d8139a61295023 100644 (file)
@@ -3909,6 +3909,8 @@ int extent_range_uptodate(struct extent_io_tree *tree,
        while (start <= end) {
                index = start >> PAGE_CACHE_SHIFT;
                page = find_get_page(tree->mapping, index);
+               if (!page)
+                       return 1;
                uptodate = PageUptodate(page);
                page_cache_release(page);
                if (!uptodate) {