Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Automatic failing on-disk version downgrades with when accidentally mounting under older kernel version #782

Open
KW-M opened this issue Nov 17, 2024 · 4 comments

Comments

@KW-M
Copy link

KW-M commented Nov 17, 2024

This bug report is some just interesting behavior from me being a newbie and unintentionally rolling back kernel versions.
I think it would be helpful to show a warning message instead of automatically doing some kind of strange "upgrade/downgrade" of disk versions when mounted on an older kernel to avoid a bunch of weird issues that could come up with disparate versions of bcachefs kernel code and on-disk versions.
At the very least, the current behavior is rather confusing to a newbie. Fortunately The data on this disk is quite small and backed up, so I will probably reformat and continue from there.

What I Did:

  1. ON FEDORA VERSION 41, I formatted this bcachefs with an NVME SSD partition and two USB HDDs partitions for storing pictures/documents - Everything went well thus far
  2. Due to some unrelated grub dual boot issues I rolled back my OS drive (stock fedora btrfs volume) to a snapshot FEDORA VERSION 40 with (presumably) an earlier kernel version
  3. I then proceeded to try and mount the bcachefs drives which repeatedly failed (with fsck it later "worked" temporarily).
    The thing that's interesting is it appears to try to "upgrade" the bcachefs version (without fsck) FROM version 1.7 TO version 1.12! - That sounds more like an automatic version downgrade?
starting version 1.7: mi_btree_bitmap opts=errors=ro,metadata_replicas=2,data_replicas=2,foreground_target=ssd.thecacheA,background_target=hdd.mainB,prom>
Recovering from clean shutdown, journal seq 155115
Doing compatible version upgrade from 1.7: mi_btree_bitmap to 1.12: rebalance_work_acct_fix

The next mount attempt it says a similar message but w incomplete:

Doing compatible version upgrade from 1.7: mi_btree_bitmap to 1.12: rebalance_work_acct_fix

doing fsck works and mounts the drive (see full logs below)

Then the next boot it fails again (without fsck) & doesn't seem to know about which version it is on and says it needs to downgrade from version 1.2

mounting version 1.12: (unknown version) opts=errors=ro,metadata_replicas=2,data_replicas=2,foreground_target=ssd.thecacheA,background_target=hdd.mainB,promote_target=ssd.thecacheA
recovering from clean shutdown, journal seq 157855
Version downgrade required:

Again running with Fsck allows the drive to mount.

This all doesn't make much sense from a newbie user perspective - I don't really know what version my disks are on now, and doesn't inspire confidence if someone were to make the same mistake in the future. I will try mounting again on fedora 41 later today

Full Logs
Pervious Bootup (Fedora 40)
journalctl -b -1

#  .... ran sudo mount -v -t bcachefs /home/kyle/Public/BigLizardBcfs
ov 17 09:07:34 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): starting version 1.7: mi_btree_bitmap opts=errors=ro,metadata_replicas=2,data_replicas=2,foreground_target=ssd.thecacheA,background_target=hdd.mainB,prom>
Nov 17 09:07:34 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): recovering from clean shutdown, journal seq 155115
Nov 17 09:07:34 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): Doing compatible version upgrade from 1.7: mi_btree_bitmap to 1.12: rebalance_work_acct_fix
                                     running recovery passes: check_allocations
Nov 17 09:07:34 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): accounting_read... done
Nov 17 09:07:34 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): alloc_read... done
Nov 17 09:07:34 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): stripes_read... done
Nov 17 09:07:34 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): snapshots_read... done
Nov 17 09:07:52 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_allocations...
Nov 17 09:07:52 nuc-fedora kernel: bucket 1:8201 gen 0 data type btree has wrong fragmentation_lru: got 0, should be 1073741824, shutting down
Nov 17 09:07:52 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): inconsistency detected - emergency read only at journal seq 155115
Nov 17 09:07:52 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): bch2_gc_alloc_done(): error fsck_errors_not_fixed
Nov 17 09:07:52 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): bch2_check_allocations(): error fsck_errors_not_fixed
Nov 17 09:07:52 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): bch2_fs_recovery(): error fsck_errors_not_fixed
Nov 17 09:07:52 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): bch2_fs_start(): error starting filesystem fsck_errors_not_fixed
Nov 17 09:07:52 nuc-fedora udisksd[2935]: Error: Invalid argument
Nov 17 09:07:52 nuc-fedora kernel: bcachefs: bch2_fs_get_tree() error: fsck_errors_not_fixed

