From the looks of things, a prior attempt to remove the subvolume set its bi_dir and bi_dir_offset fields to 0, however subsequent attempts to reattach it tries to read those fields to delete its directory entry, and throws an ENOENT error because it couldn't find the directory entry it was trying to remove (because it was probably already removed).
Linux 6.10.0-rc1, bcachefs version 1.7;
From the looks of things, a prior attempt to remove the subvolume set its
bi_dir
andbi_dir_offset
fields to 0, however subsequent attempts to reattach it tries to read those fields to delete its directory entry, and throws an ENOENT error because it couldn't find the directory entry it was trying to remove (because it was probably already removed).The relevant part of the fsck log:
Here's the inode for the subvolume in question:
Here's the full fsck log
``` bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): mounting version 1.7: mi_btree_bitmap opts=ro,metadata_replicas=3,data_replicas=2,metadata_checksum=xxhash,data_checksum=xxhash,background_compression=zstd:15,foreground_target=ssd,background_target=hdd,promote_target=ssd,degraded,verbose,fsck,fix_errors=yes,nochanges,read_only bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): recovering from unclean shutdown bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): starting journal read bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): journal read done on device nvme0n1p3, ret 0 bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): journal read done on device sdb, ret 0 bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): journal read done on device sda, ret 0 bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): journal read done on device sdc, ret 0 bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): journal read done, replaying entries 179595800-179600033 bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): Journal keys: 7937314 read, 3641701 after sorting and compacting bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): alloc_read... done bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): stripes_read... done bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): snapshots_read... done bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): check_allocations...fs has wrong cached: got 966599215, should be 966531013, fixing fs has wrong cached: 1/1 [2]: got 75610, should be 7408, fixing done bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): going read-write bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): journal_replay... done bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): check_alloc_info... done bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): check_lrus... done bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): check_btree_backpointers... done bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): check_backpointers_to_extents... done bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): check_extents_to_backpointers... done bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): check_alloc_to_lru_refs... done bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): check_snapshot_trees... done bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): check_snapshots... done bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): check_subvols... done bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): check_subvol_children... done bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): delete_dead_snapshots... done bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): check_inodes... done bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): check_extents... done bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): check_indirect_extents... done bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): check_dirents... done bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): check_xattrs... done bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): check_root... done bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): check_subvolume_structure...unreachable subvolume u64s 10 type subvolume 0:20:0 len 0 ver 0: root 134392626 snapshot id 4294967276 creation_parent 0 fs_parent 0, fixing bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): reattach_subvol(): error removing dirent ENOENT_bkey_type_mismatch bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): bch2_check_subvolume_structure(): error ENOENT_bkey_type_mismatch bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): bch2_fs_recovery(): error ENOENT_bkey_type_mismatch bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): bch2_fs_start(): error starting filesystem ENOENT_bkey_type_mismatch bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): shutting down bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): going read-only bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): flushing journal and stopping allocators, journal seq 179600173 bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): flushing journal and stopping allocators complete, journal seq 179600173 bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): unshutdown complete, journal seq 179600173 bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): finished waiting for writes to stop bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): done going read-only, filesystem not clean bcachefs (4d4903de-99c8-41a1-ab6a-83431f05b0dc): shutdown complete ```