• Linus Torvalds's avatar
    Merge tag 'bcachefs-2024-05-19' of https://evilpiepirate.org/git/bcachefs · 16dbfae8
    Linus Torvalds authored
    Pull bcachefs updates from Kent Overstreet:
    
     - More safety fixes, primarily found by syzbot
    
     - Run the upgrade/downgrade paths in nochnages mode. Nochanges mode is
       primarily for testing fsck/recovery in dry run mode, so it shouldn't
       change anything besides disabling writes and holding dirty metadata
       in memory.
    
       The idea here was to reduce the amount of activity if we can't write
       anything out, so that bringing up a filesystem in "super ro" mode
       would be more lilkely to work for data recovery - but norecovery is
       the correct option for this.
    
     - btree_trans->locked; we now track whether a btree_trans has any btree
       nodes locked, and this is used for improved assertions related to
       trans_unlock() and trans_relock(). We'll also be using it for
       improving how we work with lockdep in the future: we don't want
       lockdep to be tracking individual btree node locks because we take
       too many for lockdep to track, and it's not necessary since we have a
       cycle detector.
    
     - Trigger improvements that are prep work for online fsck
    
     - BTREE_TRIGGER_check_repair; this regularizes how we do some repair
       work for extents that goes with running triggers in fsck, and fixes
       some subtle issues with transaction restarts there.
    
     - bch2_snapshot_equiv() has now been ripped out of fsck.c; snapshot
       equivalence classes are for when snapshot deletion leaves behind
       redundant snapshot nodes, but snapshot deletion now cleans this up
       right away, so the abstraction doesn't need to leak.
    
     - Improvements to how we resume writing to the journal in recovery. The
       code for picking the new place to write when reading the journal is
       greatly simplified and we also store the position in the superblock
       for when we don't read the journal; this means that we preserve more
       of the journal for list_journal debugging.
    
     - Improvements to sysfs btree_cache and btree_node_cache, for debugging
       memory reclaim.
    
     - We now detect when we've blocked for 10 seconds on the allocator in
       the write path and dump some useful info.
    
     - Safety fixes for devices references: this is a big series that
       changes almost all device lookups to properly check if the device
       exists and take a reference to it.
    
       Previously we assumed that if a bkey exists that references a device
       then the device must exist, and this was enforced in .invalid
       methods, but this was incorrect because it meant device removal
       relied on accounting being correct to not leave keys pointing to
       invalid devices, and that's not something we can assume.
    
       Getting the "pointer to invalid device" checks out of our .invalid()
       methods fixes some long standing device removal bugs; the only
       outstanding bug with device removal now is a race between the discard
       path and deleting alloc info, which should be easily fixed.
    
     - The allocator now prefers not to expand the new
       member_info.btree_allocated bitmap, meaning if repair ever requires
       scanning for btree nodes (because of a corrupt interior nodes) we
       won't have to scan the whole device(s).
    
     - New coding style document, which among other things talks about the
       correct usage of assertions
    
    * tag 'bcachefs-2024-05-19' of https://evilpiepirate.org/git/bcachefs: (155 commits)
      bcachefs: add no_invalid_checks flag
      bcachefs: add counters for failed shrinker reclaim
      bcachefs: Fix sb_field_downgrade validation
      bcachefs: Plumb bch_validate_flags to sb_field_ops.validate()
      bcachefs: s/bkey_invalid_flags/bch_validate_flags
      bcachefs: fsync() should not return -EROFS
      bcachefs: Invalid devices are now checked for by fsck, not .invalid methods
      bcachefs: kill bch2_dev_bkey_exists() in bch2_check_fix_ptrs()
      bcachefs: kill bch2_dev_bkey_exists() in bch2_read_endio()
      bcachefs: bch2_dev_get_ioref() checks for device not present
      bcachefs: bch2_dev_get_ioref2(); io_read.c
      bcachefs: bch2_dev_get_ioref2(); debug.c
      bcachefs: bch2_dev_get_ioref2(); journal_io.c
      bcachefs: bch2_dev_get_ioref2(); io_write.c
      bcachefs: bch2_dev_get_ioref2(); btree_io.c
      bcachefs: bch2_dev_get_ioref2(); backpointers.c
      bcachefs: bch2_dev_get_ioref2(); alloc_background.c
      bcachefs: for_each_bset() declares loop iter
      bcachefs: Move BCACHEFS_STATFS_MAGIC value to UAPI magic.h
      bcachefs: Improve sysfs internal/btree_cache
      ...
    16dbfae8
fs.c 50.7 KB