From d4a6c73aac2abfa828fdf06ae617c33b3758404b Mon Sep 17 00:00:00 2001 From: David Sterba Date: Tue, 23 Aug 2016 19:24:48 +0200 Subject: [PATCH] btrfs-progs: convert: improve error hanling of init_btrfs Replace BUG_ONs and verbosely report the errors. Signed-off-by: David Sterba --- btrfs-convert.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/btrfs-convert.c b/btrfs-convert.c index 66f62e8..d2ff517 100644 --- a/btrfs-convert.c +++ b/btrfs-convert.c @@ -1298,7 +1298,11 @@ static int init_btrfs(struct btrfs_mkfs_config *cfg, struct btrfs_root *root, fs_info->avoid_sys_chunk_alloc = 1; fs_info->avoid_meta_chunk_alloc = 1; trans = btrfs_start_transaction(root, 1); - BUG_ON(!trans); + if (!trans) { + error("unable to start transaction"); + ret = -EINVAL; + goto err; + } ret = btrfs_fix_block_accounting(trans, root); if (ret) goto err; -- 2.7.4