]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-6.6/btrfs-always-clear-pertrans-metadata-during-commit.patch
Fixes for 6.6
[thirdparty/kernel/stable-queue.git] / queue-6.6 / btrfs-always-clear-pertrans-metadata-during-commit.patch
1 From 40dea1f1767d2717b8fb7ab72cc6214103ce0102 Mon Sep 17 00:00:00 2001
2 From: Sasha Levin <sashal@kernel.org>
3 Date: Tue, 26 Mar 2024 12:01:28 -0700
4 Subject: btrfs: always clear PERTRANS metadata during commit
5
6 From: Boris Burkov <boris@bur.io>
7
8 [ Upstream commit 6e68de0bb0ed59e0554a0c15ede7308c47351e2d ]
9
10 It is possible to clear a root's IN_TRANS tag from the radix tree, but
11 not clear its PERTRANS, if there is some error in between. Eliminate
12 that possibility by moving the free up to where we clear the tag.
13
14 Reviewed-by: Qu Wenruo <wqu@suse.com>
15 Signed-off-by: Boris Burkov <boris@bur.io>
16 Signed-off-by: David Sterba <dsterba@suse.com>
17 Signed-off-by: Sasha Levin <sashal@kernel.org>
18 ---
19 fs/btrfs/transaction.c | 2 +-
20 1 file changed, 1 insertion(+), 1 deletion(-)
21
22 diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
23 index 457ec7d02a9ac..0548072c642fb 100644
24 --- a/fs/btrfs/transaction.c
25 +++ b/fs/btrfs/transaction.c
26 @@ -1449,6 +1449,7 @@ static noinline int commit_fs_roots(struct btrfs_trans_handle *trans)
27 radix_tree_tag_clear(&fs_info->fs_roots_radix,
28 (unsigned long)root->root_key.objectid,
29 BTRFS_ROOT_TRANS_TAG);
30 + btrfs_qgroup_free_meta_all_pertrans(root);
31 spin_unlock(&fs_info->fs_roots_radix_lock);
32
33 btrfs_free_log(trans, root);
34 @@ -1473,7 +1474,6 @@ static noinline int commit_fs_roots(struct btrfs_trans_handle *trans)
35 if (ret2)
36 return ret2;
37 spin_lock(&fs_info->fs_roots_radix_lock);
38 - btrfs_qgroup_free_meta_all_pertrans(root);
39 }
40 }
41 spin_unlock(&fs_info->fs_roots_radix_lock);
42 --
43 2.43.0
44