Commit eebbc086 authored by Kent Overstreet's avatar Kent Overstreet Committed by Ben Hutchings

bcache: Fix more early shutdown bugs

commit d83353b3 upstream.
Signed-off-by: default avatarKent Overstreet <kmo@daterainc.com>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent fb805d5e
...@@ -735,8 +735,6 @@ static void bcache_device_detach(struct bcache_device *d) ...@@ -735,8 +735,6 @@ static void bcache_device_detach(struct bcache_device *d)
static void bcache_device_attach(struct bcache_device *d, struct cache_set *c, static void bcache_device_attach(struct bcache_device *d, struct cache_set *c,
unsigned id) unsigned id)
{ {
BUG_ON(test_bit(CACHE_SET_STOPPING, &c->flags));
d->id = id; d->id = id;
d->c = c; d->c = c;
c->devices[id] = d; c->devices[id] = d;
...@@ -1765,6 +1763,7 @@ static const char *register_cache_set(struct cache *ca) ...@@ -1765,6 +1763,7 @@ static const char *register_cache_set(struct cache *ca)
pr_debug("set version = %llu", c->sb.version); pr_debug("set version = %llu", c->sb.version);
} }
kobject_get(&ca->kobj);
ca->set = c; ca->set = c;
ca->set->cache[ca->sb.nr_this_dev] = ca; ca->set->cache[ca->sb.nr_this_dev] = ca;
c->cache_by_alloc[c->caches_loaded++] = ca; c->cache_by_alloc[c->caches_loaded++] = ca;
...@@ -1882,10 +1881,12 @@ static void register_cache(struct cache_sb *sb, struct page *sb_page, ...@@ -1882,10 +1881,12 @@ static void register_cache(struct cache_sb *sb, struct page *sb_page,
goto err; goto err;
pr_info("registered cache device %s", bdevname(bdev, name)); pr_info("registered cache device %s", bdevname(bdev, name));
out:
kobject_put(&ca->kobj);
return; return;
err: err:
pr_notice("error opening %s: %s", bdevname(bdev, name), err); pr_notice("error opening %s: %s", bdevname(bdev, name), err);
kobject_put(&ca->kobj); goto out;
} }
/* Global interfaces/init */ /* Global interfaces/init */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment