Re: [PATCH] md: Detect raid1->raid0 takeover when comparing raid_disks

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

 



On Thu, 10 Feb 2011 10:30:43 +0100 Krzysztof Wojcik
<krzysztof.wojcik@xxxxxxxxx> wrote:

> Takeover raid1->raid0 not succeded. Kernel message is shown:
> "md/raid0:md126: too few disks (1 of 2) - aborting!"
> 
> After takeover process we have only one active disk
> (rest of raid1's disks have been removed before takeover)
> mddev->raid_disks stores initial number of disks so comparing
> mddev->raid_disks with "cnt" calculated in create_strip_zones()
> returns error.
> 
> Patch introduces fix for this- skip comparing number of disk if
> takeover is detected.
> 
> Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@xxxxxxxxx>
> ---
>  drivers/md/raid0.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
> index 637a968..9255d52 100644
> --- a/drivers/md/raid0.c
> +++ b/drivers/md/raid0.c
> @@ -215,7 +215,8 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf)
>  			smallest = rdev1;
>  		cnt++;
>  	}
> -	if (cnt != mddev->raid_disks) {
> +	/* compare number of disk if not taking over raid1 */
> +	if ((cnt != mddev->raid_disks) && (mddev->level != 1)) {
>  		printk(KERN_ERR "md/raid0:%s: too few disks (%d of %d) - "
>  		       "aborting!\n", mdname(mddev), cnt, mddev->raid_disks);
>  		goto abort;


Patch is wrong.  Just ignoring a consistency test is rarely a good
idea.

The problem is that we didn't update ->raid_disks.
I think that might have been my fault.

I have applied this patch instead.

Thanks,
NeilBrown

commit f7bee80945155ad0326916486dabc38428c6cdef
Author: Krzysztof Wojcik <krzysztof.wojcik@xxxxxxxxx>
Date:   Mon Feb 14 10:01:41 2011 +1100

    md: Fix raid1->raid0 takeover
    
    Takeover raid1->raid0 not succeded. Kernel message is shown:
    "md/raid0:md126: too few disks (1 of 2) - aborting!"
    
    Problem was that we weren't updating ->raid_disks for that
    takeover, unlike all the others.
    
    Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@xxxxxxxxx>
    Signed-off-by: NeilBrown <neilb@xxxxxxx>

diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index 637a968..75671df 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -670,6 +670,7 @@ static void *raid0_takeover_raid1(mddev_t *mddev)
 	mddev->new_layout = 0;
 	mddev->new_chunk_sectors = 128; /* by default set chunk size to 64k */
 	mddev->delta_disks = 1 - mddev->raid_disks;
+	mddev->raid_disks = 1;
 	/* make sure it will be not marked as dirty */
 	mddev->recovery_cp = MaxSector;
 
--
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