[PATCH 3.16 078/217] bcache: Fix more early shutdown bugs
From: Ben Hutchings
Date: Tue Apr 26 2016 - 20:35:14 EST
3.16.35-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Kent Overstreet <kmo@xxxxxxxxxxxxx>
commit d83353b319d47ef8cce82467da6a25c2d558253f upstream.
Signed-off-by: Kent Overstreet <kmo@xxxxxxxxxxxxx>
Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx>
---
drivers/md/bcache/super.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -735,8 +735,6 @@ static void bcache_device_detach(struct
static void bcache_device_attach(struct bcache_device *d, struct cache_set *c,
unsigned id)
{
- BUG_ON(test_bit(CACHE_SET_STOPPING, &c->flags));
-
d->id = id;
d->c = c;
c->devices[id] = d;
@@ -1765,6 +1763,7 @@ found:
pr_debug("set version = %llu", c->sb.version);
}
+ kobject_get(&ca->kobj);
ca->set = c;
ca->set->cache[ca->sb.nr_this_dev] = ca;
c->cache_by_alloc[c->caches_loaded++] = ca;
@@ -1882,10 +1881,12 @@ static void register_cache(struct cache_
goto err;
pr_info("registered cache device %s", bdevname(bdev, name));
+out:
+ kobject_put(&ca->kobj);
return;
err:
pr_notice("error opening %s: %s", bdevname(bdev, name), err);
- kobject_put(&ca->kobj);
+ goto out;
}
/* Global interfaces/init */