# ... Tried again without fsck: sudo mount -t bcachefs /home/kyle/Public/BigLizardBcfs
Nov 17 09:08:11 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): starting version 1.12: rebalance_work_acct_fix opts=errors=ro,metadata_replicas=2,data_replicas=2,foreground_target=ssd.thecacheA,background_target=hdd.m>
Nov 17 09:08:11 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): recovering from clean shutdown, journal seq 155115
Nov 17 09:08:11 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): superblock requires following recovery passes to be run:
                                     check_allocations
Nov 17 09:08:11 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): Version upgrade from 1.7: mi_btree_bitmap to 1.12: rebalance_work_acct_fix incomplete
                                   Doing compatible version upgrade from 1.7: mi_btree_bitmap to 1.12: rebalance_work_acct_fix
Nov 17 09:08:12 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): accounting_read... done
Nov 17 09:08:12 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): alloc_read... done
Nov 17 09:08:12 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): stripes_read... done
Nov 17 09:08:12 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): snapshots_read... done
Nov 17 09:08:28 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_allocations...
Nov 17 09:08:28 nuc-fedora kernel: bucket 1:8201 gen 0 data type btree has wrong fragmentation_lru: got 0, should be 1073741824, shutting down
Nov 17 09:08:28 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): inconsistency detected - emergency read only at journal seq 155115
Nov 17 09:08:28 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): bch2_gc_alloc_done(): error fsck_errors_not_fixed
Nov 17 09:08:28 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): bch2_check_allocations(): error fsck_errors_not_fixed
Nov 17 09:08:28 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): bch2_fs_recovery(): error fsck_errors_not_fixed
Nov 17 09:08:28 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): bch2_fs_start(): error starting filesystem fsck_errors_not_fixed
Nov 17 09:08:28 nuc-fedora kernel: bcachefs: bch2_fs_get_tree() error: fsck_errors_not_fixed

# ... tried with fsck 
Nov 17 09:09:39 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): starting version 1.12: rebalance_work_acct_fix opts=errors=ro,metadata_replicas=2,data_replicas=2,foreground_target=ssd.thecacheA,background_target=hdd.m>
Nov 17 09:09:39 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): starting version 1.12: rebalance_work_acct_fix opts=errors=ro,metadata_replicas=2,data_replicas=2,foreground_target=ssd.thecacheA,background_target=hdd.m>
Nov 17 09:09:39 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): recovering from clean shutdown, journal seq 155115
Nov 17 09:09:39 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): superblock requires following recovery passes to be run:
                                     check_allocations
Nov 17 09:09:39 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): Version upgrade from 1.7: mi_btree_bitmap to 1.12: rebalance_work_acct_fix incomplete
                                   Doing compatible version upgrade from 1.7: mi_btree_bitmap to 1.12: rebalance_work_acct_fix
