aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/md/bcache/super.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index 8196b19fada2..c017cd444c66 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -1369,6 +1369,8 @@ int bch_flash_dev_create(struct cache_set *c, uint64_t size)
1369 1369
1370bool bch_cached_dev_error(struct cached_dev *dc) 1370bool bch_cached_dev_error(struct cached_dev *dc)
1371{ 1371{
1372 struct cache_set *c;
1373
1372 if (!dc || test_bit(BCACHE_DEV_CLOSING, &dc->disk.flags)) 1374 if (!dc || test_bit(BCACHE_DEV_CLOSING, &dc->disk.flags))
1373 return false; 1375 return false;
1374 1376
@@ -1379,6 +1381,21 @@ bool bch_cached_dev_error(struct cached_dev *dc)
1379 pr_err("stop %s: too many IO errors on backing device %s\n", 1381 pr_err("stop %s: too many IO errors on backing device %s\n",
1380 dc->disk.disk->disk_name, dc->backing_dev_name); 1382 dc->disk.disk->disk_name, dc->backing_dev_name);
1381 1383
1384 /*
1385 * If the cached device is still attached to a cache set,
1386 * even dc->io_disable is true and no more I/O requests
1387 * accepted, cache device internal I/O (writeback scan or
1388 * garbage collection) may still prevent bcache device from
1389 * being stopped. So here CACHE_SET_IO_DISABLE should be
1390 * set to c->flags too, to make the internal I/O to cache
1391 * device rejected and stopped immediately.
1392 * If c is NULL, that means the bcache device is not attached
1393 * to any cache set, then no CACHE_SET_IO_DISABLE bit to set.
1394 */
1395 c = dc->disk.c;
1396 if (c && test_and_set_bit(CACHE_SET_IO_DISABLE, &c->flags))
1397 pr_info("CACHE_SET_IO_DISABLE already set");
1398
1382 bcache_device_stop(&dc->disk); 1399 bcache_device_stop(&dc->disk);
1383 return true; 1400 return true;
1384} 1401}