mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git
synced 2024-11-16 00:34:32 +08:00
btrfs-progs: mkfs: catch errors after transaction start
Replace missing or BUG_ON in main(). Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
a5afa55a30
commit
8cb5ff857a
9
mkfs.c
9
mkfs.c
@ -1697,7 +1697,10 @@ int main(int ac, char **av)
|
||||
}
|
||||
|
||||
trans = btrfs_start_transaction(root, 1);
|
||||
BUG_ON(!trans);
|
||||
if (!trans) {
|
||||
fprintf(stderr, "failed to start transaction\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ret = create_data_block_groups(trans, root, mixed, &allocation);
|
||||
if (ret) {
|
||||
@ -1714,6 +1717,10 @@ int main(int ac, char **av)
|
||||
btrfs_commit_transaction(trans, root);
|
||||
|
||||
trans = btrfs_start_transaction(root, 1);
|
||||
if (!trans) {
|
||||
fprintf(stderr, "failed to start transaction\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (is_block_device(file))
|
||||
btrfs_register_one_device(file);
|
||||
|
Loading…
Reference in New Issue
Block a user