Re: [PATCH 6/9] FIX: Cannot continue reshape if mdmon is not run

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

 



On Wed, 09 Mar 2011 14:46:18 +0100 Adam Kwolek <adam.kwolek@xxxxxxxxx> wrote:

> Grow_continue() call was moved down in assemble_container_content()
> because it needs running mdmon. Mdmon is running at the end of this function.
> 
> Due to mdmon is required to run setting array_state was disabled for reshaped array.
> This causes that md will keep stable reshape in sync_action.
> 
> Signed-off-by: Adam Kwolek <adam.kwolek@xxxxxxxxx>
> ---
> 
>  Assemble.c |   23 ++++++++++++++---------
>  1 files changed, 14 insertions(+), 9 deletions(-)
> 
> diff --git a/Assemble.c b/Assemble.c
> index 0ffbbc9..3771ee1 100644
> --- a/Assemble.c
> +++ b/Assemble.c
> @@ -1544,7 +1544,7 @@ int assemble_container_content(struct supertype *st, int mdfd,
>  	if (runstop > 0 ||
>  		 (working + preexist + expansion) >=
>  			content->array.working_disks) {
> -		int err;
> +		int err = 0;
>  
>  		if (content->reshape_active) {
>  			int spare = content->array.raid_disks + expansion;
> @@ -1577,18 +1577,19 @@ int assemble_container_content(struct supertype *st, int mdfd,
>  						" to specify a --backup-file\n");
>  				return 1;
>  			}
> -
> -			err = Grow_continue(mdfd, st, content, backup_file);
> -		} else switch(content->array.level) {
> +		}
> +		switch (content->array.level) {
>  		case LEVEL_LINEAR:
>  		case LEVEL_MULTIPATH:
>  		case 0:
> -			err = sysfs_set_str(content, NULL, "array_state",
> -					    "active");
> +			if (!content->reshape_active)
> +				err = sysfs_set_str(content, NULL,
> +						    "array_state", "active");
>  			break;
>  		default:
> -			err = sysfs_set_str(content, NULL, "array_state",
> -				      "readonly");
> +			if (!content->reshape_active)
> +				err = sysfs_set_str(content, NULL,
> +						    "array_state", "readonly");
>  			/* start mdmon if needed. */
>  			if (!err) {
>  				if (!mdmon_running(st->container_dev))
> @@ -1615,8 +1616,12 @@ int assemble_container_content(struct supertype *st, int mdfd,
>  					expansion);
>  			fprintf(stderr, "\n");
>  		}
> -		if (!err)
> +		if (!err) {
>  			wait_for(chosen_name, mdfd);
> +			if (content->reshape_active)
> +				err = Grow_continue(mdfd, st, content,
> +						    backup_file);
> +		}
>  		return err;
>  		/* FIXME should have an O_EXCL and wait for read-auto */
>  	} else {
> 

This is needlessly complex.

I have applied the following instead.

Thanks,
NeilBrown

commit f362d22b5bc492c60fa1ea7e0f8346b7837dd7da
Author: NeilBrown <neilb@xxxxxxx>
Date:   Thu Mar 10 11:36:47 2011 +1100

    Grow: make sure mdmon is running for Grow_continue arrays.
    
    when starting an array that is in the middle of a migration,
    we need to start mdmon, just as we do for arrays which are not
    in the middle of a migration.
    
    Repored-by: Adam Kwolek <adam.kwolek@xxxxxxxxx>
    Signed-off-by: NeilBrown <neilb@xxxxxxx>

diff --git a/Grow.c b/Grow.c
index 5acd94d..734fa6d 100644
--- a/Grow.c
+++ b/Grow.c
@@ -3371,6 +3371,11 @@ int Grow_continue(int mdfd, struct supertype *st, struct mdinfo *info,
                container = buf;
                freeze(st);
 
+               if (!mdmon_running(st->container_dev))
+                       start_mdmon(st->container_dev);
+               ping_monitor(devnum2devname(st->container_dev));
+
+
                if (info->reshape_active == 2) {
                        int cfd = open_dev(st->container_dev);
                        if (cfd < 0)


--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux