This is a note to let you know that I've just added the patch titled btrfs: don't clear qgroup reserved bit in release_folio to the 6.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: btrfs-don-t-clear-qgroup-reserved-bit-in-release_folio.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From a86805504b88f636a6458520d85afdf0634e3c6b Mon Sep 17 00:00:00 2001 From: Boris Burkov <boris@xxxxxx> Date: Fri, 1 Dec 2023 13:00:12 -0800 Subject: btrfs: don't clear qgroup reserved bit in release_folio From: Boris Burkov <boris@xxxxxx> commit a86805504b88f636a6458520d85afdf0634e3c6b upstream. The EXTENT_QGROUP_RESERVED bit is used to "lock" regions of the file for duplicate reservations. That is two writes to that range in one transaction shouldn't create two reservations, as the reservation will only be freed once when the write finally goes down. Therefore, it is never OK to clear that bit without freeing the associated qgroup reserve. At this point, we don't want to be freeing the reserve, so mask off the bit. CC: stable@xxxxxxxxxxxxxxx # 5.15+ Reviewed-by: Qu Wenruo <wqu@xxxxxxxx> Signed-off-by: Boris Burkov <boris@xxxxxx> Signed-off-by: David Sterba <dsterba@xxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/btrfs/extent_io.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -3390,7 +3390,8 @@ static int try_release_extent_state(stru ret = 0; } else { u32 clear_bits = ~(EXTENT_LOCKED | EXTENT_NODATASUM | - EXTENT_DELALLOC_NEW | EXTENT_CTLBITS); + EXTENT_DELALLOC_NEW | EXTENT_CTLBITS | + EXTENT_QGROUP_RESERVED); /* * At this point we can safely clear everything except the Patches currently in stable-queue which might be from boris@xxxxxx are queue-6.1/btrfs-don-t-clear-qgroup-reserved-bit-in-release_folio.patch queue-6.1/btrfs-free-qgroup-reserve-when-ordered_ioerr-is-set.patch