kernel-hacking-2024-linux-s.../fs/bcachefs
Kent Overstreet 431312b59c bcachefs: Fix disk accounting attempting to mark invalid replicas entry
This fixes the following bug, where a disk accounting key has an invalid
replicas entry, and we attempt to add it to the superblock:

bcachefs (3c0860e8-07ca-4276-8954-11c1774be868): starting version 1.12: rebalance_work_acct_fix opts=metadata_replicas=2,data_replicas=2,foreground_target=ssd,background_target=hdd,nopromote_whole_extents,verbose,fsck,fix_errors=yes
bcachefs (3c0860e8-07ca-4276-8954-11c1774be868): recovering from clean shutdown, journal seq 15211644
bcachefs (3c0860e8-07ca-4276-8954-11c1774be868): accounting_read...
accounting not marked in superblock replicas
  replicas cached: 1/1 [0], fixing
bcachefs (3c0860e8-07ca-4276-8954-11c1774be868): sb invalid before write: Invalid superblock section replicas_v0: invalid device 0 in entry cached: 1/1 [0]
replicas_v0 (size 88):
user: 2 [3 5] user: 2 [1 4] cached: 1 [2] btree: 2 [1 2] user: 2 [2 5] cached: 1 [0] cached: 1 [4] journal: 2 [1 5] user: 2 [1 2] user: 2 [2 3] user: 2 [3 4] user: 2 [4 5] cached: 1 [1] cached: 1 [3] cached: 1 [5] journal: 2 [1 2] journal: 2 [2 5] btree: 2 [2 5] user: 2 [1 3] user: 2 [1 5] user: 2 [2 4]

bcachefs (3c0860e8-07ca-4276-8954-11c1774be868): inconsistency detected - emergency read only at journal seq 15211644
accounting not marked in superblock replicas
  replicas user: 1/1 [3], fixing
bcachefs (3c0860e8-07ca-4276-8954-11c1774be868): sb invalid before write: Invalid superblock section replicas_v0: invalid device 0 in entry cached: 1/1 [0]
replicas_v0 (size 96):
user: 2 [3 5] user: 2 [1 3] cached: 1 [2] btree: 2 [1 2] user: 2 [2 4] cached: 1 [0] cached: 1 [4] journal: 2 [1 5] user: 1 [3] user: 2 [1 5] user: 2 [3 4] user: 2 [4 5] cached: 1 [1] cached: 1 [3] cached: 1 [5] journal: 2 [1 2] journal: 2 [2 5] btree: 2 [2 5] user: 2 [1 2] user: 2 [1 4] user: 2 [2 3] user: 2 [2 5]

accounting not marked in superblock replicas
  replicas user: 1/2 [3 7], fixing
bcachefs (3c0860e8-07ca-4276-8954-11c1774be868): sb invalid before write: Invalid superblock section replicas_v0: invalid device 7 in entry user: 1/2 [3 7]
replicas_v0 (size 96):
user: 2 [3 7] user: 2 [1 3] cached: 1 [2] btree: 2 [1 2] user: 2 [2 4] cached: 1 [0] cached: 1 [4] journal: 2 [1 5] user: 1 [3] user: 2 [1 5] user: 2 [3 4] user: 2 [4 5] cached: 1 [1] cached: 1 [3] cached: 1 [5] journal: 2 [1 2] journal: 2 [2 5] btree: 2 [2 5] user: 2 [1 2] user: 2 [1 4] user: 2 [2 3] user: 2 [2 5] user: 2 [3 5]

 done
