koverstreet / bcachefs

Other
662 stars 70 forks source link

lost+found location / fsck crash with *experimental* mount option X-mount.subdir #714

Closed CorrosiveTruths closed 1 month ago

CorrosiveTruths commented 1 month ago

Hi, I'm using X-mount.subdir - which is an experimental feature to mount a subdir as / - essentially a bind mount. This is being used so that a snapshot can be used as /.

bcachefs has created a local lost+found inside this snapshot, so I have a /lost+found in the filesystem root and also one at /.snapshots/outlast.rw/lost+found (.snapshots and outlast.rw are both rw snapshots). Since outlast.rw is being ro snapshotted every hour, there are also a bunch of ro snapshots with lost+found directories.

The /lost+found directory itself is fine, but the others that exist don't reference anything.

e.g.

# ls -Ahli LRoot/.snapshots/outlast.rw/lost+found
ls: cannot access 'LRoot/.snapshots/outlast.rw/lost+found/1073865412': No such file or directory
ls: cannot access 'LRoot/.snapshots/outlast.rw/lost+found/31733': No such file or directory
ls: cannot access 'LRoot/.snapshots/outlast.rw/lost+found/1073865794': No such file or directory
total 0
? -????????? ? ? ? ?            ? 1073865412
? -????????? ? ? ? ?            ? 1073865794
? -????????? ? ? ? ?            ? 31733

This state also crashes the fsck. It will offer to fix some of the issues though.

bcachefs (dm-0): check_directory_structure...unreachable inode
u64s 16 type inode_v3 0:200657:4294967280 len 0 ver 0:   mode=40755
  flags= (4300000)
  journal_seq=126144
  bi_size=0
  bi_sectors=0
  bi_version=0
  bi_atime=18339192306830044191
  bi_ctime=13215023419428
  bi_mtime=13215023419428
  bi_otime=1040830215413
  bi_uid=0
  bi_gid=0
  bi_nlink=0
  bi_generation=0
  bi_dev=0
  bi_data_checksum=0
  bi_compression=0
  bi_project=0
  bi_background_compression=0
  bi_data_replicas=0
  bi_promote_target=0
  bi_foreground_target=0
  bi_background_target=0
  bi_erasure_code=0
  bi_fields_set=0
  bi_dir=0
  bi_dir_offset=0
  bi_subvol=0
  bi_parent_subvol=0
  bi_nocow=0
: fix? (y,n, or Y,N for all errors of this type) Y
unreachable inode
u64s 19 type inode_v3 0:514104:U32_MAX len 0 ver 0:   mode=40700
  flags= (15300000)
  journal_seq=136134
  bi_size=0
  bi_sectors=0
  bi_version=0
  bi_atime=24192536495856
  bi_ctime=24192536495856
  bi_mtime=24192536495856
  bi_otime=24192536495856
  bi_uid=0
  bi_gid=0
  bi_nlink=1
  bi_generation=0
  bi_dev=0
  bi_data_checksum=0
  bi_compression=0
  bi_project=0
  bi_background_compression=0
  bi_data_replicas=0
  bi_promote_target=0
  bi_foreground_target=0
  bi_background_target=0
  bi_erasure_code=0
  bi_fields_set=0
  bi_dir=1073741825
  bi_dir_offset=2743316257606526284
  bi_subvol=0
  bi_parent_subvol=0
  bi_nocow=0
, fixing
bcachefs (dm-0): check_path(): error EEXIST
bcachefs (dm-0): bch2_check_directory_structure(): error EEXIST
bcachefs (dm-0): bch2_fsck_online_thread_fn(): error EEXIST
thread 'main' panicked at src/bcachefs.rs:113:79:
called `Result::unwrap()` on an `Err` value: TryFromIntError(())
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Subsequent runs of fsck crash with:


bcachefs (dm-0): check_subvolume_structure... done
bcachefs (dm-0): check_directory_structure...bcachefs (dm-0): check_path(): error EEXIST
bcachefs (dm-0): bch2_check_directory_structure(): error EEXIST
bcachefs (dm-0): bch2_fsck_online_thread_fn(): error EEXIST
thread 'main' panicked at src/bcachefs.rs:113:79:
called `Result::unwrap()` on an `Err` value: TryFromIntError(())
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace```
CorrosiveTruths commented 1 month ago

Note: The fsck fixes do not remove the missing info in the rw snapshot's lost+found and trying to rsync that snapshot results in warning about vanishing files.

CorrosiveTruths commented 1 month ago

Closing this, more going on than I thought and I need to reproduce better.