btrfs-progs: handle transaction start failure in set_label_unmounted()
Do proper error handling and use the template error message when setting the label fails. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
3b560a6649
commit
dbc7d6aa19
|
@ -98,7 +98,10 @@ static int set_label_unmounted(const char *dev, const char *label)
|
|||
return -1;
|
||||
|
||||
trans = btrfs_start_transaction(root, 1);
|
||||
BUG_ON(IS_ERR(trans));
|
||||
if (IS_ERR(trans)) {
|
||||
error_msg(ERROR_MSG_START_TRANS, "set label");
|
||||
return PTR_ERR(trans);
|
||||
}
|
||||
__strncpy_null(root->fs_info->super_copy->label, label, BTRFS_LABEL_SIZE - 1);
|
||||
|
||||
btrfs_commit_transaction(trans, root);
|
||||
|
|
Loading…
Reference in New Issue