Skip to content

Commit cd3b31f

Browse files
author
Kent Overstreet
committed
bcachefs: Ensure we're RW before journalling
Reported-by: [email protected] Signed-off-by: Kent Overstreet <[email protected]>
1 parent d293ece commit cd3b31f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fs/bcachefs/recovery.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,9 +811,11 @@ int bch2_fs_recovery(struct bch_fs *c)
811811
clear_bit(BCH_FS_fsck_running, &c->flags);
812812

813813
/* fsync if we fixed errors */
814-
if (test_bit(BCH_FS_errors_fixed, &c->flags)) {
814+
if (test_bit(BCH_FS_errors_fixed, &c->flags) &&
815+
bch2_write_ref_tryget(c, BCH_WRITE_REF_fsync)) {
815816
bch2_journal_flush_all_pins(&c->journal);
816817
bch2_journal_meta(&c->journal);
818+
bch2_write_ref_put(c, BCH_WRITE_REF_fsync);
817819
}
818820

819821
/* If we fixed errors, verify that fs is actually clean now: */

0 commit comments

Comments
 (0)