Filipe Manana
aa84ce8a78
btrfs: fix warning when putting transaction with qgroups enabled after abort
...
If we have a transaction abort with qgroups enabled we get a warning
triggered when doing the final put on the transaction, like this:
[552.6789] ------------[ cut here ]------------
[552.6815] WARNING: CPU: 4 PID: 81745 at fs/btrfs/transaction.c:144 btrfs_put_transaction+0x123/0x130 [btrfs]
[552.6817] Modules linked in: btrfs blake2b_generic xor (...)
[552.6819] CPU: 4 PID: 81745 Comm: btrfs-transacti Tainted: G W 6.4.0-rc6-btrfs-next-134+ #1
[552.6819] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.2-0-gea1b7a073390-prebuilt.qemu.org 04/01/2014
[552.6819] RIP: 0010:btrfs_put_transaction+0x123/0x130 [btrfs]
[552.6821] Code: bd a0 01 00 (...)
[552.6821] RSP: 0018:ffffa168c0527e28 EFLAGS: 00010286
[552.6821] RAX: ffff936042caed00 RBX: ffff93604a3eb448 RCX: 0000000000000000
[552.6821] RDX: ffff93606421b028 RSI: ffffffff92ff0878 RDI: ffff93606421b010
[552.6821] RBP: ffff93606421b000 R08: 0000000000000000 R09: ffffa168c0d07c20
[552.6821] R10: 0000000000000000 R11: ffff93608dc52950 R12: ffffa168c0527e70
[552.6821] R13: ffff93606421b000 R14: ffff93604a3eb420 R15: ffff93606421b028
[552.6821] FS: 0000000000000000(0000) GS:ffff93675fb00000(0000) knlGS:0000000000000000
[552.6821] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[552.6821] CR2: 0000558ad262b000 CR3: 000000014feda005 CR4: 0000000000370ee0
[552.6822] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[552.6822] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[552.6822] Call Trace:
[552.6822] <TASK>
[552.6822] ? __warn+0x80/0x130
[552.6822] ? btrfs_put_transaction+0x123/0x130 [btrfs]
[552.6824] ? report_bug+0x1f4/0x200
[552.6824] ? handle_bug+0x42/0x70
[552.6824] ? exc_invalid_op+0x14/0x70
[552.6824] ? asm_exc_invalid_op+0x16/0x20
[552.6824] ? btrfs_put_transaction+0x123/0x130 [btrfs]
[552.6826] btrfs_cleanup_transaction+0xe7/0x5e0 [btrfs]
[552.6828] ? _raw_spin_unlock_irqrestore+0x23/0x40
[552.6828] ? try_to_wake_up+0x94/0x5e0
[552.6828] ? __pfx_process_timeout+0x10/0x10
[552.6828] transaction_kthread+0x103/0x1d0 [btrfs]
[552.6830] ? __pfx_transaction_kthread+0x10/0x10 [btrfs]
[552.6832] kthread+0xee/0x120
[552.6832] ? __pfx_kthread+0x10/0x10
[552.6832] ret_from_fork+0x29/0x50
[552.6832] </TASK>
[552.6832] ---[ end trace 0000000000000000 ]---
This corresponds to this line of code:
void btrfs_put_transaction(struct btrfs_transaction *transaction)
{
(...)
WARN_ON(!RB_EMPTY_ROOT(
&transaction->delayed_refs.dirty_extent_root));
(...)
}
The warning happens because btrfs_qgroup_destroy_extent_records(), called
in the transaction abort path, we free all entries from the rbtree
"dirty_extent_root" with rbtree_postorder_for_each_entry_safe(), but we
don't actually empty the rbtree - it's still pointing to nodes that were
freed.
So set the rbtree's root node to NULL to avoid this warning (assign
RB_ROOT).
Fixes: 81f7eb00ff5b ("btrfs: destroy qgroup extent records on transaction abort")
CC: stable@vger.kernel.org # 5.10+
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-07-18 03:14:11 +02:00
..
2023-05-05 19:12:01 -07:00
2023-01-19 09:24:02 +01:00
2023-02-20 14:10:36 -08:00
2023-06-16 14:43:41 -07:00
2023-01-19 09:24:28 +01:00
2022-08-02 12:34:03 -04:00
2023-01-19 09:24:28 +01:00
2023-07-18 03:14:11 +02:00
2023-04-13 11:49:35 -07:00
2023-06-08 08:56:25 +02:00
2023-04-27 16:52:33 -07:00
2023-04-03 09:23:54 +02:00
2023-03-02 21:54:23 -08:00
2023-04-06 11:16:39 -07:00
2023-02-27 10:04:49 -08:00
2023-03-13 12:36:34 +01:00
2023-04-26 16:07:23 -07:00
2023-03-06 09:57:12 +01:00
2023-02-23 14:41:48 -08:00
2023-05-23 16:57:08 +08:00
2023-03-01 08:42:27 -08:00
2023-01-19 09:24:28 +01:00
2023-04-26 09:07:46 -07:00
2023-06-14 22:24:05 -04:00
2023-04-26 09:42:10 -07:00
2023-02-23 17:55:40 -08:00
2023-02-23 17:55:40 -08:00
2023-01-30 12:51:54 +00:00
2023-04-27 11:53:57 -07:00
2023-06-01 14:55:43 +02:00
2023-02-23 17:55:40 -08:00
2023-04-12 11:29:32 +02:00
2023-04-20 23:04:40 +02:00
2023-01-19 09:24:26 +01:00
2023-04-21 14:52:05 -07:00
2023-04-29 10:35:48 -07:00
2022-10-12 11:00:22 -07:00
2023-04-14 19:38:50 -04:00
2023-03-06 09:57:13 +01:00
2023-04-24 19:20:27 -07:00
2023-04-27 11:53:57 -07:00
2023-05-17 09:56:01 -07:00
2023-02-24 19:01:15 -08:00
2023-04-27 19:42:02 -07:00
2023-05-19 17:11:59 -04:00
2023-04-13 13:13:52 -07:00
2023-06-02 13:38:55 -04:00
2023-06-12 11:31:51 -07:00
2023-04-25 12:36:55 +02:00
2023-04-13 11:49:35 -07:00
2023-04-29 10:52:37 -07:00
2023-06-12 11:31:52 -07:00
2023-01-19 09:24:28 +01:00
2023-04-27 19:42:02 -07:00
2023-03-06 09:57:13 +01:00
2023-05-02 19:24:16 -07:00
2023-04-27 17:03:40 -07:00
2023-03-14 12:56:30 -06:00
2023-03-14 12:56:30 -06:00
2023-04-14 13:06:50 +02:00
2023-04-05 19:42:46 -07:00
2023-04-26 09:07:46 -07:00
2023-01-18 17:12:56 -08:00
2023-06-14 10:15:05 -05:00
2023-02-03 17:52:25 -08:00
2023-03-12 20:03:41 -04:00
2023-01-19 09:24:26 +01:00
2023-04-23 23:36:38 +02:00
2023-03-13 11:16:16 +01:00
2023-03-28 16:20:14 -07:00
2023-04-13 13:13:54 -07:00
2023-01-19 09:24:26 +01:00
2023-04-11 19:23:23 -07:00
2023-06-05 14:48:15 +10:00
2023-03-30 20:56:02 +09:00
2023-02-10 15:34:48 -08:00
2022-08-20 11:34:04 -04:00
2023-03-30 08:51:48 +02:00
2023-01-19 09:24:28 +01:00
2023-04-08 13:45:37 -07:00
2023-04-27 19:57:00 -07:00
2022-12-02 13:57:04 -08:00
2023-04-27 19:42:02 -07:00
2022-12-02 17:48:59 +01:00
2023-06-01 17:15:33 -04:00
2022-08-20 11:34:33 -04:00
2023-04-05 18:06:23 -07:00
2022-10-10 19:45:17 -07:00
2023-03-05 20:27:41 -05:00
2023-04-06 10:01:50 +02:00
2023-06-12 11:31:52 -07:00
2023-04-28 15:57:53 -07:00
2023-02-20 11:53:11 -08:00
2022-09-01 17:36:39 -04:00
2023-01-11 06:52:32 -05:00
2023-03-09 22:46:21 -05:00
2022-12-01 10:46:54 -05:00
2023-05-06 08:28:58 -07:00
2023-01-19 09:24:28 +01:00
2023-04-27 19:42:02 -07:00
2023-04-29 11:10:39 -07:00
2023-01-19 09:24:29 +01:00
2023-05-24 16:29:21 -05:00
2022-10-10 14:21:11 -07:00
2023-04-03 09:23:54 +02:00
2023-03-09 22:36:12 +01:00
2023-05-24 16:29:21 -05:00
2022-12-08 21:49:25 -05:00
2023-01-19 09:24:30 +01:00
2023-04-18 16:30:02 -07:00
2023-04-29 11:10:39 -07:00
2023-04-24 19:14:20 -07:00
2023-04-20 22:55:35 -04:00
2023-03-22 11:06:55 +01:00
2023-05-12 17:17:27 +02:00
2023-04-06 14:53:38 +02:00
2023-03-06 09:59:20 +01:00
2023-03-30 08:12:29 -06:00
2022-08-17 17:25:04 -04:00
2023-01-19 09:24:29 +01:00
2022-11-25 13:01:55 -05:00
2023-05-06 08:15:20 -07:00
2023-02-20 11:53:11 -08:00
2023-05-17 15:20:17 +02:00
2023-03-28 16:20:17 -07:00
2023-06-12 11:31:50 -07:00
2023-02-20 11:53:11 -08:00
2023-05-17 15:25:20 +02:00