Hi- This is a weird setup, so it's possible that it has something to do with my configuration or disks, but I'm just trying bcachefs for the first time and have run into this issue.
I have 2 older 4TB HDDs connected via USB, along with a 500GB usb ssd, plugged into an Intel N150 host. The host runs KVM (Proxmox) and passes through the HDDs as virtio-block devices and the ssd as virtio-scsi devices into a VM. The VM is running Fedora 44 (Linux 7.0.12-201), and I am running the latest bcachefs modules via dkms (1.38.6-1) in the VM.
The filesystem was formatted like this:
bcachefs format \
--label=ssd.ssd1 /dev/sdb1 \
--label=hdd.hdd1 /dev/vda1 \
--label=hdd.hdd2 /dev/vdb1 \
--data_replicas=1 --metadata_replicas=2 --foreground_target=ssd --promote_target=ssd --background_target=hdd
In general, this seems to work ok. I can run some sequential write tests with fio on the bcachefs filesystem, and performance is close-ish to saturating the SSD.
Unfortunately, when I try to sync large files (20GB+ for a total of ~3TB) via lftp, after a few files, the transfers begin to hang. I can see the process is stuck in the D state, and if i touch the filesystem, it also hangs. in bcachefs fs top, i see that reconcile_btree is writing 111M/s and sectors_alloc is running at 112M/s. CPU usage appears reasonable (various bcachefs kworkers consuming ~80% of a core) . After about 4 minutes, it eventually becomes unstuck, until it happens again after more disk activity.
I can see in the kernel logs that there are a bunch of warnings like this about the lock being too long:
[20610.957728] ------------[ cut here ]------------
[20610.957729] nft_fib_ipv6 nft_fib nft_reject_inet nf_reject_ipv4 nf_reject_ipv6 nft_reject nft_ct nft_chain_nat nf_nat
[20610.957732] btree trans held srcu lock (delaying memory reclaim) for 233 seconds
reconcile_btree: 0 113152 45056 203776 128000 81920 146432 134656 150528 202752 44544 186368 151552 29184 158720 144384 136192 95744 128000 158208
bucket_discard_worker: 0 13 6 21 11 14 21 20 21 21 722 19 7 23 27 28 11 27 25
bucket_alloc: 0 58 22 100 62 40 72 66 73 99 22 974 14 77 71 67 46 63 77
sectors_alloc: 2048 118272 45056 203776 128512 81920 145920 135168 150016 202752 44544 186880 151552 28672 158720 144896 135680 96256 128000 159232
btree_cache_cannibalize_lock: 2 226 88 398 251 160 285 264 293 396 87 365 296 56 310 284 265 188 255 318
btree_cache_cannibalize_unlock: 2 226 88 398 251 160 285 264 293 396 87 365 296 56 310 284 265 188 255 318
btree_node_write: 4 232 88 398 250 160 286 263 294 396 8365 296 58 310 284 268 187 250 311
btree_node_merge: 2 2 0 0 0 0 0 0 0 0 00
btree_node_merge_attempt: 5 15 0 0 0 0 0 0 0 00
btree_node_split: 0 4 0 0 0 0 0 0 0 0 01
btree_node_rewrite
[20610.957736] nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 nvidia_uvm(OE) nf_tables nfnetlink qrtr bcachefs(OE) sunrpc nvidia_drm(OE) nvidia_modeset(OE) intel_rapl_msr intel_rapl_common intel_pmc_core pmt_telemetry pmt_discovery pmt_class intel_pmc_ssram_telemetry intel_vsec nvidia(OE) kvm_intel snd_hda_codec_nvhdmi snd_hda_codec_hdmi iTCO_wdt kvm intel_pmc_bxt irqbypass rapl snd_hda_intel snd_hda_codec vfat fat i2c_i801 snd_hda_core i2c_smbus drm_ttm_helper lpc_ich virtio_net net_failover failover virtio_balloon ttm snd_intel_dspcfg video wmi snd_intel_sdw_acpi snd_hwdep snd_seq snd_seq_device snd_pcm snd_timer snd soundcore joydev dm_multipath zram lz4hc_compress lz4_compress vmw_vsock_virtio_transport vmw_vsock_virtio_transport_common vsock xfs ghash_clmulni_intel virtio_scsi virtio_gpu virtio_dma_buf serio_raw i2c_dev scsi_dh_rdac scsi_dh_emc scsi_dh_alua qemu_fw_cfg virtiofs fuse
[20610.957739] WARNING: src/fs/bcachefs/btree/locking.c:1243 at bch2_trans_unlock_long+0x251/0x270 [bcachefs], CPU#0: kworker/u16:6/97476
[20610.957795] CPU: 1 UID: 0 PID: 108370 Comm: kworker/u17:4 Tainted: G W OE 7.0.12-201.fc44.x86_64 #1 PREEMPT(lazy)
[20610.957799] Tainted: [W]=WARN, [O]=OOT_MODULE, [E]=UNSIGNED_MODULE
[20610.957800] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 4.2025.05-2 11/13/2025
[20610.957849] Modules linked in: nf_conntrack_netlink xt_nat veth xt_conntrack xt_MASQUERADE bridge stp llc xt_set ip_set xt_addrtype nft_compat overlay rfkill nft_redir nft_fib_inet nft_fib_ipv4 nft_fib_ipv6 nft_fib nft_reject_inet nf_reject_ipv4 nf_reject_ipv6 nft_reject nft_ct nft_chain_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 nvidia_uvm(OE) nf_tables nfnetlink qrtr bcachefs(OE) sunrpc nvidia_drm(OE) nvidia_modeset(OE) intel_rapl_msr intel_rapl_common intel_pmc_core pmt_telemetry pmt_discovery pmt_class intel_pmc_ssram_telemetry intel_vsec nvidia(OE) kvm_intel snd_hda_codec_nvhdmi
[20610.957802] Workqueue: bcachefs bch2_write_point_do_index_updates [bcachefs]
[20610.957874] snd_hda_codec_hdmi iTCO_wdt kvm intel_pmc_bxt irqbypass rapl snd_hda_intel snd_hda_codec vfat fat i2c_i801 snd_hda_core i2c_smbus drm_ttm_helper lpc_ich virtio_net net_failover failover virtio_balloon ttm snd_intel_dspcfg video wmi snd_intel_sdw_acpi snd_hwdep snd_seq snd_seq_device snd_pcm snd_timer snd soundcore joydev dm_multipath zram lz4hc_compress lz4_compress vmw_vsock_virtio_transport vmw_vsock_virtio_transport_common vsock xfs ghash_clmulni_intel virtio_scsi virtio_gpu virtio_dma_buf serio_raw i2c_dev scsi_dh_rdac scsi_dh_emc scsi_dh_alua qemu_fw_cfg virtiofs fuse
[20610.957901] CPU: 0 UID: 0 PID: 97476 Comm: kworker/u16:6 Tainted: G W OE 7.0.12-201.fc44.x86_64 #1 PREEMPT(lazy)
[20610.957904] Tainted: [W]=WARN, [O]=OOT_MODULE, [E]=UNSIGNED_MODULE
[20610.957905] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 4.2025.05-2 11/13/2025
[20610.957906] Workqueue: writeback wb_workfn (flush-bcachefs-1)
[20610.957912] RIP: 0010:bch2_trans_unlock_long+0x256/0x270 [bcachefs]
[20610.958022] Code: 50 48 8b 44 24 30 48 89 44 24 58 e8 14 3f 12 00 4c 8b 04 24 e9 6b fe ff ff e8 06 fb 0d ea 48 8d 3d cf 1a d8 ff 48 8b 74 24 10 <67> 48 0f b9 3a 4c 8b 04 24 eb 9b 0f 1f 40 00 66 66 2e 0f 1f 84 00
[20610.958025] RSP: 0018:ffffd43362eff980 EFLAGS: 00010202
[20610.958027] RAX: 0000000000000001 RBX: ffff8eba7dc64000 RCX: 0000000000001388
[20610.958029] RDX: 000000010135ecfa RSI: ffff8eb9890c1000 RDI: ffffffffc2402ad0
[20610.958030] RBP: ffff8eba7dc64000 R08: ffff8eb84f500000 R09: 00000000ffffffff
[20610.958031] R10: 0000000000000008 R11: 0000000000000000 R12: ffff8eb84f500000
[20610.958033] R13: ffff8eb8241a38e0 R14: ffff8eb84f500000 R15: 0000000000000000
[20610.958034] FS: 0000000000000000(0000) GS:ffff8ebb8129a000(0000) knlGS:0000000000000000
[20610.958036] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[20610.958037] CR2: 00007f2b7d39ef30 CR3: 00000001299ec006 CR4: 0000000000f72ef0
[20610.958041] PKRU: 55555554
[20610.958042] Call Trace:
[20610.958045] <TASK>
[20610.958022] RIP: 0010:bch2_trans_unlock_long+0x256/0x270 [bcachefs]
[20610.958049] bch2_trans_put+0x34/0x220 [bcachefs]
[20610.958121] Code: 50 48 8b 44 24 30 48 89 44 24 58 e8 14 3f 12 00 4c 8b 04 24 e9 6b fe ff ff e8 06 fb 0d ea 48 8d 3d cf 1a d8 ff 48 8b 74 24 10 <67> 48 0f b9 3a 4c 8b 04 24 eb 9b 0f 1f 40 00 66 66 2e 0f 1f 84 00
[20610.958123] RSP: 0018:ffffd4334589ba50 EFLAGS: 00010202
[20610.958125] RAX: 0000000000000001 RBX: ffff8eb8e9440000 RCX: fffffffffffb6515
[20610.958127] RDX: 0000000000000000 RSI: ffff8eba9f2de000 RDI: ffffffffc2402ad0
[20610.958128] RBP: 0000000000000023 R08: ffff8eb84f500000 R09: 00000000ffffffff
[20610.958129] R10: 0000000000000008 R11: 0000000000000000 R12: ffff8eb8e9440000
[20610.958130] R13: 000012886281d089 R14: ffff8eb84f500000 R15: ffff8eb8d3409708
[20610.958131] FS: 0000000000000000(0000) GS:ffff8ebb8131a000(0000) knlGS:0000000000000000
[20610.958132] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[20610.958133] CR2: 00007f2b7d457ff0 CR3: 00000001ec91d005 CR4: 0000000000f72ef0
[20610.958137] PKRU: 55555554
[20610.958138] Call Trace:
[20610.958139] <TASK>
[20610.958141] bch2_trans_begin+0x50c/0x630 [bcachefs]
[20610.958147] ? __pfx_inode_update_times_fn+0x10/0x10 [bcachefs]
[20610.958229] bch2_write_inode+0x9e/0x190 [bcachefs]
[20610.958227] bch2_write_index_default+0x136/0x740 [bcachefs]
[20610.958326] ? psi_group_change+0x186/0x430
[20610.958307] bch2_vfs_write_inode+0x44/0x80 [bcachefs]
[20610.958377] write_inode+0x5d/0x130
[20610.958380] __writeback_single_inode+0x211/0x280
[20610.958383] ? _raw_spin_unlock+0xe/0x30
[20610.958386] writeback_sb_inodes+0x270/0x550
[20610.958391] __writeback_inodes_wb+0x5d/0x100
[20610.958333] ? __bch2_write_index+0x23d/0x790 [bcachefs]
[20610.958394] wb_writeback+0x2f7/0x390
[20610.958396] wb_workfn+0x316/0x550
[20610.958399] ? __schedule+0x2c8/0x630
[20610.958401] process_one_work+0x19e/0x3a0
[20610.958404] worker_thread+0x1a6/0x310
[20610.958407] ? __pfx_worker_thread+0x10/0x10
[20610.958409] kthread+0xe4/0x120
[20610.958412] ? __pfx_kthread+0x10/0x10
[20610.958414] ret_from_fork+0x1a1/0x270
[20610.958417] ? __pfx_kthread+0x10/0x10
[20610.958419] ret_from_fork_asm+0x1a/0x30
[20610.958423] </TASK>
[20610.958423] ---[ end trace 0000000000000000 ]---
[20610.958487] __bch2_write_index+0x23d/0x790 [bcachefs]
[20610.958597] ? dequeue_entity+0xf3/0x710
[20610.958601] ? psi_group_change+0x186/0x430
[20610.958605] bch2_write_point_do_index_updates+0xca/0x250 [bcachefs]
[20610.958770] ? __schedule+0x2c8/0x630
[20610.958773] process_one_work+0x19e/0x3a0
[20610.958777] worker_thread+0x1a6/0x310
[20610.958779] ? __pfx_worker_thread+0x10/0x10
[20610.958782] kthread+0xe4/0x120
[20610.958785] ? __pfx_kthread+0x10/0x10
[20610.958787] ret_from_fork+0x1a1/0x270
[20610.958790] ? __pfx_kthread+0x10/0x10
[20610.958791] ret_from_fork_asm+0x1a/0x30
[20610.958795] </TASK>
[20610.958796] ---[ end trace 0000000000000000 ]---
let me know if there's any additional data you would like me to collect.
Hi- This is a weird setup, so it's possible that it has something to do with my configuration or disks, but I'm just trying bcachefs for the first time and have run into this issue.
I have 2 older 4TB HDDs connected via USB, along with a 500GB usb ssd, plugged into an Intel N150 host. The host runs KVM (Proxmox) and passes through the HDDs as virtio-block devices and the ssd as virtio-scsi devices into a VM. The VM is running Fedora 44 (Linux 7.0.12-201), and I am running the latest bcachefs modules via dkms (1.38.6-1) in the VM.
The filesystem was formatted like this:
In general, this seems to work ok. I can run some sequential write tests with
fioon the bcachefs filesystem, and performance is close-ish to saturating the SSD.Unfortunately, when I try to sync large files (20GB+ for a total of ~3TB) via lftp, after a few files, the transfers begin to hang. I can see the process is stuck in the D state, and if i touch the filesystem, it also hangs. in
bcachefs fs top, i see thatreconcile_btreeis writing111M/sandsectors_allocis running at112M/s. CPU usage appears reasonable (various bcachefs kworkers consuming ~80% of a core) . After about 4 minutes, it eventually becomes unstuck, until it happens again after more disk activity.I can see in the kernel logs that there are a bunch of warnings like this about the lock being too long:
let me know if there's any additional data you would like me to collect.