Nov 17 09:09:39 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): accounting_read... done
Nov 17 09:09:39 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): alloc_read... done
Nov 17 09:09:39 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): stripes_read... done
Nov 17 09:09:39 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): snapshots_read... done
Nov 17 09:09:56 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_allocations...
Nov 17 09:09:56 nuc-fedora kernel: bucket 1:8201 gen 0 data type btree has wrong fragmentation_lru: got 0, should be 1073741824, fixing
Nov 17 09:09:56 nuc-fedora kernel: bucket 1:8202 gen 0 data type btree has wrong fragmentation_lru: got 0, should be 1073741824, fixing
Nov 17 09:09:56 nuc-fedora kernel: bucket 1:8203 gen 0 data type btree has wrong fragmentation_lru: got 0, should be 1073741824, fixing
Nov 17 09:09:56 nuc-fedora kernel: bucket 1:8205 gen 0 data type btree has wrong fragmentation_lru: got 0, should be 1073741824, fixing
Nov 17 09:09:56 nuc-fedora kernel: bucket 1:8206 gen 0 data type btree has wrong fragmentation_lru: got 0, should be 1073741824, fixing
Nov 17 09:09:56 nuc-fedora kernel: bucket 1:8207 gen 0 data type btree has wrong fragmentation_lru: got 0, should be 1073741824, fixing
Nov 17 09:09:56 nuc-fedora kernel: bucket 1:8208 gen 0 data type btree has wrong fragmentation_lru: got 0, should be 1073741824, fixing
Nov 17 09:09:56 nuc-fedora kernel: bucket 1:8210 gen 0 data type btree has wrong fragmentation_lru: got 0, should be 1073741824, fixing
Nov 17 09:09:56 nuc-fedora kernel: bucket 1:8212 gen 0 data type btree has wrong fragmentation_lru: got 0, should be 1073741824, fixing
Nov 17 09:09:56 nuc-fedora kernel: bucket 1:8214 gen 0 data type btree has wrong fragmentation_lru: got 0, should be 1073741824, fixing
Nov 17 09:09:56 nuc-fedora kernel: bucket 1:8216 gen 0 data type btree has wrong fragmentation_lru: got 0, should be 1073741824, fixing
Nov 17 09:09:56 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): Ratelimiting new instances of previous error
Nov 17 09:10:02 nuc-fedora kernel:  done
Nov 17 09:10:02 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): going read-write
Nov 17 09:10:02 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): journal_replay... done
Nov 17 09:10:25 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_alloc_info... done
Nov 17 09:10:25 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_lrus... done
Nov 17 09:10:31 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_btree_backpointers... done
Nov 17 09:10:36 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_backpointers_to_extents... done
Nov 17 09:10:42 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_extents_to_backpointers... done
Nov 17 09:10:43 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_alloc_to_lru_refs... done
Nov 17 09:10:43 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_snapshot_trees... done
Nov 17 09:10:43 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_snapshots... done
Nov 17 09:10:43 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_subvols... done
Nov 17 09:10:43 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_subvol_children... done
Nov 17 09:10:43 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): delete_dead_snapshots... done
Nov 17 09:10:43 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_inodes... done
Nov 17 09:10:44 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_extents... done
Nov 17 09:10:44 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_indirect_extents... done
Nov 17 09:10:44 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_dirents... done
Nov 17 09:10:44 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_xattrs... done
Nov 17 09:10:44 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_root... done
Nov 17 09:10:44 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_subvolume_structure... done
Nov 17 09:10:44 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_directory_structure... done
Nov 17 09:10:44 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_nlinks... done
Nov 17 09:10:44 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): resume_logged_ops... done
Nov 17 09:10:44 nuc-fedora kernel: bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): delete_dead_inodes... done
# drive is mounted rw just fine now

Second Bootup (still fedora 40)

What I did:

kyle@nuc-fedora:~$ sudo mount -v /home/kyle/Public/BigLizardBcfs
[INFO  src/commands/mount.rs:303] mounting with params: device: /dev/nvme0n1p4:/dev/sda1:/dev/sdb1, target: /home/kyle/Public/BigLizardBcfs, options: rw,user,noexec,nosuid,nodev,nofail,context="unconfined_u:object_r:samba_share_t:s0"
[INFO  src/commands/mount.rs:43] mounting filesystem
kyle@nuc-fedora:~$ sudo mount -v /home/kyle/Public/BigLizardBcfs
[INFO  src/commands/mount.rs:303] mounting with params: device: /dev/nvme0n1p4:/dev/sda1:/dev/sdb1, target: /home/kyle/Public/BigLizardBcfs, options: rw,user,noexec,nosuid,nodev,nofail,context="unconfined_u:object_r:samba_share_t:s0"
[INFO  src/commands/mount.rs:43] mounting filesystem
Error: Invalid argument
kyle@nuc-fedora:~$ sudo mount -t bcachefs -o fsck,fix_errors /home/kyle/Public/BigLizardBcfs
kyle@nuc-fedora:~$ 

What got logged: (dmesg)

[  382.842293] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): mounting version 1.12: (unknown version) opts=errors=ro,metadata_replicas=2,data_replicas=2,foreground_target=ssd.thecacheA,background_target=hdd.mainB,promote_target=ssd.thecacheA
[  382.842308] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): recovering from clean shutdown, journal seq 157855
[  382.842312] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): Version downgrade required:
                 running recovery passes: check_allocations
