]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
btrfs: remove btrfs_handle_fs_error() after failure to recover log trees
authorFilipe Manana <fdmanana@suse.com>
Mon, 9 Feb 2026 15:47:57 +0000 (15:47 +0000)
committerDavid Sterba <dsterba@suse.com>
Thu, 26 Feb 2026 14:03:26 +0000 (15:03 +0100)
There is no need to call btrfs_handle_fs_error() (which we are trying to
deprecate) if we fail to recover log trees:

1) Such a failure results in failing the mount immediately;

2) If the recovery started a transaction before failing, it has already
   aborted the transaction down in the call chain.

So remove the btrfs_handle_fs_error() call, replace it with an error
message and assert that the FS is in error state (so that no partial
updates are committed due to a transaction that was not aborted).

Reviewed-by: Qu Wenruo <wqu@suse.com>
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/disk-io.c

index b855e2cec2ecb143bfb17aeb41135d5bc801586a..e6574456a3066f403466531034ebbea2df88e6a8 100644 (file)
@@ -2023,9 +2023,9 @@ static int btrfs_replay_log(struct btrfs_fs_info *fs_info,
        /* returns with log_tree_root freed on success */
        ret = btrfs_recover_log_trees(log_tree_root);
        btrfs_put_root(log_tree_root);
-       if (ret) {
-               btrfs_handle_fs_error(fs_info, ret,
-                                     "Failed to recover log tree");
+       if (unlikely(ret)) {
+               ASSERT(BTRFS_FS_ERROR(fs_info) != 0);
+               btrfs_err(fs_info, "failed to recover log trees with error: %d", ret);
                return ret;
        }