public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] md/raid10: check for ERR_PTR returns from setup_conf()
@ 2010-05-25  9:40 Dan Carpenter
  2010-05-25 14:56 ` Andre Noll
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2010-05-25  9:40 UTC (permalink / raw)
  To: Neil Brown
  Cc: Andre Noll, Robert Becker, Martin K. Petersen, Jens Axboe,
	linux-raid, kernel-janitors

setup_conf() can return error values so I added a check for that here.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 0372499..8bd7da2 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -2454,6 +2454,8 @@ static void *raid10_takeover_raid0(mddev_t *mddev)
 	mddev->recovery_cp = MaxSector;
 
 	conf = setup_conf(mddev);
+	if (IS_ERR(conf))
+		return conf;
 	conf->scale_disks = 2;
 	return conf;
 }

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

* Re: [patch] md/raid10: check for ERR_PTR returns from setup_conf()
  2010-05-25  9:40 [patch] md/raid10: check for ERR_PTR returns from setup_conf() Dan Carpenter
@ 2010-05-25 14:56 ` Andre Noll
  0 siblings, 0 replies; 2+ messages in thread
From: Andre Noll @ 2010-05-25 14:56 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Neil Brown, Robert Becker, Martin K. Petersen, Jens Axboe,
	linux-raid, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 1062 bytes --]

On 11:40, Dan Carpenter wrote:
> setup_conf() can return error values so I added a check for that here.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
> index 0372499..8bd7da2 100644
> --- a/drivers/md/raid10.c
> +++ b/drivers/md/raid10.c
> @@ -2454,6 +2454,8 @@ static void *raid10_takeover_raid0(mddev_t *mddev)
>  	mddev->recovery_cp = MaxSector;
>  
>  	conf = setup_conf(mddev);
> +	if (IS_ERR(conf))
> +		return conf;
>  	conf->scale_disks = 2;
>  	return conf;
>  }

Looks good. Feel free to add my Acked-By.

BTW: setup_conf() could use some cleanup: The "couldn't allocate
memory" error message at the bottom is misleading, and the function
returns ERR_PTR(-ENOMEM) also if md_register_thread() fails.

Here's a question for Neil: raid10_takeover_raid0() sets
mddev->new_layout, but setup_conf() uses the old values of the
raid0. How is this supposed to work?

Thanks
Andre
-- 
The only person who always got his work done by Friday was Robinson Crusoe

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

end of thread, other threads:[~2010-05-25 14:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-25  9:40 [patch] md/raid10: check for ERR_PTR returns from setup_conf() Dan Carpenter
2010-05-25 14:56 ` Andre Noll

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox