]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
btrfs: clear log tree recovering status if starting transaction fails
authorDavid Sterba <dsterba@suse.com>
Tue, 7 Jul 2020 16:38:05 +0000 (18:38 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 13 Aug 2021 07:45:30 +0000 (09:45 +0200)
BugLink: https://bugs.launchpad.net/bugs/1938199
[ Upstream commit 1aeb6b563aea18cd55c73cf666d1d3245a00f08c ]

When a log recovery is in progress, lots of operations have to take that
into account, so we keep this status per tree during the operation. Long
time ago error handling revamp patch 79787eaab461 ("btrfs: replace many
BUG_ONs with proper error handling") removed clearing of the status in
an error branch. Add it back as was intended in e02119d5a7b4 ("Btrfs:
Add a write ahead tree log to optimize synchronous operations").

There are probably no visible effects, log replay is done only during
mount and if it fails all structures are cleared so the stale status
won't be kept.

Fixes: 79787eaab461 ("btrfs: replace many BUG_ONs with proper error handling")
Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
fs/btrfs/tree-log.c

index 4ff381c23cefc23fd9a35d0234a03bbe2674f471..afc6731bb692c5c2b9adaf46cb89d8c18197b118 100644 (file)
@@ -6327,6 +6327,7 @@ next:
 error:
        if (wc.trans)
                btrfs_end_transaction(wc.trans);
+       clear_bit(BTRFS_FS_LOG_RECOVERING, &fs_info->flags);
        btrfs_free_path(path);
        return ret;
 }