]> www.infradead.org Git - users/hch/xfs.git/commit
bcachefs: fix deadlock in journal_entry_open()
authorJeongjun Park <aha310510@gmail.com>
Sun, 2 Feb 2025 06:13:51 +0000 (15:13 +0900)
committerKent Overstreet <kent.overstreet@linux.dev>
Fri, 7 Feb 2025 03:35:11 +0000 (22:35 -0500)
commit2ef995df0ce592f665d312008dbe1ad1c4bcf87f
treef24aa732b4218060fa97083c54967d8fe323acd9
parent6b37037d6d1b42083642340efcf80f7a30203039
bcachefs: fix deadlock in journal_entry_open()

In the previous commit b3d82c2f2761, code was added to prevent journal sequence
overflow. Among them, the code added to journal_entry_open() uses the
bch2_fs_fatal_err_on() function to handle errors.

However, __journal_res_get() , which calls journal_entry_open() , calls
journal_entry_open() while holding journal->lock , but bch2_fs_fatal_err_on()
internally tries to acquire journal->lock , which results in a deadlock.

So we need to add a locked helper to handle fatal errors even when the
journal->lock is held.

Fixes: b3d82c2f2761 ("bcachefs: Guard against journal seq overflow")
Signed-off-by: Jeongjun Park <aha310510@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/journal.c
fs/bcachefs/journal.h
fs/bcachefs/super.c
fs/bcachefs/super.h