summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-06-30 04:40:57 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2024-07-10 16:53:39 +0300
commit0435773239b5afe25801e83c8252e04299a0e306 (patch)
tree5526b22304657a07dd7e16a98205ee4da3ccef06 /fs
parenta2d23f3d916bf9abd77944882cba131af1085bcc (diff)
downloadlinux-0435773239b5afe25801e83c8252e04299a0e306.tar.xz
bcachefs: Fix journal getting stuck on a flush commit
silly race Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs')
-rw-r--r--fs/bcachefs/journal_io.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/bcachefs/journal_io.c b/fs/bcachefs/journal_io.c
index db24ce21b2ac..f17c478a18e8 100644
--- a/fs/bcachefs/journal_io.c
+++ b/fs/bcachefs/journal_io.c
@@ -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) {