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)
671
671
continue ;
672
672
673
673
struct bch_replicas_padded r ;
674
-
675
674
if (!accounting_to_replicas (& r .e , acc -> k .data [i ].pos ))
676
675
continue ;
677
676
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
+
678
684
struct disk_accounting_pos k ;
679
685
bpos_to_disk_accounting_pos (& k , acc -> k .data [i ].pos );
680
686
@@ -683,8 +689,17 @@ int bch2_accounting_read(struct bch_fs *c)
683
689
"accounting not marked in superblock replicas\n %s" ,
684
690
(printbuf_reset (& buf ),
685
691
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
+ }
688
703
}
689
704
690
705
preempt_disable ();
You can’t perform that action at this time.
0 commit comments