[  382.969256] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): alloc_read... done
[  383.004882] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): stripes_read... done
[  383.004885] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): snapshots_read... done
[  383.004889] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_allocations...
[  400.991319] bucket 1:8201 gen 0 data type btree has wrong fragmentation_lru: got 0, should be 1073741824, shutting down
[  400.991325] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): inconsistency detected - emergency read only at journal seq 157855
[  400.991330] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): bch2_gc_alloc_done(): error fsck_errors_not_fixed
[  401.004422] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): bch2_check_allocations(): error fsck_errors_not_fixed
[  401.004432] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): bch2_fs_recovery(): error fsck_errors_not_fixed
[  401.004433] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): bch2_fs_start(): error starting filesystem fsck_errors_not_fixed
[  401.028823] bcachefs: bch2_mount() error: fsck_errors_not_fixed


[  467.297316] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): mounting version 1.7: mi_btree_bitmap opts=errors=ro,metadata_replicas=2,data_replicas=2,foreground_target=ssd.thecacheA,background_target=hdd.mainB,promote_target=ssd.thecacheA
[  467.297325] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): recovering from clean shutdown, journal seq 157855
[  467.297327] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): superblock requires following recovery passes to be run:
                 check_allocations
[  467.544548] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): alloc_read... done
[  467.584288] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): stripes_read... done
[  467.584291] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): snapshots_read... done
[  467.584294] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_allocations...
[  484.410822] bucket 1:8201 gen 0 data type btree has wrong fragmentation_lru: got 0, should be 1073741824, shutting down
[  484.410828] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): inconsistency detected - emergency read only at journal seq 157855
[  484.410829] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): bch2_gc_alloc_done(): error fsck_errors_not_fixed
[  484.422426] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): bch2_check_allocations(): error fsck_errors_not_fixed
[  484.422438] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): bch2_fs_recovery(): error fsck_errors_not_fixed
[  484.422439] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): bch2_fs_start(): error starting filesystem fsck_errors_not_fixed
[  484.443957] bcachefs: bch2_mount() error: fsck_errors_not_fixed



[  560.014580] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): mounting version 1.7: mi_btree_bitmap opts=errors=ro,metadata_replicas=2,data_replicas=2,foreground_target=ssd.thecacheA,background_target=hdd.mainB,promote_target=ssd.thecacheA,fsck,fix_errors=yes
[  560.014588] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): recovering from clean shutdown, journal seq 157855
[  560.014590] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): superblock requires following recovery passes to be run:
                 check_allocations
[  560.240775] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): alloc_read... done
[  560.275896] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): stripes_read... done
[  560.275899] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): snapshots_read... done
[  560.275902] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_allocations...
[  577.105087] bucket 1:8201 gen 0 data type btree has wrong fragmentation_lru: got 0, should be 1073741824, fixing
[  577.105093] bucket 1:8202 gen 0 data type btree has wrong fragmentation_lru: got 0, should be 1073741824, fixing
[  577.105095] bucket 1:8203 gen 0 data type btree has wrong fragmentation_lru: got 0, should be 1073741824, fixing
[  577.105097] bucket 1:8205 gen 0 data type btree has wrong fragmentation_lru: got 0, should be 1073741824, fixing
[  577.105098] bucket 1:8206 gen 0 data type btree has wrong fragmentation_lru: got 0, should be 1073741824, fixing
[  577.105100] bucket 1:8207 gen 0 data type btree has wrong fragmentation_lru: got 0, should be 1073741824, fixing
[  577.105101] bucket 1:8208 gen 0 data type btree has wrong fragmentation_lru: got 0, should be 1073741824, fixing
[  577.105103] bucket 1:8210 gen 0 data type btree has wrong fragmentation_lru: got 0, should be 1073741824, fixing
[  577.105105] bucket 1:8212 gen 0 data type btree has wrong fragmentation_lru: got 0, should be 1073741824, fixing
[  577.105106] bucket 1:8214 gen 0 data type btree has wrong fragmentation_lru: got 0, should be 1073741824, fixing
[  577.105108] bucket 1:8216 gen 0 data type btree has wrong fragmentation_lru: got 0, should be 1073741824, fixing
[  577.105109] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): Ratelimiting new instances of previous error
[  582.944019]  done
[  582.987605] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): going read-write
[  582.989482] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): journal_replay... done
[  582.989493] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_alloc_info... done
[  606.145303] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_lrus... done
[  606.436446] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_btree_backpointers... done
[  611.566607] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_backpointers_to_extents... done
[  617.127140] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_extents_to_backpointers... done
[  623.159926] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_alloc_to_lru_refs... done
[  623.729439] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_snapshot_trees... done
[  623.729450] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_snapshots... done
[  623.729457] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_subvols... done
[  623.729475] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_subvol_children... done
[  623.729477] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): delete_dead_snapshots... done
[  623.729478] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_inodes... done
[  623.729510] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_extents... done
[  624.821215] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_indirect_extents... done
[  624.821219] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_dirents... done
[  624.821258] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_xattrs... done
[  624.821271] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_root... done
[  624.821276] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_subvolume_structure... done
[  624.821277] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_directory_structure... done
[  624.821307] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): check_nlinks... done
[  624.821337] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): resume_logged_ops... done
[  624.821340] bcachefs (63cf1a45-241b-4a03-a89b-1b49bf5eaa25): delete_dead_inodes... done
# drive is mounted rw just fine now

