From 68d4ece9c30e966ebb92798ea54a7777daff384b Mon Sep 17 00:00:00 2001 From: Filipe Manana Date: Tue, 16 Dec 2025 16:27:57 +0000 Subject: [PATCH] btrfs: don't call btrfs_handle_fs_error() in btrfs_commit_transaction() There's no need to call btrfs_handle_fs_error() as we are inside a transaction and if we get an error we jump to the 'scrub_continue' label and end up calling cleanup_transaction(), which aborts the transaction. This is odd given that we have a transaction handle and that in the transaction commit path any error makes us abort the transaction and it's the only place that calls btrfs_handle_fs_error(). Remove the btrfs_handle_fs_error() call and replace it with an error message so that if it happens we know what went wrong during the transaction commit. Also annotate the condition in the if statement with 'unlikely' since this is not expected to happen. We've been wanting to remove btrfs_handle_fs_error(), so this removes one user that does not even needs it. Reviewed-by: Johannes Thumshirn Signed-off-by: Filipe Manana Reviewed-by: David Sterba Signed-off-by: David Sterba --- fs/btrfs/transaction.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index a2a1c0aaeb759..d29d32dff6e31 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -2550,9 +2550,8 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans) wake_up_process(fs_info->cleaner_kthread); ret = btrfs_write_and_wait_transaction(trans); - if (ret) { - btrfs_handle_fs_error(fs_info, ret, - "Error while writing out transaction"); + if (unlikely(ret)) { + btrfs_err(fs_info, "error while writing out transaction: %d", ret); mutex_unlock(&fs_info->tree_log_mutex); goto scrub_continue; } -- 2.47.3