diff options
author | Kent Overstreet <kmo@daterainc.com> | 2014-03-17 21:58:55 -0400 |
---|---|---|
committer | Kent Overstreet <kmo@daterainc.com> | 2014-03-17 21:59:09 -0400 |
commit | 4fa03402cda2fac1a54248c7578b939d95931dc0 (patch) | |
tree | dc334126d0adba56a6200d76b9883fe53c8da637 /drivers/md/bcache | |
parent | dabb44334060b4b84051b34c58573e57cc7432b2 (diff) |
bcache: Fix a lockdep splat in an error path
Signed-off-by: Kent Overstreet <kmo@daterainc.com>
Diffstat (limited to 'drivers/md/bcache')
-rw-r--r-- | drivers/md/bcache/super.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index c70521fe57a6..5136e11eadb0 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c | |||
@@ -1873,7 +1873,10 @@ static void register_cache(struct cache_sb *sb, struct page *sb_page, | |||
1873 | if (kobject_add(&ca->kobj, &part_to_dev(bdev->bd_part)->kobj, "bcache")) | 1873 | if (kobject_add(&ca->kobj, &part_to_dev(bdev->bd_part)->kobj, "bcache")) |
1874 | goto err; | 1874 | goto err; |
1875 | 1875 | ||
1876 | mutex_lock(&bch_register_lock); | ||
1876 | err = register_cache_set(ca); | 1877 | err = register_cache_set(ca); |
1878 | mutex_unlock(&bch_register_lock); | ||
1879 | |||
1877 | if (err) | 1880 | if (err) |
1878 | goto err; | 1881 | goto err; |
1879 | 1882 | ||
@@ -1935,8 +1938,6 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr, | |||
1935 | if (!try_module_get(THIS_MODULE)) | 1938 | if (!try_module_get(THIS_MODULE)) |
1936 | return -EBUSY; | 1939 | return -EBUSY; |
1937 | 1940 | ||
1938 | mutex_lock(&bch_register_lock); | ||
1939 | |||
1940 | if (!(path = kstrndup(buffer, size, GFP_KERNEL)) || | 1941 | if (!(path = kstrndup(buffer, size, GFP_KERNEL)) || |
1941 | !(sb = kmalloc(sizeof(struct cache_sb), GFP_KERNEL))) | 1942 | !(sb = kmalloc(sizeof(struct cache_sb), GFP_KERNEL))) |
1942 | goto err; | 1943 | goto err; |
@@ -1969,7 +1970,9 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr, | |||
1969 | if (!dc) | 1970 | if (!dc) |
1970 | goto err_close; | 1971 | goto err_close; |
1971 | 1972 | ||
1973 | mutex_lock(&bch_register_lock); | ||
1972 | register_bdev(sb, sb_page, bdev, dc); | 1974 | register_bdev(sb, sb_page, bdev, dc); |
1975 | mutex_unlock(&bch_register_lock); | ||
1973 | } else { | 1976 | } else { |
1974 | struct cache *ca = kzalloc(sizeof(*ca), GFP_KERNEL); | 1977 | struct cache *ca = kzalloc(sizeof(*ca), GFP_KERNEL); |
1975 | if (!ca) | 1978 | if (!ca) |
@@ -1982,7 +1985,6 @@ out: | |||
1982 | put_page(sb_page); | 1985 | put_page(sb_page); |
1983 | kfree(sb); | 1986 | kfree(sb); |
1984 | kfree(path); | 1987 | kfree(path); |
1985 | mutex_unlock(&bch_register_lock); | ||
1986 | module_put(THIS_MODULE); | 1988 | module_put(THIS_MODULE); |
1987 | return ret; | 1989 | return ret; |
1988 | 1990 | ||