bcachefs: Fix early startup error path
authorKent Overstreet <kent.overstreet@linux.dev>
Fri, 18 Apr 2025 00:30:18 +0000 (20:30 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 20 Apr 2025 23:41:38 +0000 (19:41 -0400)
commit4c0d2c67ac6d54ba71bb3438147b144c25fdee2c
tree033c7872f362011c1fc04f36978d0fd8a8e42324
parent9c32cda43eb78f78c73aee4aa344b777714e259b
bcachefs: Fix early startup error path

Don't set JOURNAL_running until we're also calling
journal_space_available() for the first time.

If JOURNAL_running is set, shutdown will write an empty journal entry -
but this will hit an assert in journal_entry_open() if we've never
called journal_space_available().

Reported-by: syzbot+53bb24d476ef8368a7f0@syzkaller.appspotmail.com
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/journal.c
fs/bcachefs/journal.h
fs/bcachefs/recovery.c
fs/bcachefs/super.c