From: Filipe Manana Date: Tue, 16 Dec 2025 16:01:01 +0000 (+0000) Subject: btrfs: don't call btrfs_handle_fs_error() in qgroup_account_snapshot() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d15a190d9efd59398ff08133238268784090066d;p=thirdparty%2Fkernel%2Flinux.git btrfs: don't call btrfs_handle_fs_error() in qgroup_account_snapshot() There's no need to call btrfs_handle_fs_error() as we are inside a transaction and we propagate the error returned from btrfs_write_and_wait_transaction() to the caller and it ends going up the call chain to btrfs_commit_transaction() (returned by the call to create_pending_snapshots()), where we jump to the 'unlock_reloc' 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, besides another place inside btrfs_commit_transaction(), 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 need it. Reviewed-by: Johannes Thumshirn Signed-off-by: Filipe Manana Reviewed-by: David Sterba Signed-off-by: David Sterba --- diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index bd03f465e2d3e..a2a1c0aaeb759 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -1621,9 +1621,9 @@ static int qgroup_account_snapshot(struct btrfs_trans_handle *trans, goto out; switch_commit_roots(trans); ret = btrfs_write_and_wait_transaction(trans); - if (ret) - btrfs_handle_fs_error(fs_info, ret, - "Error while writing out transaction for qgroup"); + if (unlikely(ret)) + btrfs_err(fs_info, +"error while writing out transaction during qgroup snapshot accounting: %d", ret); out: /*