bcachefs: Fix livelock in journal_entry_open()
authorKent Overstreet <kent.overstreet@linux.dev>
Tue, 13 May 2025 16:55:44 +0000 (12:55 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Wed, 14 May 2025 21:05:19 +0000 (17:05 -0400)
commit7b6759b1991d427cf9a562b2891b8c3e87a19c76
tree6ccea7b463257f87df116efd52f029ea19491e99
parentb1c71cb492bb26dc883b11b5bd085d2467508f84
bcachefs: Fix livelock in journal_entry_open()

When the journal is low on space, we might do discards from
journal_res_get() -> journal_entry_open().

Make sure we set j->can_discard correctly, so that if we're low on space
but not because discards aren't keeping up we don't livelock.

Fixes: 8e4d28036c29 ("bcachefs: Don't aggressively discard the journal")
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/journal_reclaim.c