Btrfs: Add extra checks to avoid removing extent_state from pages we can't free
authorChris Mason <chris.mason@oracle.com>
Fri, 11 Apr 2008 14:51:07 +0000 (10:51 -0400)
committerChris Mason <chris.mason@oracle.com>
Thu, 25 Sep 2008 15:04:01 +0000 (11:04 -0400)
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/disk-io.c

index cf1de75f088a7b0dddef327ad2ea1f7c3eb7a763..e22960e235019fa07dd7a8a2f306af4a3e3be98c 100644 (file)
@@ -436,6 +436,12 @@ static int btree_releasepage(struct page *page, gfp_t gfp_flags)
        struct extent_map_tree *map;
        int ret;
 
+       if (page_count(page) > 3) {
+               /* once for page->private, once for the caller, once
+                * once for the page cache
+                */
+               return 0;
+       }
        tree = &BTRFS_I(page->mapping->host)->io_tree;
        map = &BTRFS_I(page->mapping->host)->extent_tree;
        ret = try_release_extent_mapping(map, tree, page, gfp_flags);