]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
btrfs: set update the uuid generation as soon as possible
authorJosef Bacik <josef@toxicpanda.com>
Fri, 14 Feb 2020 20:22:06 +0000 (15:22 -0500)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 29 Apr 2020 12:56:07 +0000 (14:56 +0200)
commitcfd80bb2aa4da829288dfbaff1cfbd39fa10e8d2
treebe21452d7015f7e437878c8bdc25b37909afab18
parent80b308b99dfbd121814c2022e148304b966f78f5
btrfs: set update the uuid generation as soon as possible

BugLink: https://bugs.launchpad.net/bugs/1874502
commit 75ec1db8717a8f0a9d9c8d033e542fdaa7b73898 upstream.

In my EIO stress testing I noticed I was getting forced to rescan the
uuid tree pretty often, which was weird.  This is because my error
injection stuff would sometimes inject an error after log replay but
before we loaded the UUID tree.  If log replay committed the transaction
it wouldn't have updated the uuid tree generation, but the tree was
valid and didn't change, so there's no reason to not update the
generation here.

Fix this by setting the BTRFS_FS_UPDATE_UUID_TREE_GEN bit immediately
after reading all the fs roots if the uuid tree generation matches the
fs generation.  Then any transaction commits that happen during mount
won't screw up our uuid tree state, forcing us to do needless uuid
rescans.

Fixes: 70f801754728 ("Btrfs: check UUID tree during mount if required")
CC: stable@vger.kernel.org # 4.19+
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
fs/btrfs/disk-io.c