]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
btrfs: free qgroup reserve when ORDERED_IOERR is set
authorBoris Burkov <boris@bur.io>
Fri, 1 Dec 2023 21:00:09 +0000 (13:00 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Dec 2023 16:00:26 +0000 (17:00 +0100)
commit9b670e1b644c845d3a0def23c0cce910c1ed0a00
tree72261c5f34d877a63c894b29b35528d54bfd21b4
parentda9b7c651c6517c2de1099136ed87c0c24f864dd
btrfs: free qgroup reserve when ORDERED_IOERR is set

commit f63e1164b90b385cd832ff0fdfcfa76c3cc15436 upstream.

An ordered extent completing is a critical moment in qgroup reserve
handling, as the ownership of the reservation is handed off from the
ordered extent to the delayed ref. In the happy path we release (unlock)
but do not free (decrement counter) the reservation, and the delayed ref
drives the free. However, on an error, we don't create a delayed ref,
since there is no ref to add. Therefore, free on the error path.

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/ordered-data.c