From: Filipe Manana Date: Thu, 8 Jun 2023 10:27:43 +0000 (+0100) Subject: btrfs: avoid unnecessarily setting the fs to RO and error state at balance_level() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=87b8e9d06e3315c6f8d478fc8fc0dc4d25cf0e09;p=linux.git btrfs: avoid unnecessarily setting the fs to RO and error state at balance_level() At balance_level(), when trying to promote a child node to a root node, if we fail to read the child we call btrfs_handle_fs_error(), which turns the fs to RO mode and sets it to error state as well, causing any ongoing transaction to abort. This however is not necessary because at that point we have not made any change yet at balance_level(), so any error reading the child node does not leaves us in any inconsistent state. Therefore we can just return the error to the caller. Reviewed-by: Qu Wenruo Signed-off-by: Filipe Manana Reviewed-by: David Sterba Signed-off-by: David Sterba --- diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index e98f9e205e25a..4dcdcf25c3fe0 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -1040,7 +1040,6 @@ static noinline int balance_level(struct btrfs_trans_handle *trans, child = btrfs_read_node_slot(mid, 0); if (IS_ERR(child)) { ret = PTR_ERR(child); - btrfs_handle_fs_error(fs_info, ret, NULL); goto out; }