aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/tree-log.c
diff options
context:
space:
mode:
authorFilipe Manana <[email protected]>2025-05-21 16:41:18 +0000
committerDavid Sterba <[email protected]>2025-07-21 21:50:28 +0000
commit2a5898c4aac67494c2f0f7fe38373c95c371c930 (patch)
treedd373614f470dcf95109022daed3db686ed7f7ba /fs/btrfs/tree-log.c
parentbtrfs: unfold transaction aborts when replaying log trees (diff)
downloadkernel-2a5898c4aac67494c2f0f7fe38373c95c371c930.tar.gz
kernel-2a5898c4aac67494c2f0f7fe38373c95c371c930.zip
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: [email protected] # 6.1+ Reviewed-by: Qu Wenruo <[email protected]> Signed-off-by: Filipe Manana <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
Diffstat (limited to 'fs/btrfs/tree-log.c')
-rw-r--r--fs/btrfs/tree-log.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index fea978ffadf6..6a60f072c365 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -7283,11 +7283,14 @@ again:
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,