summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/md/bcache/super.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index aa96931d3db9..db76d50f4d8f 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -651,6 +651,9 @@ void bch_check_mark_super_slowpath(struct cache_set *c, const struct bkey_i *k,
struct bkey_s_c_extent e = bkey_i_to_s_c_extent(k);
const struct bch_extent_ptr *ptr;
+ if (!CACHE_SET_SYNC(&c->disk_sb))
+ return;
+
down(&c->sb_write_mutex);
/* recheck, might have raced */
@@ -1440,9 +1443,6 @@ static const char *run_cache_set(struct cache_set *c)
err = "error writing first journal entry";
if (bch_journal_meta(&c->journal))
goto err;
-
- /* Mark cache set as initialized: */
- SET_CACHE_SET_SYNC(&c->disk_sb, true);
}
if (c->opts.read_only) {
@@ -1459,6 +1459,8 @@ static const char *run_cache_set(struct cache_set *c)
c->disk_mi[ca->sb.nr_this_dev].last_mount = cpu_to_le64(now);
rcu_read_unlock();
+ /* Mark cache set as initialized: */
+ SET_CACHE_SET_SYNC(&c->disk_sb, true);
SET_CACHE_SET_CLEAN(&c->disk_sb, false);
bcache_write_super(c);