diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 1fdc221a9c0b18558370f235e68d05f68a42883a..f50137a98fb1ac524f9c4bbdbd16011e99515f5e 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -4012,16 +4012,17 @@ int btrfs_recover_log_trees(struct btrfs_root *log_root_tree) btrfs_free_path(path); + /* step 4: commit the transaction, which also unpins the blocks */ + ret = btrfs_commit_transaction(trans, fs_info->tree_root); + if (ret) + return ret; + free_extent_buffer(log_root_tree->node); log_root_tree->log_root = NULL; fs_info->log_root_recovering = 0; - - /* step 4: commit the transaction, which also unpins the blocks */ - btrfs_commit_transaction(trans, fs_info->tree_root); - kfree(log_root_tree); - return 0; + return 0; error: btrfs_free_path(path); return ret;