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>
This commit is contained in:
parent
92b8e897f6
commit
38a1a91953
|
@ -6272,10 +6272,14 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
|
||||||
int level;
|
int level;
|
||||||
|
|
||||||
path = btrfs_alloc_path();
|
path = btrfs_alloc_path();
|
||||||
BUG_ON(!path);
|
if (!path)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
wc = kzalloc(sizeof(*wc), GFP_NOFS);
|
wc = kzalloc(sizeof(*wc), GFP_NOFS);
|
||||||
BUG_ON(!wc);
|
if (!wc) {
|
||||||
|
btrfs_free_path(path);
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
trans = btrfs_start_transaction(tree_root, 0);
|
trans = btrfs_start_transaction(tree_root, 0);
|
||||||
BUG_ON(IS_ERR(trans));
|
BUG_ON(IS_ERR(trans));
|
||||||
|
|
Loading…
Reference in New Issue