ACK: [Trusty][SRU] bcache: Fix a lockdep splat in an error path
Brad Figg
brad.figg at canonical.com
Mon Feb 29 18:48:41 UTC 2016
On Mon, Feb 29, 2016 at 10:30:00AM -0800, Kamal Mostafa wrote:
> From: Kent Overstreet <kmo at daterainc.com>
>
> BugLink: http://bugs.launchpad.net/bugs/1551327
>
> commit 4fa03402cda2fac1a54248c7578b939d95931dc0 upstream.
>
> Signed-off-by: Kent Overstreet <kmo at daterainc.com>
> Signed-off-by: Kamal Mostafa <kamal at canonical.com>
> ---
> drivers/md/bcache/super.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
> index c70521f..5136e11 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,
> if (kobject_add(&ca->kobj, &part_to_dev(bdev->bd_part)->kobj, "bcache"))
> goto err;
>
> + mutex_lock(&bch_register_lock);
> err = register_cache_set(ca);
> + mutex_unlock(&bch_register_lock);
> +
> if (err)
> goto err;
>
> @@ -1935,8 +1938,6 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr,
> if (!try_module_get(THIS_MODULE))
> return -EBUSY;
>
> - mutex_lock(&bch_register_lock);
> -
> if (!(path = kstrndup(buffer, size, GFP_KERNEL)) ||
> !(sb = kmalloc(sizeof(struct cache_sb), GFP_KERNEL)))
> goto err;
> @@ -1969,7 +1970,9 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr,
> if (!dc)
> goto err_close;
>
> + mutex_lock(&bch_register_lock);
> register_bdev(sb, sb_page, bdev, dc);
> + mutex_unlock(&bch_register_lock);
> } else {
> struct cache *ca = kzalloc(sizeof(*ca), GFP_KERNEL);
> if (!ca)
> @@ -1982,7 +1985,6 @@ out:
> put_page(sb_page);
> kfree(sb);
> kfree(path);
> - mutex_unlock(&bch_register_lock);
> module_put(THIS_MODULE);
> return ret;
>
> --
> 2.7.0
>
>
> --
> kernel-team mailing list
> kernel-team at lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
--
Brad Figg brad.figg at canonical.com http://www.canonical.com
More information about the kernel-team
mailing list