* [PATCH] bcachefs: Reuse transaction
@ 2025-02-12 9:27 Alan Huang
2025-02-12 14:18 ` Kent Overstreet
0 siblings, 1 reply; 2+ messages in thread
From: Alan Huang @ 2025-02-12 9:27 UTC (permalink / raw)
To: kent.overstreet; +Cc: linux-bcachefs, Alan Huang
bch2_nocow_write_convert_unwritten is already in transaction context:
00191 ========= TEST generic/648
00242 kernel BUG at fs/bcachefs/btree_iter.c:3332!
00242 Internal error: Oops - BUG: 00000000f2000800 [#1] PREEMPT SMP
00242 Modules linked in:
00242 CPU: 4 UID: 0 PID: 2593 Comm: fsstress Not tainted 6.13.0-rc3-ktest-g345af8f855b7 #14403
00242 Hardware name: linux,dummy-virt (DT)
00242 pstate: 60001005 (nZCv daif -PAN -UAO -TCO -DIT +SSBS BTYPE=--)
00242 pc : __bch2_trans_get+0x120/0x410
00242 lr : __bch2_trans_get+0xcc/0x410
00242 sp : ffffff80d89af600
00242 x29: ffffff80d89af600 x28: ffffff80ddb23000 x27: 00000000fffff705
00242 x26: ffffff80ddb23028 x25: ffffff80d8903fe0 x24: ffffff80ebb30168
00242 x23: ffffff80c8aeb500 x22: 000000000000005d x21: ffffff80d8904078
00242 x20: ffffff80d8900000 x19: ffffff80da9e8000 x18: 0000000000000000
00242 x17: 64747568735f6c61 x16: 6e72756f6a20726f x15: 0000000000000028
00242 x14: 0000000000000004 x13: 000000000000f787 x12: ffffffc081bbcdc8
00242 x11: 0000000000000000 x10: 0000000000000003 x9 : ffffffc08094efbc
00242 x8 : 000000001092c111 x7 : 000000000000000c x6 : ffffffc083c31fc4
00242 x5 : ffffffc083c31f28 x4 : ffffff80c8aeb500 x3 : ffffff80ebb30000
00242 x2 : 0000000000000001 x1 : 0000000000000a21 x0 : 000000000000028e
00242 Call trace:
00242 __bch2_trans_get+0x120/0x410 (P)
00242 bch2_inum_offset_err_msg+0x48/0xb0
00242 bch2_nocow_write_convert_unwritten+0x3d0/0x530
00242 bch2_nocow_write+0xeb0/0x1000
00242 __bch2_write+0x330/0x4e8
00242 bch2_write+0x1f0/0x530
00242 bch2_direct_write+0x530/0xc00
00242 bch2_write_iter+0x160/0xbe0
00242 vfs_write+0x1cc/0x360
00242 ksys_write+0x5c/0xf0
00242 __arm64_sys_write+0x20/0x30
00242 invoke_syscall.constprop.0+0x54/0xe8
00242 do_el0_svc+0x44/0xc0
00242 el0_svc+0x34/0xa0
00242 el0t_64_sync_handler+0x104/0x130
00242 el0t_64_sync+0x154/0x158
00242 Code: 6b01001f 54ffff01 79408460 3617fec0 (d4210000)
00242 ---[ end trace 0000000000000000 ]---
00242 Kernel panic - not syncing: Oops - BUG: Fatal exception
Signed-off-by: Alan Huang <mmpgouride@gmail.com>
---
fs/bcachefs/io_write.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/fs/bcachefs/io_write.c b/fs/bcachefs/io_write.c
index d363a6e730a2..16618bbc46ce 100644
--- a/fs/bcachefs/io_write.c
+++ b/fs/bcachefs/io_write.c
@@ -406,6 +406,16 @@ static void __bch2_write_op_error(struct printbuf *out, struct bch_write_op *op,
op->flags & BCH_WRITE_move ? "(internal move)" : "");
}
+static void bch2_write_op_error_trans(struct btree_trans *trans, struct printbuf *out,
+ struct bch_write_op *op, u64 offset)
+{
+ bch2_inum_offset_err_msg_trans(trans, out,
+ (subvol_inum) { op->subvol, op->pos.inode, },
+ offset << 9);
+ prt_printf(out, "write error%s: ",
+ op->flags & BCH_WRITE_move ? "(internal move)" : "");
+}
+
static void bch2_write_op_error(struct printbuf *out, struct bch_write_op *op)
{
__bch2_write_op_error(out, op, op->pos.offset);
@@ -1193,7 +1203,7 @@ static void bch2_nocow_write_convert_unwritten(struct bch_write_op *op)
struct bkey_i *insert = bch2_keylist_front(&op->insert_keys);
struct printbuf buf = PRINTBUF;
- __bch2_write_op_error(&buf, op, bkey_start_offset(&insert->k));
+ bch2_write_op_error_trans(trans, &buf, op, bkey_start_offset(&insert->k));
prt_printf(&buf, "btree update error: %s", bch2_err_str(ret));
bch_err_ratelimited(c, "%s", buf.buf);
printbuf_exit(&buf);
--
2.47.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] bcachefs: Reuse transaction
2025-02-12 9:27 [PATCH] bcachefs: Reuse transaction Alan Huang
@ 2025-02-12 14:18 ` Kent Overstreet
0 siblings, 0 replies; 2+ messages in thread
From: Kent Overstreet @ 2025-02-12 14:18 UTC (permalink / raw)
To: Alan Huang; +Cc: linux-bcachefs
On Wed, Feb 12, 2025 at 05:27:51PM +0800, Alan Huang wrote:
> bch2_nocow_write_convert_unwritten is already in transaction context:
Can you rebase?
>
> 00191 ========= TEST generic/648
> 00242 kernel BUG at fs/bcachefs/btree_iter.c:3332!
> 00242 Internal error: Oops - BUG: 00000000f2000800 [#1] PREEMPT SMP
> 00242 Modules linked in:
> 00242 CPU: 4 UID: 0 PID: 2593 Comm: fsstress Not tainted 6.13.0-rc3-ktest-g345af8f855b7 #14403
> 00242 Hardware name: linux,dummy-virt (DT)
> 00242 pstate: 60001005 (nZCv daif -PAN -UAO -TCO -DIT +SSBS BTYPE=--)
> 00242 pc : __bch2_trans_get+0x120/0x410
> 00242 lr : __bch2_trans_get+0xcc/0x410
> 00242 sp : ffffff80d89af600
> 00242 x29: ffffff80d89af600 x28: ffffff80ddb23000 x27: 00000000fffff705
> 00242 x26: ffffff80ddb23028 x25: ffffff80d8903fe0 x24: ffffff80ebb30168
> 00242 x23: ffffff80c8aeb500 x22: 000000000000005d x21: ffffff80d8904078
> 00242 x20: ffffff80d8900000 x19: ffffff80da9e8000 x18: 0000000000000000
> 00242 x17: 64747568735f6c61 x16: 6e72756f6a20726f x15: 0000000000000028
> 00242 x14: 0000000000000004 x13: 000000000000f787 x12: ffffffc081bbcdc8
> 00242 x11: 0000000000000000 x10: 0000000000000003 x9 : ffffffc08094efbc
> 00242 x8 : 000000001092c111 x7 : 000000000000000c x6 : ffffffc083c31fc4
> 00242 x5 : ffffffc083c31f28 x4 : ffffff80c8aeb500 x3 : ffffff80ebb30000
> 00242 x2 : 0000000000000001 x1 : 0000000000000a21 x0 : 000000000000028e
> 00242 Call trace:
> 00242 __bch2_trans_get+0x120/0x410 (P)
> 00242 bch2_inum_offset_err_msg+0x48/0xb0
> 00242 bch2_nocow_write_convert_unwritten+0x3d0/0x530
> 00242 bch2_nocow_write+0xeb0/0x1000
> 00242 __bch2_write+0x330/0x4e8
> 00242 bch2_write+0x1f0/0x530
> 00242 bch2_direct_write+0x530/0xc00
> 00242 bch2_write_iter+0x160/0xbe0
> 00242 vfs_write+0x1cc/0x360
> 00242 ksys_write+0x5c/0xf0
> 00242 __arm64_sys_write+0x20/0x30
> 00242 invoke_syscall.constprop.0+0x54/0xe8
> 00242 do_el0_svc+0x44/0xc0
> 00242 el0_svc+0x34/0xa0
> 00242 el0t_64_sync_handler+0x104/0x130
> 00242 el0t_64_sync+0x154/0x158
> 00242 Code: 6b01001f 54ffff01 79408460 3617fec0 (d4210000)
> 00242 ---[ end trace 0000000000000000 ]---
> 00242 Kernel panic - not syncing: Oops - BUG: Fatal exception
>
> Signed-off-by: Alan Huang <mmpgouride@gmail.com>
> ---
> fs/bcachefs/io_write.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/fs/bcachefs/io_write.c b/fs/bcachefs/io_write.c
> index d363a6e730a2..16618bbc46ce 100644
> --- a/fs/bcachefs/io_write.c
> +++ b/fs/bcachefs/io_write.c
> @@ -406,6 +406,16 @@ static void __bch2_write_op_error(struct printbuf *out, struct bch_write_op *op,
> op->flags & BCH_WRITE_move ? "(internal move)" : "");
> }
>
> +static void bch2_write_op_error_trans(struct btree_trans *trans, struct printbuf *out,
> + struct bch_write_op *op, u64 offset)
> +{
> + bch2_inum_offset_err_msg_trans(trans, out,
> + (subvol_inum) { op->subvol, op->pos.inode, },
> + offset << 9);
> + prt_printf(out, "write error%s: ",
> + op->flags & BCH_WRITE_move ? "(internal move)" : "");
> +}
> +
> static void bch2_write_op_error(struct printbuf *out, struct bch_write_op *op)
> {
> __bch2_write_op_error(out, op, op->pos.offset);
> @@ -1193,7 +1203,7 @@ static void bch2_nocow_write_convert_unwritten(struct bch_write_op *op)
> struct bkey_i *insert = bch2_keylist_front(&op->insert_keys);
>
> struct printbuf buf = PRINTBUF;
> - __bch2_write_op_error(&buf, op, bkey_start_offset(&insert->k));
> + bch2_write_op_error_trans(trans, &buf, op, bkey_start_offset(&insert->k));
> prt_printf(&buf, "btree update error: %s", bch2_err_str(ret));
> bch_err_ratelimited(c, "%s", buf.buf);
> printbuf_exit(&buf);
> --
> 2.47.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-02-12 14:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-12 9:27 [PATCH] bcachefs: Reuse transaction Alan Huang
2025-02-12 14:18 ` Kent Overstreet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox