summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/md/bcache/super.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index 6d99cfe80df4..95fdc442f663 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -717,11 +717,16 @@ static void __bch_cache_set_read_only(struct cache_set *c)
bch_btree_flush(c);
+ /*
+ * Write a journal entry after flushing the btree, so we don't end up
+ * replaying everything we just flushed:
+ */
+ if (test_bit(CACHE_SET_INITIAL_GC_DONE, &c->flags))
+ bch_journal_meta(&c->journal);
+
for_each_cache(ca, c, i)
bch_cache_allocator_stop(ca);
- bch_journal_flush(&c->journal);
-
cancel_delayed_work_sync(&c->journal.write_work);
}