Skip to content

Commit f63e116

Browse files
boryaskdave
authored andcommitted
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: [email protected] # 6.1+ Reviewed-by: Qu Wenruo <[email protected]> Signed-off-by: Boris Burkov <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 0ac1d13 commit f63e116

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fs/btrfs/ordered-data.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,9 @@ void btrfs_remove_ordered_extent(struct btrfs_inode *btrfs_inode,
599599
release = entry->disk_num_bytes;
600600
else
601601
release = entry->num_bytes;
602-
btrfs_delalloc_release_metadata(btrfs_inode, release, false);
602+
btrfs_delalloc_release_metadata(btrfs_inode, release,
603+
test_bit(BTRFS_ORDERED_IOERR,
604+
&entry->flags));
603605
}
604606

605607
percpu_counter_add_batch(&fs_info->ordered_bytes, -entry->num_bytes,

0 commit comments

Comments
 (0)