bcachefs: Reuse transaction
PATCH 1/1 bcachefs: Reuse transaction
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
--- fs/bcachefs/io_write.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
fs/bcachefs/io_write.c +11 -1
@@ -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);
Signature · 1 line
2.47.0
Quoted 1 line · Alan Huang
bch2_nocow_write_convert_unwrittenis already in transaction context:
Can you rebase?
Quoted 80 lines
00191 ========= TEST generic/648
00242 kernel BUG atfs/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:ffffff80d89af600x28:ffffff80ddb23000x27:00000000fffff705
00242 x26:ffffff80ddb23028x25:ffffff80d8903fe0x24:ffffff80ebb30168
00242 x23:ffffff80c8aeb500x22:000000000000005dx21:ffffff80d8904078
00242 x20:ffffff80d8900000x19:ffffff80da9e8000x18: 0000000000000000
00242 x17:64747568735f6c61x16:6e72756f6a20726fx15: 0000000000000028
00242 x14: 0000000000000004 x13:000000000000f787x12:ffffffc081bbcdc8
00242 x11: 0000000000000000 x10: 0000000000000003 x9 :ffffffc08094efbc
00242 x8 :000000001092c111x7 :000000000000000cx6 :ffffffc083c31fc4
00242 x5 :ffffffc083c31f28x4 :ffffff80c8aeb500x3 :ffffff80ebb30000
00242 x2 : 0000000000000001 x1 :0000000000000a21x0 :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/0x15800242 Code:
6b01001f54ffff01794084603617fec0(d4210000) 00242 ---[ end trace 0000000000000000 ]---
00242 Kernel panic - not syncing: Oops - BUG: Fatal exceptionSigned-off-by Alan Huang <[email protected]>--- fs/bcachefs/io_write.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)fs/bcachefs/io_write.c +11
-1@@ -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);Signature · 1 line
2.47.0