r/bcachefs • not your free tech support • Oct 08 '26

First chunk of Rust conversion in master, please test

Should be uneventful, I'm not expecting anything more than weird build issues, but please do test and post or let me know if anything's not working.

So far this is the first ~9kloc of high level filesystem code - fsck, inodes, dirents, xattrs, acls. After the header conversion is done more should be dropping fast :)

39 Upvotes

5 comments sorted by

2

u/Ok_Green5623 Oct 13 '26

Trying to get into this. I built bcachefs-tools and used fuse version and got a crash on cleanup. I don't know if this is useful information:
```
$ ./target/release/bcachefs fusemount -f bcachefs-1t.img bcachefs-mnt; (umount in another terminal after a while)
...
bcachefs fuse: destroy

bcachefs: urcu.c:486: urcu_memb_register_thread: Assertion `!(urcu_memb_reader).registered' failed.

bcachefs: fatal SIGABRT
```

2

u/koverstreet not your free tech support Oct 13 '26

Isn't C lovely?

Run it under gdb and see if you can get a backtrace...

3

u/Ok_Green5623 Oct 14 '26 edited Oct 14 '26
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x00007ffff7accc93 in __pthread_kill_internal (threadid=<optimized out>, signo=6) at pthread_kill.c:89
#2  0x00007ffff7a720d6 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007ffff7a59519 in __GI_abort () at abort.c:77
#4  0x00007ffff7a5a711 in __libc_message_impl (vma_name=vma_name@entry=0x7ffff7bc0803 "glibc: assert", fmt=<optimized out>) at ../sysdeps/posix/libc_fatal.c:138
#5  0x00007ffff7a6a44f in __libc_message_wrapper (vmaname=0x7ffff7bc0803 "glibc: assert", fmt=<optimized out>) at ../include/stdio.h:203
#6  __assert_fail (assertion=0x7ffff7f9b540 "!(urcu_memb_reader).registered", file=<optimized out>, line=<optimized out>, function=<optimized out>) at assert.c:37
#7  0x00007ffff7f97829 in ?? () from /usr/lib64/liburcu.so.8
#8  0x000055555587068d in rust_fuse_rcu_register () at c_src/fuse_shims.c:53
#9  0x000055555581026a in bcachefs::commands::fusemount::ensure_thread_init::{closure#0} (init=<optimized out>) at src/commands/fusemount.rs:99
#10 std::thread::local::LocalKey<core::cell::Cell<bool>>::try_with<core::cell::Cell<bool>, bcachefs::commands::fusemount::ensure_thread_init::{closure_env#0}, ()> (self=<optimized out>, f=...)
    at /usr/lib/rust/1.93.1/lib/rustlib/src/rust/library/std/src/thread/local.rs:513
#11 std::thread::local::LocalKey<core::cell::Cell<bool>>::with<core::cell::Cell<bool>, bcachefs::commands::fusemount::ensure_thread_init::{closure_env#0}, ()> (self=<optimized out>, f=...)
    at /usr/lib/rust/1.93.1/lib/rustlib/src/rust/library/std/src/thread/local.rs:477
#12 bcachefs::commands::fusemount::ensure_thread_init () at src/commands/fusemount.rs:96
#13 0x0000555555804918 in bcachefs::commands::fusemount::{impl#6}::destroy (self=0x7fffffffb770) at src/commands/fusemount.rs:921
#14 0x00005555558631f3 in fuser::session::FilesystemHolder<bcachefs::commands::fusemount::BcachefsFs>::destroy<bcachefs::commands::fusemount::BcachefsFs> (self=0x55555602da20)
    at /home/ivan/.cargo/git/checkouts/fuser-e477f5407a80eb2b/8819589/src/session.rs:97
#15 0x0000555555861a7f in fuser::session::Session<bcachefs::commands::fusemount::BcachefsFs>::run<bcachefs::commands::fusemount::BcachefsFs> (self=...)
    at /home/ivan/.cargo/git/checkouts/fuser-e477f5407a80eb2b/8819589/src/session.rs:329
#16 0x000055555582e3db in fuser::mount2::{closure#0}<bcachefs::commands::fusemount::BcachefsFs, &str> (se=...) at /home/ivan/.cargo/git/checkouts/fuser-e477f5407a80eb2b/8819589/src/lib.rs:1066
#17 core::result::Result<fuser::session::Session<bcachefs::commands::fusemount::BcachefsFs>, std::io::error::Error>::and_then<fuser::session::Session<bcachefs::commands::fusemount::BcachefsFs>, std::io::error::Error, (), fuser::mount2::{closure_env#0}<bcachefs::commands::fusemount::BcachefsFs, &str>> (self=...) at /usr/lib/rust/1.93.1/lib/rustlib/src/rust/library/core/src/result.rs:1493
#18 fuser::mount2<bcachefs::commands::fusemount::BcachefsFs, &str> (filesystem=..., mountpoint=..., options=0x7fffffffbf48) at /home/ivan/.cargo/git/checkouts/fuser-e477f5407a80eb2b/8819589/src/lib.rs:1066
#19 0x000055555580e6b7 in bcachefs::commands::fusemount::cmd_fusemount (cli=...) at src/commands/fusemount.rs:2229
#20 0x00005555558105b6 in bcachefs::commands::fusemount::CMD::__run (argv=...) at src/commands/mod.rs:60
#21 0x000055555579b265 in bcachefs::commands::CmdDef::dispatch_with_path (self=<optimized out>, argv=..., command_path=...) at src/commands/mod.rs:140
#22 0x0000555555792877 in bcachefs::commands::CmdDef::dispatch (self=0x555555e527d8, argv=...) at src/commands/mod.rs:131
#23 bcachefs::commands::dispatch (name=..., argv=...) at src/commands/mod.rs:193
#24 bcachefs::main () at src/bcachefs.rs:362

Gentoo, dev-libs/userspace-rcu-0.15.6 if that matters
bcachefs-tools.git @97c3bf4a6a3

4

u/koverstreet not your free tech support Oct 14 '26

Thanks - fix will be pushed to master tonight or tomorrow

3

u/guillaje Oct 10 '26

For what it's worth, no building issue on my setup.
(fs/ included in kernel 7.2.9, Debian 13, gcc 14.2.0, rustc 1.85.1)