my fstab

UUID=63cf1a45-241b-4a03-a89b-1b49bf5eaa25 /home/kyle/Public/BigLizardBcfs bcachefs user,auto,nofail,context="unconfined_u:object_r:samba_share_t:s0",x-gvfs-show 0 0

bcachefs show-super /dev/nvme0n1p4

Device:                                     (unknown device)
External UUID:                             63cf1a45-241b-4a03-a89b-1b49bf5eaa25
Internal UUID:                             cb2d7442-d692-4b22-b475-5fab673c4892
Magic number:                              c68573f6-66ce-90a9-d96a-60cf803df7ef
Device index:                              0
Label:                                     BigLizardBcfs
Version:                                   1.7: mi_btree_bitmap
Version upgrade complete:                  1.7: mi_btree_bitmap
Oldest version on disk:                    1.7: mi_btree_bitmap
Created:                                   Tue Nov 12 12:40:31 2024
Sequence number:                           111
Time of last write:                        Sun Nov 17 11:10:48 2024
Superblock size:                           5.04 KiB/1.00 MiB
Clean:                                     0
Devices:                                   3
Sections:                                  members_v1,replicas_v0,disk_groups,clean,journal_v2,counters,members_v2,errors,ext,downgrade
Features:                                  new_siphash,inline_data,new_extent_overwrite,btree_ptr_v2,extents_above_btree_updates,btree_updates_journalled,new_varint,journal_no_flush,alloc_v2,extents_across_btree_nodes
Compat features:                           alloc_info,alloc_metadata,extents_above_btree_updates_done,bformat_overflow_done

Options:
  block_size:                              4.00 KiB
  btree_node_size:                         256 KiB
  errors:                                  continue fix_safe panic [ro] 
  metadata_replicas:                       2
  data_replicas:                           2
  metadata_replicas_required:              1
  data_replicas_required:                  1
  encoded_extent_max:                      64.0 KiB
  metadata_checksum:                       none [crc32c] crc64 xxhash 
  data_checksum:                           none [crc32c] crc64 xxhash 
  compression:                             none
  background_compression:                  none
  str_hash:                                crc32c crc64 [siphash] 
  metadata_target:                         none
  foreground_target:                       ssd.thecacheA
  background_target:                       hdd.mainB
  promote_target:                          ssd.thecacheA
  erasure_code:                            0
  inodes_32bit:                            1
  shard_inode_numbers:                     1
  inodes_use_key_cache:                    1
  gc_reserve_percent:                      8
  gc_reserve_bytes:                        0 B
  root_reserve_percent:                    0
  wide_macs:                               0
  promote_whole_extents:                   1
  acl:                                     1
  usrquota:                                0
  grpquota:                                0
  prjquota:                                0
  journal_flush_delay:                     1000
  journal_flush_disabled:                  0
  journal_reclaim_delay:                   100
  journal_transaction_names:               1
  allocator_stuck_timeout:                 30
  version_upgrade:                         [compatible] incompatible none 
  nocow:                                   0

