Skip to content

Commit

Permalink
bcachefs: Fix bch2_journal_flush_device_pins()
Browse files Browse the repository at this point in the history
If a journal write errored, the list of devices it was written to could
be empty - we're not supposed to mark an empty replicas list.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
  • Loading branch information
Kent Overstreet committed Feb 25, 2024
1 parent b58b1b8 commit 097471f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions fs/bcachefs/journal_reclaim.c
Original file line number Diff line number Diff line change
@@ -892,9 +892,11 @@ int bch2_journal_flush_device_pins(struct journal *j, int dev_idx)
journal_seq_pin(j, seq)->devs);
seq++;

spin_unlock(&j->lock);
ret = bch2_mark_replicas(c, &replicas.e);
spin_lock(&j->lock);
if (replicas.e.nr_devs) {
spin_unlock(&j->lock);
ret = bch2_mark_replicas(c, &replicas.e);
spin_lock(&j->lock);
}
}
spin_unlock(&j->lock);
err:

0 comments on commit 097471f

Please sign in to comment.