Skip to content

Commit 097471f

Browse files
author
Kent Overstreet
committed
bcachefs: Fix bch2_journal_flush_device_pins()
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 <[email protected]>
1 parent b58b1b8 commit 097471f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

fs/bcachefs/journal_reclaim.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -892,9 +892,11 @@ int bch2_journal_flush_device_pins(struct journal *j, int dev_idx)
892892
journal_seq_pin(j, seq)->devs);
893893
seq++;
894894

895-
spin_unlock(&j->lock);
896-
ret = bch2_mark_replicas(c, &replicas.e);
897-
spin_lock(&j->lock);
895+
if (replicas.e.nr_devs) {
896+
spin_unlock(&j->lock);
897+
ret = bch2_mark_replicas(c, &replicas.e);
898+
spin_lock(&j->lock);
899+
}
898900
}
899901
spin_unlock(&j->lock);
900902
err:

0 commit comments

Comments
 (0)