File tree Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -671,10 +671,16 @@ int bch2_accounting_read(struct bch_fs *c)
671671 continue ;
672672
673673 struct bch_replicas_padded r ;
674-
675674 if (!accounting_to_replicas (& r .e , acc -> k .data [i ].pos ))
676675 continue ;
677676
677+ /*
678+ * If the replicas entry is invalid it'll get cleaned up by
679+ * check_allocations:
680+ */
681+ if (bch2_replicas_entry_validate (& r .e , c , & buf ))
682+ continue ;
683+
678684 struct disk_accounting_pos k ;
679685 bpos_to_disk_accounting_pos (& k , acc -> k .data [i ].pos );
680686
@@ -683,8 +689,17 @@ int bch2_accounting_read(struct bch_fs *c)
683689 "accounting not marked in superblock replicas\n %s" ,
684690 (printbuf_reset (& buf ),
685691 bch2_accounting_key_to_text (& buf , & k ),
686- buf .buf )))
687- ret = bch2_accounting_update_sb_one (c , acc -> k .data [i ].pos );
692+ buf .buf ))) {
693+ /*
694+ * We're not RW yet and still single threaded, dropping
695+ * and retaking lock is ok:
696+ */
697+ percpu_up_read (& c -> mark_lock );
698+ ret = bch2_mark_replicas (c , & r .e );
699+ if (ret )
700+ goto fsck_err ;
701+ percpu_down_read (& c -> mark_lock );
702+ }
688703 }
689704
690705 preempt_disable ();
You can’t perform that action at this time.
0 commit comments