aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/bcache/super.c
diff options
context:
space:
mode:
authorKent Overstreet <kmo@daterainc.com>2013-07-11 00:25:02 -0400
committerKent Overstreet <kmo@daterainc.com>2013-07-12 03:22:47 -0400
commitc9502ea4424b31728703d113fc6b30bfead14633 (patch)
tree5ce21818de392f7873708f8db65b031223b04c2e /drivers/md/bcache/super.c
parent54d12f2b4fd0f218590d1490b41a18d0e2328a9a (diff)
bcache: Fix a sysfs splat on shutdown
If we stopped a bcache device when we were already detaching (or something like that), bcache_device_unlink() would try to remove a symlink from sysfs that was already gone because the bcache dev kobject had already been removed from sysfs. So keep track of whether we've removed stuff from sysfs. 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.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index 728fdc673f31..7a1dcdb2536e 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -706,7 +706,8 @@ static void bcache_device_detach(struct bcache_device *d)
706 atomic_set(&d->detaching, 0); 706 atomic_set(&d->detaching, 0);
707 } 707 }
708 708
709 bcache_device_unlink(d); 709 if (!d->flush_done)
710 bcache_device_unlink(d);
710 711
711 d->c->devices[d->id] = NULL; 712 d->c->devices[d->id] = NULL;
712 closure_put(&d->c->caching); 713 closure_put(&d->c->caching);
@@ -1055,6 +1056,14 @@ static void cached_dev_flush(struct closure *cl)
1055 struct cached_dev *dc = container_of(cl, struct cached_dev, disk.cl); 1056 struct cached_dev *dc = container_of(cl, struct cached_dev, disk.cl);
1056 struct bcache_device *d = &dc->disk; 1057 struct bcache_device *d = &dc->disk;
1057 1058
1059 mutex_lock(&bch_register_lock);
1060 d->flush_done = 1;
1061
1062 if (d->c)
1063 bcache_device_unlink(d);
1064
1065 mutex_unlock(&bch_register_lock);
1066
1058 bch_cache_accounting_destroy(&dc->accounting); 1067 bch_cache_accounting_destroy(&dc->accounting);
1059 kobject_del(&d->kobj); 1068 kobject_del(&d->kobj);
1060 1069