]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
btrfs: unfold transaction aborts when writing dirty block groups
authorFilipe Manana <fdmanana@suse.com>
Fri, 18 Jul 2025 17:14:40 +0000 (18:14 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 21 Jul 2025 23:14:08 +0000 (01:14 +0200)
We have a single transaction abort call that can be due to an error from
one of two calls to update_block_group_item(). Unfold the transaction
abort calls so that if they happen we know which update_block_group_item()
call failed.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/block-group.c

index 47c6d040176c2b2678fc62a2d25bf5d76e6094f9..9bf282d2453c02ddfe5eed5526dc79f3775d1c0c 100644 (file)
@@ -3644,9 +3644,11 @@ int btrfs_write_dirty_block_groups(struct btrfs_trans_handle *trans)
                                wait_event(cur_trans->writer_wait,
                                   atomic_read(&cur_trans->num_writers) == 1);
                                ret = update_block_group_item(trans, path, cache);
-                       }
-                       if (ret)
+                               if (ret)
+                                       btrfs_abort_transaction(trans, ret);
+                       } else if (ret) {
                                btrfs_abort_transaction(trans, ret);
+                       }
                }
 
                /* If its not on the io list, we need to put the block group */