btrfs: make btrfs_clear_delalloc_extent() free delalloc reserve
authorBoris Burkov <boris@bur.io>
Tue, 26 Mar 2024 18:55:22 +0000 (11:55 -0700)
committerDavid Sterba <dsterba@suse.com>
Tue, 2 Apr 2024 17:19:08 +0000 (19:19 +0200)
Currently, this call site in btrfs_clear_delalloc_extent() only converts
the reservation. We are marking it not delalloc, so I don't think it
makes sense to keep the rsv around.  This is a path where we are not
sure to join a transaction, so it leads to incorrect free-ing during
umount.

Helps with the pass rate of generic/269 and generic/475.

Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Boris Burkov <boris@bur.io>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode.c

index 1f9e74c4161d313c9770919b5136d9bc7de5cd0f..c65fe5de40220d3b51003bb73b3e6414eaefba08 100644 (file)
@@ -2533,7 +2533,7 @@ void btrfs_clear_delalloc_extent(struct btrfs_inode *inode,
                 */
                if (bits & EXTENT_CLEAR_META_RESV &&
                    root != fs_info->tree_root)
-                       btrfs_delalloc_release_metadata(inode, len, false);
+                       btrfs_delalloc_release_metadata(inode, len, true);
 
                /* For sanity tests. */
                if (btrfs_is_testing(fs_info))