summaryrefslogtreecommitdiff
path: root/drivers/md/bcache/super.c
diff options
context:
space:
mode:
authorSlava Pestov <sp@daterainc.com>2014-07-11 19:17:41 (GMT)
committerKent Overstreet <kmo@daterainc.com>2014-08-04 22:23:04 (GMT)
commitbf0c55c986540483c34ca640f2eef4c3314388b1 (patch)
tree42507e423dd6f73e207329e1264b8101b8057880 /drivers/md/bcache/super.c
parentd83353b319d47ef8cce82467da6a25c2d558253f (diff)
downloadlinux-bf0c55c986540483c34ca640f2eef4c3314388b1.tar.xz
bcache: fix crash with incomplete cache set
Change-Id: I6abde52afe917633480caaf4e2518f42a816d886
Diffstat (limited to 'drivers/md/bcache/super.c')
-rw-r--r--drivers/md/bcache/super.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index 29dd1e8..72fbaf7 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -1284,6 +1284,9 @@ int bch_flash_dev_create(struct cache_set *c, uint64_t size)
if (test_bit(CACHE_SET_STOPPING, &c->flags))
return -EINTR;
+ if (!test_bit(CACHE_SET_RUNNING, &c->flags))
+ return -EPERM;
+
u = uuid_find_empty(c);
if (!u) {
pr_err("Can't create volume, no room for UUID");
@@ -1706,6 +1709,7 @@ static void run_cache_set(struct cache_set *c)
flash_devs_run(c);
+ set_bit(CACHE_SET_RUNNING, &c->flags);
return;
err:
closure_sync(&cl);