diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2016-12-19 14:48:37 -0900 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2017-01-18 21:41:30 -0900 |
commit | 2cbcc7c3a1230d5e249dfbf1664bccacd1a65ec6 (patch) | |
tree | 0013635a0bde10514c2cce371eebdc95a086b11b | |
parent | 78580ee57b79e6de2f85fa497445c344a74a2b7d (diff) |
bcache: fix a bug when initializing a new filesystem
don't want to write a new superblock until we're finished initializing
everything
-rw-r--r-- | drivers/md/bcache/super.c | 8 |
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); |