Btrfs: return -ENOMEM in clear_extent_bit
authorChris Mason <chris.mason@oracle.com>
Thu, 26 May 2011 21:43:59 +0000 (17:43 -0400)
committerChris Mason <chris.mason@oracle.com>
Thu, 26 May 2011 21:52:44 +0000 (17:52 -0400)
The btrfs releasepage function depends on ENOMEM coming
back when it is called atomic.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/extent_io.c

index a90c4a12556b12bc432057fc1576fa209f19fbd5..0e0fe0f6ec751713979124fb175594ebc6e60308 100644 (file)
@@ -485,7 +485,8 @@ int clear_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
 again:
        if (!prealloc && (mask & __GFP_WAIT)) {
                prealloc = alloc_extent_state(mask);
-               BUG_ON(!prealloc);
+               if (!prealloc)
+                       return -ENOMEM;
        }
 
        spin_lock(&tree->lock);