diff options
author | Kent Overstreet <kmo@daterainc.com> | 2014-06-12 04:44:49 +0200 |
---|---|---|
committer | Kent Overstreet <kmo@daterainc.com> | 2014-08-05 00:23:04 +0200 |
commit | d83353b319d47ef8cce82467da6a25c2d558253f (patch) | |
tree | 1918360706a591c805c468cd212e0ecfea4d8887 /drivers/md | |
parent | bcache: fix use-after-free in btree_gc_coalesce() (diff) | |
download | linux-d83353b319d47ef8cce82467da6a25c2d558253f.tar.xz linux-d83353b319d47ef8cce82467da6a25c2d558253f.zip |
bcache: Fix more early shutdown bugs
Signed-off-by: Kent Overstreet <kmo@daterainc.com>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/bcache/super.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index 00cc42550f34..29dd1e8ae19f 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -733,8 +733,6 @@ static void bcache_device_detach(struct bcache_device *d) 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; @@ -1771,6 +1769,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; @@ -1888,10 +1887,12 @@ static void register_cache(struct cache_sb *sb, struct page *sb_page, 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 */ |