diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2016-10-02 22:08:19 -0800 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2016-10-07 12:37:16 -0800 |
commit | a40a89c771a16df78d7d23d76ff103fa8493e5d8 (patch) | |
tree | b87cec0aa95c96760aa673e056346113503fb724 | |
parent | 6fd7c5b18b42f4adeea8bad4f5fba741d65609f2 (diff) |
bcache: don't mark as clean when there were errors
-rw-r--r-- | drivers/md/bcache/bcache.h | 1 | ||||
-rw-r--r-- | drivers/md/bcache/error.c | 2 | ||||
-rw-r--r-- | drivers/md/bcache/super.c | 4 |
3 files changed, 6 insertions, 1 deletions
diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h index f8a3ab43e841..1507fe4d5047 100644 --- a/drivers/md/bcache/bcache.h +++ b/drivers/md/bcache/bcache.h @@ -489,6 +489,7 @@ enum { CACHE_SET_GC_STOPPING, CACHE_SET_GC_FAILURE, CACHE_SET_BDEV_MOUNTED, + CACHE_SET_ERROR, }; struct btree_debug { diff --git a/drivers/md/bcache/error.c b/drivers/md/bcache/error.c index 31221d5008d9..9ba33ef6aaae 100644 --- a/drivers/md/bcache/error.c +++ b/drivers/md/bcache/error.c @@ -6,6 +6,8 @@ void bch_inconsistent_error(struct cache_set *c) { + set_bit(CACHE_SET_ERROR, &c->flags); + switch (c->opts.errors) { case BCH_ON_ERROR_CONTINUE: break; diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index 1b0663297fab..6275f708e555 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -744,7 +744,8 @@ static void bch_cache_set_read_only_work(struct work_struct *work) __bch_cache_set_read_only(c); - if (!bch_journal_error(&c->journal)) { + if (!bch_journal_error(&c->journal) && + !test_bit(CACHE_SET_ERROR, &c->flags)) { SET_CACHE_SET_CLEAN(&c->disk_sb, true); bcache_write_super(c); } @@ -1470,6 +1471,7 @@ err: kfree(r); } + set_bit(CACHE_SET_ERROR, &c->flags); bch_cache_set_unregister(c); closure_put(&c->caching); return err; |