aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/bcache/super.c
diff options
context:
space:
mode:
authorKent Overstreet <kmo@daterainc.com>2013-07-11 00:03:25 -0400
committerKent Overstreet <kmo@daterainc.com>2013-07-12 03:22:47 -0400
commit5caa52afc5abd1396e4af720469abb5843a71eb8 (patch)
treefbe7658aab74ad20a536f9c64b031bc75d75683c /drivers/md/bcache/super.c
parentc9502ea4424b31728703d113fc6b30bfead14633 (diff)
bcache: Shutdown fix
Stopping a cache set is supposed to make it stop attached backing devices, but somewhere along the way that code got lost. Fixing this mainly has the effect of fixing our reboot notifier. Signed-off-by: Kent Overstreet <kmo@daterainc.com> Cc: linux-stable <stable@vger.kernel.org> # >= v3.10
Diffstat (limited to 'drivers/md/bcache/super.c')
-rw-r--r--drivers/md/bcache/super.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index 7a1dcdb2536e..f6a62174e8f6 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -1354,18 +1354,22 @@ static void cache_set_flush(struct closure *cl)
1354static void __cache_set_unregister(struct closure *cl) 1354static void __cache_set_unregister(struct closure *cl)
1355{ 1355{
1356 struct cache_set *c = container_of(cl, struct cache_set, caching); 1356 struct cache_set *c = container_of(cl, struct cache_set, caching);
1357 struct cached_dev *dc, *t; 1357 struct cached_dev *dc;
1358 size_t i; 1358 size_t i;
1359 1359
1360 mutex_lock(&bch_register_lock); 1360 mutex_lock(&bch_register_lock);
1361 1361
1362 if (test_bit(CACHE_SET_UNREGISTERING, &c->flags))
1363 list_for_each_entry_safe(dc, t, &c->cached_devs, list)
1364 bch_cached_dev_detach(dc);
1365
1366 for (i = 0; i < c->nr_uuids; i++) 1362 for (i = 0; i < c->nr_uuids; i++)
1367 if (c->devices[i] && UUID_FLASH_ONLY(&c->uuids[i])) 1363 if (c->devices[i]) {
1368 bcache_device_stop(c->devices[i]); 1364 if (!UUID_FLASH_ONLY(&c->uuids[i]) &&
1365 test_bit(CACHE_SET_UNREGISTERING, &c->flags)) {
1366 dc = container_of(c->devices[i],
1367 struct cached_dev, disk);
1368 bch_cached_dev_detach(dc);
1369 } else {
1370 bcache_device_stop(c->devices[i]);
1371 }
1372 }
1369 1373
1370 mutex_unlock(&bch_register_lock); 1374 mutex_unlock(&bch_register_lock);
1371 1375