summaryrefslogtreecommitdiffstats
path: root/drivers/md
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
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')
-rw-r--r--drivers/md/bcache/bcache.h1
-rw-r--r--drivers/md/bcache/super.c11
2 files changed, 11 insertions, 1 deletions
diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h
index 342ba86c6e4f..68f1ded81ae0 100644
--- a/drivers/md/bcache/bcache.h
+++ b/drivers/md/bcache/bcache.h
@@ -434,6 +434,7 @@ struct bcache_device {
434 434
435 /* If nonzero, we're detaching/unregistering from cache set */ 435 /* If nonzero, we're detaching/unregistering from cache set */
436 atomic_t detaching; 436 atomic_t detaching;
437 int flush_done;
437 438
438 uint64_t nr_stripes; 439 uint64_t nr_stripes;
439 unsigned stripe_size_bits; 440 unsigned stripe_size_bits;
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