]> www.infradead.org Git - users/dwmw2/linux.git/commit
btrfs: qgroup: correctly model root qgroup rsv in convert
authorBoris Burkov <boris@bur.io>
Tue, 19 Mar 2024 17:54:22 +0000 (10:54 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Apr 2024 09:15:16 +0000 (11:15 +0200)
commit773d38f42bbe5b359620fe6ef8bc7a57e84f96a3
tree9ad990fc5e8f1fe003c77660322d343590e3f7c5
parent23b57c5566097a5a973e0ed9948b51bda5ca9c63
btrfs: qgroup: correctly model root qgroup rsv in convert

commit 141fb8cd206ace23c02cd2791c6da52c1d77d42a upstream.

We use add_root_meta_rsv and sub_root_meta_rsv to track prealloc and
pertrans reservations for subvolumes when quotas are enabled. The
convert function does not properly increment pertrans after decrementing
prealloc, so the count is not accurate.

Note: we check that the fs is not read-only to mirror the logic in
qgroup_convert_meta, which checks that before adding to the pertrans rsv.

Fixes: 8287475a2055 ("btrfs: qgroup: Use root::qgroup_meta_rsv_* to record qgroup meta reserved space")
CC: stable@vger.kernel.org # 6.1+
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Boris Burkov <boris@bur.io>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/qgroup.c