Filipe Manana
ae91ab710d
btrfs: fix warning when putting transaction with qgroups enabled after abort
...
commit aa84ce8a78a1a5c10cdf9c7a5fb0c999fbc2c8d6 upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-07-27 08:37:40 +02:00
..
2022-11-25 17:42:13 +01:00
2021-11-26 10:47:21 +01:00
2020-04-17 10:50:15 +02:00
2023-01-18 11:41:46 +01:00
2022-08-25 11:18:11 +02:00
2021-03-20 10:39:46 +01:00
2023-05-17 11:36:00 +02:00
2021-09-03 10:08:15 +02:00
2020-02-24 08:36:53 +01:00
2021-08-04 12:27:37 +02:00
2019-09-09 14:59:11 +02:00
2023-05-17 11:36:00 +02:00
2022-09-05 10:27:46 +02:00
2021-08-15 13:08:04 +02:00
2021-08-15 13:08:06 +02:00
2020-02-11 04:35:34 -08:00
2022-09-05 10:27:43 +02:00
2022-09-05 10:27:46 +02:00
2023-05-30 12:44:09 +01:00
2019-09-09 14:59:11 +02:00
2022-11-10 17:57:55 +01:00
2022-11-10 17:57:55 +01:00
2021-12-14 14:49:01 +01:00
2022-04-15 14:18:39 +02:00
2020-02-19 19:53:00 +01:00
2021-10-20 11:40:13 +02:00
2023-06-21 15:44:09 +02:00
2021-09-03 10:08:15 +02:00
2023-05-30 12:44:04 +01:00
2019-09-09 14:59:15 +02:00
2021-02-03 23:25:57 +01:00
2019-09-09 14:59:03 +02:00
2019-09-09 14:59:16 +02:00
2019-10-15 18:50:07 +02:00
2023-05-30 12:44:04 +01:00
2023-05-17 11:35:55 +02:00
2021-07-14 16:53:14 +02:00
2019-09-09 14:59:15 +02:00
2019-09-09 14:58:59 +02:00
2019-09-09 14:59:11 +02:00
2019-09-09 14:59:04 +02:00
2019-09-09 14:59:15 +02:00
2020-02-28 17:22:24 +01:00
2023-05-17 11:36:00 +02:00
2019-09-09 14:59:13 +02:00
2023-07-27 08:37:40 +02:00
2021-08-15 13:08:06 +02:00
2022-08-25 11:18:40 +02:00
2023-01-18 11:41:52 +01:00
2020-11-05 11:43:27 +01:00
2020-11-18 19:20:28 +01:00
2023-06-14 10:59:59 +02:00
2022-09-05 10:27:43 +02:00
2022-10-26 13:22:55 +02:00
2023-03-03 11:41:48 +01:00
2021-09-30 10:09:22 +02:00
2020-10-17 10:11:21 +02:00
2019-09-09 14:59:16 +02:00
2023-04-20 12:07:35 +02:00
2022-12-08 11:23:01 +01:00
2019-09-09 14:59:08 +02:00
2021-08-15 13:08:05 +02:00
2021-09-03 10:08:15 +02:00
2022-09-05 10:27:47 +02:00
2022-09-05 10:27:46 +02:00
2021-08-08 09:04:07 +02:00
2019-12-31 16:42:05 +01:00
2023-04-05 11:16:46 +02:00
2020-11-05 11:43:27 +01:00
2022-09-05 10:27:43 +02:00
2023-02-22 12:50:30 +01:00
2019-09-09 14:59:15 +02:00