diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2016-10-02 22:08:19 -0800 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2017-01-18 21:40:29 -0900 |
commit | 7f56b4726641c6469988f5c78884860d4785fc4e (patch) | |
tree | 03f4fa3c06591fc8c30f4cf911fb4ec3f9825f03 | |
parent | 0c91bb3c76949491c30266312c631ae0d0a66764 (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; |