btrfs_record_root_in_trans will return errors in the future, so handle the error properly in start_transaction.
Reviewed-by: Qu Wenruo <[email protected]> Signed-off-by: Josef Bacik <[email protected]> --- fs/btrfs/transaction.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index eba48578159e..307a73abe86d 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -734,7 +734,11 @@ start_transaction(struct btrfs_root *root, unsigned int num_items, * Thus it need to be called after current->journal_info initialized, * or we can deadlock. */ - btrfs_record_root_in_trans(h, root); + ret = btrfs_record_root_in_trans(h, root); + if (ret) { + btrfs_end_transaction(h); + return ERR_PTR(ret); + } return h; -- 2.26.2
