Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1415623 > unrolled thread

[PATCH] loop: Make user notify for adding loop device failed

Started byMinfei Huang <mnghuan@gmail.com>
First post2016-06-07 04:10 +0200
Last post2016-06-07 15:50 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] loop: Make user notify for adding loop device failed Minfei Huang <mnghuan@gmail.com> - 2016-06-07 04:10 +0200
    Re: [PATCH] loop: Make user notify for adding loop device failed Ming Lei <ming.lei@canonical.com> - 2016-06-07 04:50 +0200
    Re: [PATCH] loop: Make user notify for adding loop device failed Jeff Moyer <jmoyer@redhat.com> - 2016-06-07 15:50 +0200

#1415623 — [PATCH] loop: Make user notify for adding loop device failed

FromMinfei Huang <mnghuan@gmail.com>
Date2016-06-07 04:10 +0200
Subject[PATCH] loop: Make user notify for adding loop device failed
Message-ID<rHeCR-4O2-1@gated-at.bofh.it>
There is no error number returned if loop driver fails in function
alloc_disk to add new loop device. Add a correct error number to make
user notify in this case.

Signed-off-by: Minfei Huang <mnghuan@gmail.com>
---
 drivers/block/loop.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 1fa8cc2..2caaf6f 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1765,6 +1765,7 @@ static int loop_add(struct loop_device **l, int i)
 	 */
 	queue_flag_set_unlocked(QUEUE_FLAG_NOMERGES, lo->lo_queue);
 
+	err = -ENOMEM;
 	disk = lo->lo_disk = alloc_disk(1 << part_shift);
 	if (!disk)
 		goto out_free_queue;
-- 
2.7.4 (Apple Git-66)

[toc] | [next] | [standalone]


#1415645

FromMing Lei <ming.lei@canonical.com>
Date2016-06-07 04:50 +0200
Message-ID<rHffz-5aj-23@gated-at.bofh.it>
In reply to#1415623
On Tue, Jun 7, 2016 at 10:05 AM, Minfei Huang <mnghuan@gmail.com> wrote:
> There is no error number returned if loop driver fails in function
> alloc_disk to add new loop device. Add a correct error number to make
> user notify in this case.
>
> Signed-off-by: Minfei Huang <mnghuan@gmail.com>

Good catch!

Reviewed-by: Ming Lei <tom.leiming@gmail.com>

> ---
>  drivers/block/loop.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/block/loop.c b/drivers/block/loop.c
> index 1fa8cc2..2caaf6f 100644
> --- a/drivers/block/loop.c
> +++ b/drivers/block/loop.c
> @@ -1765,6 +1765,7 @@ static int loop_add(struct loop_device **l, int i)
>          */
>         queue_flag_set_unlocked(QUEUE_FLAG_NOMERGES, lo->lo_queue);
>
> +       err = -ENOMEM;
>         disk = lo->lo_disk = alloc_disk(1 << part_shift);
>         if (!disk)
>                 goto out_free_queue;
> --
> 2.7.4 (Apple Git-66)
>

[toc] | [prev] | [next] | [standalone]


#1416208

FromJeff Moyer <jmoyer@redhat.com>
Date2016-06-07 15:50 +0200
Message-ID<rHpyi-3ll-37@gated-at.bofh.it>
In reply to#1415623
Minfei Huang <mnghuan@gmail.com> writes:

> There is no error number returned if loop driver fails in function
> alloc_disk to add new loop device. Add a correct error number to make
> user notify in this case.
>
> Signed-off-by: Minfei Huang <mnghuan@gmail.com>
> ---
>  drivers/block/loop.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/block/loop.c b/drivers/block/loop.c
> index 1fa8cc2..2caaf6f 100644
> --- a/drivers/block/loop.c
> +++ b/drivers/block/loop.c
> @@ -1765,6 +1765,7 @@ static int loop_add(struct loop_device **l, int i)
>  	 */
>  	queue_flag_set_unlocked(QUEUE_FLAG_NOMERGES, lo->lo_queue);
>  
> +	err = -ENOMEM;
>  	disk = lo->lo_disk = alloc_disk(1 << part_shift);
>  	if (!disk)
>  		goto out_free_queue;

Looks good.

Reviewed-by: Jeff Moyer <jmoyer@redhat.com>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web