Commit 2002ae11 authored by Josef Bacik's avatar Josef Bacik Committed by David Sterba
Browse files

btrfs: handle btrfs_record_root_in_trans failure in btrfs_recover_log_trees



btrfs_record_root_in_trans will return errors in the future, so handle
the error properly in btrfs_recover_log_trees.

This appears tricky, however we have a reference count on the
destination root, so if this fails we need to continue on in the loop to
make sure the proper cleanup is done.

Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
[ add comment ]
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 2731f518
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -6280,7 +6280,12 @@ int btrfs_recover_log_trees(struct btrfs_root *log_root_tree)
		}

		wc.replay_dest->log_root = log;
		btrfs_record_root_in_trans(trans, wc.replay_dest);
		ret = btrfs_record_root_in_trans(trans, wc.replay_dest);
		if (ret)
			/* The loop needs to continue due to the root refs */
			btrfs_handle_fs_error(fs_info, ret,
				"failed to record the log root in transaction");
		else
			ret = walk_log_tree(trans, log, &wc);

		if (!ret && wc.stage == LOG_WALK_REPLAY_ALL) {