linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] loop: Make user notify for adding loop device failed
@ 2016-06-07  2:05 Minfei Huang
  2016-06-07  2:49 ` Ming Lei
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Minfei Huang @ 2016-06-07  2:05 UTC (permalink / raw)
  To: axboe, ming.lei, viro, jmoyer, sagig, mszeredi; +Cc: linux-kernel, Minfei Huang

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)

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] loop: Make user notify for adding loop device failed
  2016-06-07  2:05 [PATCH] loop: Make user notify for adding loop device failed Minfei Huang
@ 2016-06-07  2:49 ` Ming Lei
  2016-06-07 13:42 ` Jeff Moyer
  2016-07-12 23:17 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Ming Lei @ 2016-06-07  2:49 UTC (permalink / raw)
  To: Minfei Huang
  Cc: Jens Axboe, Al Viro, Jeff Moyer, Sagi Grimberg, Miklos Szeredi,
	Linux Kernel Mailing List

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)
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] loop: Make user notify for adding loop device failed
  2016-06-07  2:05 [PATCH] loop: Make user notify for adding loop device failed Minfei Huang
  2016-06-07  2:49 ` Ming Lei
@ 2016-06-07 13:42 ` Jeff Moyer
  2016-07-12 23:17 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Jeff Moyer @ 2016-06-07 13:42 UTC (permalink / raw)
  To: Minfei Huang; +Cc: axboe, ming.lei, viro, sagig, mszeredi, linux-kernel

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>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] loop: Make user notify for adding loop device failed
  2016-06-07  2:05 [PATCH] loop: Make user notify for adding loop device failed Minfei Huang
  2016-06-07  2:49 ` Ming Lei
  2016-06-07 13:42 ` Jeff Moyer
@ 2016-07-12 23:17 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2016-07-12 23:17 UTC (permalink / raw)
  To: Minfei Huang, ming.lei, viro, jmoyer, sagig, mszeredi; +Cc: linux-kernel

On 06/06/2016 07:05 PM, Minfei Huang 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.

Sorry about the delay, vacation got in the way. Added for 4.8, thanks.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-07-12 23:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-07  2:05 [PATCH] loop: Make user notify for adding loop device failed Minfei Huang
2016-06-07  2:49 ` Ming Lei
2016-06-07 13:42 ` Jeff Moyer
2016-07-12 23:17 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).