bcachefs (3c0860e8-07ca-4276-8954-11c1774be868): alloc_read... done
bcachefs (3c0860e8-07ca-4276-8954-11c1774be868): stripes_read... done
bcachefs (3c0860e8-07ca-4276-8954-11c1774be868): snapshots_read... done

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-09-27 21:46:35 -04:00
..
acl.c bcachefs: switch to rhashtable for vfs inodes hash 2024-09-09 09:41:47 -04:00
acl.h bcachefs: Switch to .get_inode_acl() 2024-08-08 15:14:02 -04:00
alloc_background.c bcachefs: bch_fs.rw_devs_change_count 2024-09-21 11:39:49 -04:00
alloc_background.h bcachefs: bch2_dev_rcu_noerror() 2024-09-21 11:39:48 -04:00
alloc_background_format.h bcachefs: Fix compat issue with old alloc_v4 keys 2024-08-22 02:07:23 -04:00
alloc_foreground.c bcachefs: Move tabstop setup to bch2_dev_usage_to_text() 2024-09-21 11:39:48 -04:00
alloc_foreground.h bcachefs: fix prototype to bch2_alloc_sectors_start_trans() 2024-09-21 11:35:20 -04:00
alloc_types.h
backpointers.c bcachefs: Remove duplicated include in backpointers.c 2024-09-21 11:39:49 -04:00
backpointers.h bcachefs: bch2_trigger_ptr() calculates sectors even when no device 2024-09-21 11:39:49 -04:00
bbpos.h
bbpos_types.h
bcachefs.h bcachefs: bch_fs.rw_devs_change_count 2024-09-21 11:39:49 -04:00
bcachefs_format.h bcachefs: promote_whole_extents is now a normal option 2024-09-09 09:41:48 -04:00
bcachefs_ioctl.h bcachefs: BCH_IOCTL_QUERY_ACCOUNTING 2024-07-14 19:00:15 -04:00
bkey.c
bkey.h bcachefs: Make bkey_fsck_err() a wrapper around fsck_err() 2024-08-13 23:00:50 -04:00
bkey_buf.h
bkey_cmp.h
bkey_methods.c bcachefs: Make bkey_fsck_err() a wrapper around fsck_err() 2024-08-13 23:00:50 -04:00
bkey_methods.h bcachefs: Make bkey_fsck_err() a wrapper around fsck_err() 2024-08-13 23:00:50 -04:00
bkey_sort.c
bkey_sort.h
bkey_types.h
bset.c bcachefs: Refactor bch2_bset_fix_lookup_table 2024-09-09 09:41:49 -04:00
bset.h bcachefs: Remove unused parameter 2024-09-09 09:41:49 -04:00
btree_cache.c bcachefs: Rework btree node pinning 2024-09-21 11:39:48 -04:00
btree_cache.h bcachefs: Rework btree node pinning 2024-09-21 11:39:48 -04:00
btree_gc.c bcachefs: Fix srcu warning in check_topology 2024-09-27 21:46:34 -04:00
btree_gc.h bcachefs: bch2_gc_pos_to_text() 2024-07-14 19:00:15 -04:00
btree_gc_types.h bcachefs: bch2_gc_pos_to_text() 2024-07-14 19:00:15 -04:00
btree_io.c bcachefs: memset bounce buffer portion to 0 after key_sort_fix_overlapping 2024-09-27 21:46:34 -04:00
btree_io.h bcachefs: btree cache counters should be size_t 2024-09-21 11:39:48 -04:00
btree_iter.c bcachefs: kill bch2_btree_iter_peek_and_restart() 2024-09-09 09:41:48 -04:00
btree_iter.h bcachefs: Hook up RENAME_WHITEOUT in rename. 2024-09-21 11:35:20 -04:00
btree_journal_iter.c bcachefs: Add a cond_resched() to __journal_keys_sort() 2024-09-09 09:41:46 -04:00
btree_journal_iter.h
btree_key_cache.c bcachefs: Use __GFP_ACCOUNT for reclaimable memory 2024-09-21 11:39:46 -04:00
btree_key_cache.h bcachefs: Improve trans_blocked_journal_reclaim tracepoint 2024-08-13 23:00:34 -04:00
btree_key_cache_types.h bcachefs: key cache can now allocate from pending 2024-09-09 09:41:47 -04:00
btree_locking.c bcachefs: Kill bch2_assert_btree_nodes_not_locked() 2024-07-14 19:59:12 -04:00
btree_locking.h bcachefs: Assert that we don't lock nodes when !trans->locked 2024-09-09 09:41:49 -04:00
btree_node_scan.c bcachefs: Fix incorrect IS_ERR_OR_NULL usage 2024-09-27 21:46:34 -04:00
btree_node_scan.h
btree_node_scan_types.h bcachefs: btree node scan: fall back to comparing by journal seq 2024-07-14 19:00:16 -04:00
btree_trans_commit.c bcachefs: bch_accounting_mode 2024-09-27 21:46:35 -04:00
btree_types.h bcachefs: Rework btree node pinning 2024-09-21 11:39:48 -04:00
btree_update.c bcachefs: Btree path tracepoints 2024-09-09 09:41:48 -04:00
btree_update.h bcachefs: Add extra padding in bkey_make_mut_noupdate() 2024-09-27 21:46:34 -04:00
btree_update_interior.c bcachefs: Rework btree node pinning 2024-09-21 11:39:48 -04:00
btree_update_interior.h bcachefs: Assert that we don't lock nodes when !trans->locked 2024-09-09 09:41:49 -04:00
btree_write_buffer.c bcachefs: silence silly kdoc warning 2024-07-18 18:33:30 -04:00
btree_write_buffer.h
btree_write_buffer_types.h
buckets.c bcachefs: bch2_trigger_ptr() calculates sectors even when no device 2024-09-21 11:39:49 -04:00
buckets.h bcachefs: Switch gc bucket array to a genradix 2024-09-09 09:41:49 -04:00
buckets_types.h bcachefs: Switch gc bucket array to a genradix 2024-09-09 09:41:49 -04:00
buckets_waiting_for_journal.c bcachefs: Reallocate table when we're increasing size 2024-08-18 20:41:50 -04:00
buckets_waiting_for_journal.h
buckets_waiting_for_journal_types.h
chardev.c bcachefs: Make read_only a mount option again, but hidden 2024-07-14 19:00:16 -04:00
chardev.h
checksum.c bcachefs: kill redundant is_vmalloc_addr() 2024-09-21 11:35:20 -04:00
checksum.h
clock.c - In the series "treewide: Refactor heap related implementation", 2024-07-21 17:56:22 -07:00
clock.h bcachefs: remove the unused macro definition 2024-09-09 09:41:48 -04:00
clock_types.h - In the series "treewide: Refactor heap related implementation", 2024-07-21 17:56:22 -07:00
compress.c
compress.h
darray.c bcachefs: darray: convert to alloc_hooks() 2024-09-09 09:41:49 -04:00
darray.h bcachefs: darray: convert to alloc_hooks() 2024-09-09 09:41:49 -04:00
data_update.c bcachefs: Don't drop devices with stripe pointers 2024-09-21 11:39:49 -04:00
data_update.h
debug.c bcachefs: Convert for_each_btree_node() to lockrestart_do() 2024-08-13 22:56:50 -04:00
debug.h
dirent.c bcachefs: bch2_readdir() -> for_each_btree_key_in_subvolume_upto 2024-09-09 09:41:48 -04:00
dirent.h bcachefs: Make bkey_fsck_err() a wrapper around fsck_err() 2024-08-13 23:00:50 -04:00
dirent_format.h
disk_accounting.c bcachefs: Fix disk accounting attempting to mark invalid replicas entry 2024-09-27 21:46:35 -04:00
disk_accounting.h bcachefs: bch_accounting_mode 2024-09-27 21:46:35 -04:00
disk_accounting_format.h bcachefs: bcachefs_metadata_version_disk_accounting_inum 2024-08-13 23:00:50 -04:00
disk_accounting_types.h bcachefs: Refactor disk accounting data structures 2024-07-14 19:00:15 -04:00
disk_groups.c
disk_groups.h
disk_groups_format.h
disk_groups_types.h
ec.c bcachefs: Don't drop devices with stripe pointers 2024-09-21 11:39:49 -04:00
ec.h bcachefs: bch2_ec_stripe_head_get() now checks for change in rw devices 2024-09-21 11:39:49 -04:00
ec_format.h bcachefs: bch_stripe.disk_label 2024-09-21 11:39:48 -04:00
ec_types.h bcachefs: bch_stripe.disk_label 2024-09-21 11:39:48 -04:00
errcode.c
errcode.h bcachefs: bch2_dev_remove_stripes() 2024-09-21 11:39:49 -04:00
error.c bcachefs: Make bkey_fsck_err() a wrapper around fsck_err() 2024-08-13 23:00:50 -04:00
error.h bcachefs: Make bkey_fsck_err() a wrapper around fsck_err() 2024-08-13 23:00:50 -04:00
extent_update.c
extent_update.h
extents.c bcachefs: Don't drop devices with stripe pointers 2024-09-21 11:39:49 -04:00
extents.h bcachefs: Don't drop devices with stripe pointers 2024-09-21 11:39:49 -04:00
extents_format.h
extents_types.h
eytzinger.c
eytzinger.h bcachefs: Fix bch2_gc_accounting_done() locking 2024-07-14 19:00:15 -04:00
fifo.h
fs-common.c bcachefs: Hook up RENAME_WHITEOUT in rename. 2024-09-21 11:35:20 -04:00
fs-common.h
fs-io-buffered.c bcachefs: bchfs_read(): call trans_begin() on every loop iter 2024-09-09 09:41:48 -04:00
fs-io-buffered.h
fs-io-direct.c bcachefs: switch to rhashtable for vfs inodes hash 2024-09-09 09:41:47 -04:00
fs-io-direct.h
fs-io-pagecache.c bcachefs: bch2_folio_set() -> for_each_btree_key_in_subvolume_upto 2024-09-09 09:41:48 -04:00
fs-io-pagecache.h bcachefs: Do not check folio_has_private() 2024-09-09 09:41:49 -04:00
fs-io.c bcachefs: quota_reserve_range() -> for_each_btree_key_in_subvolume_upto 2024-09-09 09:41:48 -04:00
fs-io.h
fs-ioctl.c bcachefs: switch to rhashtable for vfs inodes hash 2024-09-09 09:41:47 -04:00
fs-ioctl.h
fs.c bcachefs: bch2_opts_to_text() 2024-09-21 11:39:48 -04:00
fs.h bcachefs: switch to rhashtable for vfs inodes hash 2024-09-09 09:41:47 -04:00
fsck.c bcachefs: fix transaction restart handling in check_extents(), check_dirents() 2024-09-27 21:46:35 -04:00
fsck.h
inode.c bcachefs: Add snapshot to bch_inode_unpacked 2024-09-27 21:46:34 -04:00
inode.h bcachefs: Add snapshot to bch_inode_unpacked 2024-09-27 21:46:34 -04:00
inode_format.h
io_misc.c bcachefs: Make allocator stuck timeout configurable, ratelimit messages 2024-08-07 21:04:55 -04:00
io_misc.h
io_read.c bcachefs: improve error messages in bch2_ec_read_extent() 2024-09-21 11:39:49 -04:00
io_read.h
io_write.c bcachefs: BCH_WRITE_ALLOC_NOWAIT no longer applies to open bucket allocation 2024-09-21 11:35:20 -04:00
io_write.h bcachefs: Rename BCH_WRITE_DONE -> BCH_WRITE_SUBMITTED 2024-07-14 19:59:12 -04:00
io_write_types.h
journal.c bcachefs: Fix warning in bch2_fs_journal_stop() 2024-08-22 02:07:23 -04:00
journal.h
journal_io.c bcachefs: Fix unlocked access to c->disk_sb.sb in bch2_replicas_entry_validate() 2024-09-27 21:46:35 -04:00
journal_io.h
journal_reclaim.c bcachefs: Rework btree node pinning 2024-09-21 11:39:48 -04:00
journal_reclaim.h
journal_sb.c bcachefs: Fix missing validation in bch2_sb_journal_v2_validate() 2024-08-22 02:07:23 -04:00
journal_sb.h
journal_seq_blacklist.c
journal_seq_blacklist.h
journal_seq_blacklist_format.h
journal_types.h
Kconfig bcachefs: Btree path tracepoints 2024-09-09 09:41:48 -04:00
keylist.c
keylist.h
keylist_types.h
logged_ops.c
logged_ops.h
logged_ops_format.h
lru.c bcachefs: Make bkey_fsck_err() a wrapper around fsck_err() 2024-08-13 23:00:50 -04:00
lru.h bcachefs: Make bkey_fsck_err() a wrapper around fsck_err() 2024-08-13 23:00:50 -04:00
lru_format.h bcachefs: split out lru_format.h 2024-07-14 19:00:16 -04:00
Makefile bcachefs: rcu_pending 2024-09-09 09:41:47 -04:00
mean_and_variance.c
mean_and_variance.h bcachefs: mean_and_variance: Avoid too-large shift amounts 2024-07-18 18:33:30 -04:00
mean_and_variance_test.c
migrate.c
migrate.h
move.c
move.h
move_types.h
movinggc.c bcachefs: Fix failure to flush moves before sleeping in copygc 2024-08-24 10:16:21 -04:00
movinggc.h
nocow_locking.c
nocow_locking.h
nocow_locking_types.h
opts.c bcachefs: bch2_opts_to_text() 2024-09-21 11:39:48 -04:00
opts.h bcachefs: bch2_opts_to_text() 2024-09-21 11:39:48 -04:00
printbuf.c
printbuf.h
quota.c bcachefs: Make bkey_fsck_err() a wrapper around fsck_err() 2024-08-13 23:00:50 -04:00
quota.h bcachefs: Make bkey_fsck_err() a wrapper around fsck_err() 2024-08-13 23:00:50 -04:00
quota_format.h
quota_types.h
rcu_pending.c bcachefs: rcu_pending now works in userspace 2024-09-09 09:41:47 -04:00
rcu_pending.h bcachefs: rcu_pending now works in userspace 2024-09-09 09:41:47 -04:00
rebalance.c bcachefs: rebalance writes use BCH_WRITE_ONLY_SPECIFIED_DEVS 2024-09-21 11:35:20 -04:00
rebalance.h
rebalance_types.h
recovery.c bcachefs: Ensure BCH_FS_accounting_replay_done is always set 2024-09-23 18:46:58 -04:00
recovery.h
recovery_passes.c bcachefs: Options for recovery_passes, recovery_passes_exclude 2024-09-21 11:39:48 -04:00
recovery_passes.h
recovery_passes_types.h
reflink.c bcachefs: Make bkey_fsck_err() a wrapper around fsck_err() 2024-08-13 23:00:50 -04:00
reflink.h bcachefs: Make bkey_fsck_err() a wrapper around fsck_err() 2024-08-13 23:00:50 -04:00
reflink_format.h
replicas.c bcachefs: Fix unlocked access to c->disk_sb.sb in bch2_replicas_entry_validate() 2024-09-27 21:46:35 -04:00
replicas.h bcachefs: Fix unlocked access to c->disk_sb.sb in bch2_replicas_entry_validate() 2024-09-27 21:46:35 -04:00
replicas_format.h bcachefs: Annotate bch_replicas_entry_{v0,v1} with __counted_by() 2024-09-09 09:41:49 -04:00
replicas_types.h
sb-clean.c bcachefs: fix the memory leak in exception case 2024-09-27 21:46:34 -04:00
sb-clean.h
sb-counters.c
sb-counters.h
sb-counters_format.h
sb-downgrade.c bcachefs: fast exit when darray_make_room failed 2024-09-27 21:46:34 -04:00
sb-downgrade.h
sb-downgrade_format.h
sb-errors.c
sb-errors.h
sb-errors_format.h bcachefs: Mark inode errors as autofix 2024-09-27 21:46:34 -04:00
sb-errors_types.h
sb-members.c bcachefs: Fix compilation error for bch2_sb_member_alloc 2024-09-21 11:39:48 -04:00
sb-members.h bcachefs: bch2_dev_rcu_noerror() 2024-09-21 11:39:48 -04:00
sb-members_format.h bcachefs: BCH_SB_MEMBER_INVALID 2024-09-03 20:43:14 -04:00
sb-members_types.h
seqmutex.h
siphash.c
siphash.h
six.c
six.h
snapshot.c bcachefs: Fix infinite loop in propagate_key_to_snapshot_leaves() 2024-09-23 18:46:58 -04:00
snapshot.h bcachefs: Make bkey_fsck_err() a wrapper around fsck_err() 2024-08-13 23:00:50 -04:00
snapshot_format.h
str_hash.h bcachefs: Hook up RENAME_WHITEOUT in rename. 2024-09-21 11:35:20 -04:00
subvolume.c bcachefs: Fix iterator leak in check_subvol() 2024-09-27 21:46:34 -04:00
subvolume.h bcachefs: for_each_btree_key_in_subvolume_upto() 2024-09-09 09:41:48 -04:00
subvolume_format.h
subvolume_types.h bcachefs: switch to rhashtable for vfs inodes hash 2024-09-09 09:41:47 -04:00
super-io.c bcachefs: assign return error when iterating through layout 2024-09-27 21:46:34 -04:00
super-io.h
super.c bcachefs: btree cache counters should be size_t 2024-09-21 11:39:48 -04:00
super.h
super_types.h
sysfs.c bcachefs: Rework btree node pinning 2024-09-21 11:39:48 -04:00
sysfs.h
tests.c bcachefs: bch2_btree_insert() - add btree iter flags 2024-07-14 19:00:15 -04:00
tests.h
thread_with_file.c bcachefs: Convert to use jiffies macros 2024-09-09 09:41:49 -04:00
thread_with_file.h
thread_with_file_types.h
time_stats.c bcachefs: bch2_time_stats_reset() 2024-09-09 09:41:49 -04:00
time_stats.h bcachefs: bch2_time_stats_reset() 2024-09-09 09:41:49 -04:00
trace.c bcachefs: Improve trans_blocked_journal_reclaim tracepoint 2024-08-13 23:00:34 -04:00
trace.h bcachefs: Btree path tracepoints 2024-09-09 09:41:48 -04:00
two_state_shared_lock.c
two_state_shared_lock.h
util.c bcachefs: Options for recovery_passes, recovery_passes_exclude 2024-09-21 11:39:48 -04:00
util.h bcachefs: data_allowed is now an opts.h option 2024-09-09 09:41:47 -04:00
varint.c bcachefs: varint: Avoid left-shift of a negative value 2024-07-18 18:33:30 -04:00
varint.h
vstructs.h
xattr.c bcachefs: Simplify bch2_xattr_emit() implementation 2024-09-09 09:41:49 -04:00
xattr.h bcachefs: Make bkey_fsck_err() a wrapper around fsck_err() 2024-08-13 23:00:50 -04:00
xattr_format.h bcachefs: Annotate struct bch_xattr with __counted_by() 2024-09-09 09:41:49 -04:00