members_v2 (size 448):
Device:                                    0
  Label:                                   thecacheA (1)
  UUID:                                    4e41e0ca-bee1-4514-b129-c3793a92f534
  Size:                                    977 GiB
  read errors:                             0
  write errors:                            0
  checksum errors:                         0
  seqread iops:                            0
  seqwrite iops:                           0
  randread iops:                           0
  randwrite iops:                          0
  Bucket size:                             512 KiB
  First bucket:                            0
  Buckets:                                 2000000
  Last mount:                              Sun Nov 17 11:09:44 2024
  Last superblock write:                   111
  State:                                   rw
  Data allowed:                            journal,btree,user
  Has data:                                cached
  Btree allocated bitmap blocksize:        1.00 B
  Btree allocated bitmap:                  0000000000000000000000000000000000000000000000000000000000000000
  Durability:                              0
  Discard:                                 1
  Freespace initialized:                   1
Device:                                    1
  Label:                                   mainA (3)
  UUID:                                    81219bb4-8621-4297-b366-b65aa6f3deca
  Size:                                    7.28 TiB
  read errors:                             0
  write errors:                            0
  checksum errors:                         0
  seqread iops:                            0
  seqwrite iops:                           0
  randread iops:                           0
  randwrite iops:                          0
  Bucket size:                             512 KiB
  First bucket:                            0
  Buckets:                                 15263788
  Last mount:                              Sun Nov 17 11:09:44 2024
  Last superblock write:                   111
  State:                                   rw
  Data allowed:                            journal,btree,user
  Has data:                                journal,btree,user
  Btree allocated bitmap blocksize:        8.00 MiB
  Btree allocated bitmap:                  0000000000000000000000000001000000000000000000000010000000000010
  Durability:                              1
  Discard:                                 1
  Freespace initialized:                   1
Device:                                    2
  Label:                                   mainB (4)
  UUID:                                    3dfa9716-9bda-497e-a8c7-14bb38f760d7
  Size:                                    7.28 TiB
  read errors:                             0
  write errors:                            0
  checksum errors:                         0
  seqread iops:                            0
  seqwrite iops:                           0
  randread iops:                           0
  randwrite iops:                          0
  Bucket size:                             512 KiB
  First bucket:                            0
  Buckets:                                 15263788
  Last mount:                              Sun Nov 17 11:09:44 2024
  Last superblock write:                   111
  State:                                   rw
  Data allowed:                            journal,btree,user
  Has data:                                journal,btree,user
  Btree allocated bitmap blocksize:        8.00 MiB
  Btree allocated bitmap:                  0001100000000000000000000000000000000000011000000100000000010110
  Durability:                              1
  Discard:                                 1
  Freespace initialized:                   1

errors (size 40):
lru_entry_bad                               26              Sat Nov 16 21:59:00 2024
alloc_key_fragmentation_lru_wrong           78              Sun Nov 17 11:10:03 2024
@koverstreet
Copy link
Owner

Yeah, we don't have an ideal solution to this yet.

Prompting the user would require making our mount helper able to prompt, and that would have a lot of integration work to do to (systemd etc) to make sure the user can respond. That is something we do need, because that's what I plan on doing for degraded mounts, but we're not there yet.

And in the near future I'm hoping to not be doing any more automatic forced version upgrades. But there's still one more coming for some backpointers work - hopefully that's the last.

@KW-M
Copy link
Author

KW-M commented Nov 17, 2024

Thanks @koverstreet (and thanks again for making bcachefs!)

Makes sense that prompting user on mount is tricky.

The thing that got me was it tried to do a forced disk version DOWNGRADE - and seems to have had trouble doing so.

Doing forced upgrades makes sense, but forced downgrades on older kernel versions seems like a much more risky thing (to me).

@koverstreet
Copy link
Owner

Well, what we really want to avoid is a user mounting on a new kernel and not realizing they can't go back.

Downgrades shouldn't be risky, the upgrade/downgrade paths just run certain fsck passes; but we did have issues on 6.9 where the downgrade section wasn't being read correctly.

Lots to do :)

@thememika
Copy link

@koverstreet have you thought about getting current->signal->tty in the mount context, and interacting with it by current->signal->tty->driver->ops->... functions? It wouldn't require any "integration with systemd".
I used it in my kernel codes, and it works regardless of the user being on a real TTY (VT/serial), or a PTY (for example, Gnome terminal or SSH) - works in all these cases.
I don't use SystemD, but I believe it can also work during Systemd boot (automatic FS mounting), but I'm not sure. It depends on whether there is a "TTY" (virtual or not) associated with the process which triggers the mount systemcall.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants