]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
bcachefs: Fix journal getting stuck on a flush commit
authorKent Overstreet <kent.overstreet@linux.dev>
Sun, 30 Jun 2024 01:40:57 +0000 (21:40 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Wed, 10 Jul 2024 13:53:39 +0000 (09:53 -0400)
silly race

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/journal_io.c

index db24ce21b2acfa6fd3180b6a497e5a6470156fbe..f17c478a18e88f9a30db7e6c488f82224a8caffa 100644 (file)
@@ -1762,11 +1762,13 @@ static CLOSURE_CALLBACK(journal_write_preflush)
 
        if (j->seq_ondisk + 1 != le64_to_cpu(w->data->seq)) {
                spin_lock(&j->lock);
-               closure_wait(&j->async_wait, cl);
+               if (j->seq_ondisk + 1 != le64_to_cpu(w->data->seq)) {
+                       closure_wait(&j->async_wait, cl);
+                       spin_unlock(&j->lock);
+                       continue_at(cl, journal_write_preflush, j->wq);
+                       return;
+               }
                spin_unlock(&j->lock);
-
-               continue_at(cl, journal_write_preflush, j->wq);
-               return;
        }
 
        if (w->separate_flush) {