• Brian Foster's avatar
    bcachefs: gracefully unwind journal res slowpath on shutdown · 23fd4f4d
    Brian Foster authored
    bcachefs detects journal stuck conditions in a couple different
    places. If the logic in the journal reservation slow path happens to
    detect the problem, I've seen instances where the filesystem remains
    deadlocked even though it has been shut down. This is occasionally
    reproduced by generic/333, and usually manifests as one or more
    tasks stuck in the journal reservation slow path.
    
    To help avoid this problem, repeat the journal error check in
    __journal_res_get() once under spinlock to cover the case where the
    previous lock holder might have triggered shutdown. This also helps
    avoid spurious/duplicate stuck reports. Also, wake the journal from
    the halt code to make sure blocked callers of the journal res
    slowpath have a chance to wake up and observe the pending error.
    This survives an overnight looping run of generic/333 without the
    aforementioned lockups.
    Signed-off-by: default avatarBrian Foster <bfoster@redhat.com>
    Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
    23fd4f4d
journal.c 34.5 KB