summaryrefslogtreecommitdiff
path: root/fs/bcachefs
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-05-22 20:17:05 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2024-05-22 20:17:33 -0400
commitcd3b31f9d4174cccafd8da615d73f40c1ce48939 (patch)
treef5c5d65967124edfb6fa153124ff28fb140f445a /fs/bcachefs
parentd293ece108104967ec3465f253834c0511170f04 (diff)
bcachefs: Ensure we're RW before journalling
Reported-by: syzbot+c60cd352aedb109528bf@syzkaller.appspotmail.com Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs')
-rw-r--r--fs/bcachefs/recovery.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c
index 63f990f5c63a..cf513fc79ce4 100644
--- a/fs/bcachefs/recovery.c
+++ b/fs/bcachefs/recovery.c
@@ -811,9 +811,11 @@ use_clean:
clear_bit(BCH_FS_fsck_running, &c->flags);
/* fsync if we fixed errors */
- if (test_bit(BCH_FS_errors_fixed, &c->flags)) {
+ if (test_bit(BCH_FS_errors_fixed, &c->flags) &&
+ bch2_write_ref_tryget(c, BCH_WRITE_REF_fsync)) {
bch2_journal_flush_all_pins(&c->journal);
bch2_journal_meta(&c->journal);
+ bch2_write_ref_put(c, BCH_WRITE_REF_fsync);
}
/* If we fixed errors, verify that fs is actually clean now: */