koverstreet / bcachefs-tools

http://bcachefs.org
GNU General Public License v2.0
120 stars 89 forks source link

Can't dump, forever waiting to go read-only #337

Open g2p opened 6 days ago

g2p commented 6 days ago

Here is the output of dump --verbose:

starting version 1.12: rebalance_work_acct_fix opts=ro,errors=continue,compression=lz4,background_compression=zstd,foreground_target=ssd,background_target=hdd,promote_target=ssd,gc_reserve_percent=5,degraded,very_degraded,verbose,fix_errors=no,nochanges,norecovery,noexcl,nodirect_io,read_only
recovering from unclean shutdown
starting journal read
journal read done on device /dev/Consolidated/Down, ret 0
journal read done on device /dev/Consolidated/DownCache, ret 0
journal read done, replaying entries 56781684-56781684
Journal keys: 0 read, 0 after sorting and compacting
accounting_read... done
alloc_read... done
stripes_read... done
snapshots_read... done
going read-write
going read-only

Apparently bcachefs is confused about going read-write or read-only.

Thread 1 (Thread 0x7ffff7d78c80 (LWP 82738) "bcachefs"):
#0  syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
#1  0x0000555555773aa9 in futex (val3=0, uaddr2=0x0, timeout=0x0, val=<optimized out>, op=128, uaddr=<optimized out>) at /usr/include/x86_64-linux-gnu/urcu/futex.h:81
#2  schedule () at linux/sched.c:41
#3  0x00005555557637c5 in bch2_fs_read_only (c=0x7ffff7cfa000) at libbcachefs/super.c:346
#4  0x000055555576547c in bch2_fs_start (c=c@entry=0x7ffff7cfa000) at libbcachefs/super.c:1055
#5  0x00005555557688ea in bch2_fs_open (devices=0x555555975750, nr_devices=<optimized out>, opts=...) at libbcachefs/super.c:2071
#6  0x000055555565a048 in cmd_dump (argc=<optimized out>, argv=<optimized out>) at c_src/cmd_dump.c:151
#7  0x000055555564f2e4 in bcachefs::main ()
#8  0x000055555564d5d3 in std::sys::backtrace::__rust_begin_short_backtrace ()
#9  0x0000555555642d79 in std::rt::lang_start::{{closure}} ()
#10 0x0000555555829110 in core::ops::function::impls::{impl#2}::call_once<(), (dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> () at library/core/src/ops/function.rs:284
#11 std::panicking::try::do_call<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> () at library/std/src/panicking.rs:557
#12 std::panicking::try<i32, &(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> () at library/std/src/panicking.rs:521
#13 std::panic::catch_unwind<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> () at library/std/src/panic.rs:350
#14 std::rt::lang_start_internal::{closure#2} () at library/std/src/rt.rs:141
#15 std::panicking::try::do_call<std::rt::lang_start_internal::{closure_env#2}, isize> () at library/std/src/panicking.rs:557
#16 std::panicking::try<isize, std::rt::lang_start_internal::{closure_env#2}> () at library/std/src/panicking.rs:521
#17 std::panic::catch_unwind<std::rt::lang_start_internal::{closure_env#2}, isize> () at library/std/src/panic.rs:350
#18 std::rt::lang_start_internal () at library/std/src/rt.rs:141
#19 0x000055555564f5a5 in main ()

The futex is this:

wait_event(bch2_read_only_wait,
       test_bit(BCH_FS_write_disable_complete, &c->flags) ||
       test_bit(BCH_FS_emergency_ro, &c->flags));
g2p commented 6 days ago

This is where going read-write is coming from:

Thread 1 "bcachefs" hit Breakpoint 3, bch2_fs_read_write_early (c=0x7ffff7cfa000) at libbcachefs/super.c:523
523     {
(gdb) bt
#0  bch2_fs_read_write_early (c=0x7ffff7cfa000) at libbcachefs/super.c:523
#1  0x0000555555742825 in bch2_run_recovery_pass (c=c@entry=0x7ffff7cfa000, pass=pass@entry=BCH_RECOVERY_PASS_set_may_go_rw) at libbcachefs/recovery_passes.c:185
#2  0x0000555555742d1a in bch2_run_recovery_passes (c=c@entry=0x7ffff7cfa000) at libbcachefs/recovery_passes.c:232
#3  0x000055555574105a in bch2_fs_recovery (c=0x7ffff7cfa000) at libbcachefs/recovery.c:859
#4  0x000055555576530d in bch2_fs_start (c=c@entry=0x7ffff7cfa000) at libbcachefs/super.c:1037
#5  0x00005555557688ea in bch2_fs_open (devices=0x555555975750, nr_devices=<optimized out>, opts=...) at libbcachefs/super.c:2071
#6  0x000055555565a048 in cmd_dump (argc=<optimized out>, argv=<optimized out>) at c_src/cmd_dump.c:151
#7  0x000055555564f2e4 in bcachefs::main ()
g2p commented 6 days ago

Somehow make debug (with CFLAGS+=-DCONFIG_BCACHEFS_DEBUG=y) produced a command that does dump.