Re: [PATCH] bcache: add mutex lock for bch_is_open

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Nice catch, applied.

On Sun, Jul 13, 2014 at 9:08 AM, Jianjian Huo <samuel.huo@xxxxxxxxx> wrote:
> Since bch_is_open will iterate linked list bch_cache_sets and
> uncached_devices, it needs bch_register_lock.
>
> Signed-off-by: Jianjian Huo <samuel.huo@xxxxxxxxx>
> ---
>  drivers/md/bcache/super.c |    2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
> index 92dcbfd..3391c53 100644
> --- a/drivers/md/bcache/super.c
> +++ b/drivers/md/bcache/super.c
> @@ -1933,10 +1933,12 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr,
>         if (IS_ERR(bdev)) {
>                 if (bdev == ERR_PTR(-EBUSY)) {
>                         bdev = lookup_bdev(strim(path));
> +                       mutex_lock(&bch_register_lock);
>                         if (!IS_ERR(bdev) && bch_is_open(bdev))
>                                 err = "device already registered";
>                         else
>                                 err = "device busy";
> +                       mutex_unlock(&bch_register_lock);
>                 }
>                 goto err;
>         }
> --
> 1.7.9.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bcache" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-bcache" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux ARM Kernel]     [Linux Filesystem Development]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux