aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
authorMark Fasheh <mfasheh@suse.com>2011-07-13 13:59:59 -0400
committerMark Fasheh <mfasheh@suse.com>2011-07-25 17:35:15 -0400
commit38a1a919535742af677303271eb4ff731547b706 (patch)
treebfefad00f864e8239b94607a3d712200fd825eaa /fs/btrfs/extent-tree.c
parent92b8e897f6e7ba4aa10037ebd8186f85d39330d0 (diff)
btrfs: don't BUG_ON allocation errors in btrfs_drop_snapshot
In addition to properly handling allocation failure from btrfs_alloc_path, I also fixed up the kzalloc error handling code immediately below it. Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r--fs/btrfs/extent-tree.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index f6af4236e59b..6bce721e7bbc 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -6272,10 +6272,14 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
6272 int level; 6272 int level;
6273 6273
6274 path = btrfs_alloc_path(); 6274 path = btrfs_alloc_path();
6275 BUG_ON(!path); 6275 if (!path)
6276 return -ENOMEM;
6276 6277
6277 wc = kzalloc(sizeof(*wc), GFP_NOFS); 6278 wc = kzalloc(sizeof(*wc), GFP_NOFS);
6278 BUG_ON(!wc); 6279 if (!wc) {
6280 btrfs_free_path(path);
6281 return -ENOMEM;
6282 }
6279 6283
6280 trans = btrfs_start_transaction(tree_root, 0); 6284 trans = btrfs_start_transaction(tree_root, 0);
6281 BUG_ON(IS_ERR(trans)); 6285 BUG_ON(IS_ERR(trans));