diff options
author | Boris Burkov <boris@bur.io> | 2023-12-01 13:00:09 -0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2023-12-06 22:32:40 +0100 |
commit | f63e1164b90b385cd832ff0fdfcfa76c3cc15436 (patch) | |
tree | 2ddef0ef594b5e497f4a1b291e413185c95187ec /fs/btrfs/ordered-data.c | |
parent | 0ac1d13a55eb37d398b63e6ff6db4a09a2c9128c (diff) | |
download | lwn-f63e1164b90b385cd832ff0fdfcfa76c3cc15436.tar.gz lwn-f63e1164b90b385cd832ff0fdfcfa76c3cc15436.zip |
btrfs: free qgroup reserve when ORDERED_IOERR is set
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>
Diffstat (limited to 'fs/btrfs/ordered-data.c')
-rw-r--r-- | fs/btrfs/ordered-data.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c index 574e8a55e24a..8620ff402de4 100644 --- a/fs/btrfs/ordered-data.c +++ b/fs/btrfs/ordered-data.c @@ -599,7 +599,9 @@ void btrfs_remove_ordered_extent(struct btrfs_inode *btrfs_inode, release = entry->disk_num_bytes; else release = entry->num_bytes; - btrfs_delalloc_release_metadata(btrfs_inode, release, false); + btrfs_delalloc_release_metadata(btrfs_inode, release, + test_bit(BTRFS_ORDERED_IOERR, + &entry->flags)); } percpu_counter_add_batch(&fs_info->ordered_bytes, -entry->num_bytes, |