Commit 2a5898c4 authored by Filipe Manana's avatar Filipe Manana Committed by David Sterba
Browse files

btrfs: abort transaction during log replay if walk_log_tree() failed



If we failed walking a log tree during replay, we have a missing
transaction abort to prevent committing a transaction where we didn't
fully replay all the changes from a log tree and therefore can leave the
respective subvolume tree in some inconsistent state. So add the missing
transaction abort.

CC: stable@vger.kernel.org # 6.1+
Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 8f1e1b26
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -7283,11 +7283,14 @@ int btrfs_recover_log_trees(struct btrfs_root *log_root_tree)

		wc.replay_dest->log_root = log;
		ret = btrfs_record_root_in_trans(trans, wc.replay_dest);
		if (ret)
		if (ret) {
			/* The loop needs to continue due to the root refs */
			btrfs_abort_transaction(trans, ret);
		else
		} else {
			ret = walk_log_tree(trans, log, &wc);
			if (ret)
				btrfs_abort_transaction(trans, ret);
		}

		if (!ret && wc.stage == LOG_WALK_REPLAY_ALL) {
			ret = fixup_inode_link_counts(trans, wc.replay_dest,