linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Neil Brown <neilb@suse.de>
To: Adam Kwolek <adam.kwolek@intel.com>
Cc: linux-raid@vger.kernel.org, dan.j.williams@intel.com,
	ed.ciechanowski@intel.com, wojciech.neubauer@intel.com
Subject: Re: [PATCH] FIX: delta_disk can have UnSet value
Date: Fri, 28 Jan 2011 11:18:20 +1000	[thread overview]
Message-ID: <20110128111820.6ef1852d@nbeee.brown> (raw)
In-Reply-To: <20110127092828.6759.86014.stgit@gklab-128-013.igk.intel.com>

On Thu, 27 Jan 2011 10:28:28 +0100
Adam Kwolek <adam.kwolek@intel.com> wrote:

> Delta_disk can be set to UnSet value.
> This can a cause to pass wrong parameter to reshape_super().
> 
> Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
> ---
> 
>  Grow.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/Grow.c b/Grow.c
> index daf310b..bc015c6 100644
> --- a/Grow.c
> +++ b/Grow.c
> @@ -1575,7 +1575,9 @@ int Grow_reshape(char *devname, int fd, int
> quiet, char *backup_file, 
>  		if (reshape_super(st, info.component_size,
> info.new_level, info.new_layout, info.new_chunk,
> -				  info.array.raid_disks +
> info.delta_disks,
> +				  info.delta_disks == UnSet ?
> +				     info.array.raid_disks :
> +				     info.array.raid_disks +
> info.delta_disks, backup_file, devname, quiet)) {
>  			rv = 1;
>  			goto release;

This is clearly a problem, but I think it is the wrong fix.
If delta_disks is unset, then the new raid_disks number could vary
depending on other values.
E.g. if you has a 4-disk raid5 and ask to convert it to RAID6 without
specifying the number of devices, then it should assume a 5-disk RAID6.
Your change would make it look like a 4-disk RAID6 was requested.

So I think we need to change reshape_super to take a 'delta_disks'
parameter rather than a 'raid_disks' parameter. 
Either that, or figure out the preferred default in advance.
analyse_change does that I think, but it is called later, so we cannot
really use what it produces.

I'm not sure what the best answer is just now - hopefully I'll be able
to look properly on Monday.

NeilBrown

      reply	other threads:[~2011-01-28  1:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-27  9:28 [PATCH] FIX: delta_disk can have UnSet value Adam Kwolek
2011-01-28  1:18 ` Neil Brown [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110128111820.6ef1852d@nbeee.brown \
    --to=neilb@suse.de \
    --cc=adam.kwolek@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=ed.ciechanowski@intel.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=wojciech.neubauer@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).