diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-02-17 20:38:47 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-02-24 20:46:48 -0500 |
commit | 097471f9e458dbbe41e25394c1fb1ccd751f0bee (patch) | |
tree | cdec5bffb7bc6e528d74bd7b7ac2ecae8aff34f2 | |
parent | b58b1b883b9b702e25204dbe2b221eecc8ecd159 (diff) | |
download | linux-097471f9e458dbbe41e25394c1fb1ccd751f0bee.tar.gz linux-097471f9e458dbbe41e25394c1fb1ccd751f0bee.tar.bz2 linux-097471f9e458dbbe41e25394c1fb1ccd751f0bee.zip |
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 <kent.overstreet@linux.dev>
-rw-r--r-- | fs/bcachefs/journal_reclaim.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/bcachefs/journal_reclaim.c b/fs/bcachefs/journal_reclaim.c index 2cf626315652..c33dca641575 100644 --- a/fs/bcachefs/journal_reclaim.c +++ b/fs/bcachefs/journal_reclaim.c @@ -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: |