]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
btrfs: qgroup: Fix root item corruption when multiple same source snapshots are creat...
authorQu Wenruo <wqu@suse.com>
Tue, 19 Dec 2017 07:44:54 +0000 (15:44 +0800)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Mon, 27 Aug 2018 14:40:05 +0000 (16:40 +0200)
commita07a3cf76d57873683e63d4c4909c4ebef546247
tree6f213f6a55c7e01aa7d94adad9d350257165d044
parent1617fd64670dd5104536e50ef0524b04eaa14b0f
btrfs: qgroup: Fix root item corruption when multiple same source snapshots are created with quota enabled

BugLink: http://bugs.launchpad.net/bugs/1786352
[ Upstream commit 4d31778aa2fa342f5f92ca4025b293a1729161d1 ]

When multiple pending snapshots referring to the same source subvolume
are executed, enabled quota will cause root item corruption, where root
items are using old bytenr (no backref in extent tree).

This can be triggered by fstests btrfs/152.

The cause is when source subvolume is still dirty, extra commit
(simplied transaction commit) of qgroup_account_snapshot() can skip
dirty roots not recorded in current transaction, making root item of
source subvolume not updated.

Fix it by forcing recording source subvolume in current transaction
before qgroup sub-transaction commit.

Reported-by: Justin Maggard <jmaggard@netgear.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
fs/btrfs/transaction.c