Re: [PATCH] md/raid1: Initialize conf->raid_disks before using it.

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

 



On Wed, 24 Oct 2012 16:00:53 +0800 majianpeng <majianpeng@xxxxxxxxx> wrote:

> Because the conf->raid_disks is zero at first,so if there is a
> replacement disk, func setup_conf will abort.
> 
> Signed-off-by: Jianpeng Ma <majianpeng@xxxxxxxxx>
> ---
>  drivers/md/raid1.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
> index 8034fbd..4eec567 100644
> --- a/drivers/md/raid1.c
> +++ b/drivers/md/raid1.c
> @@ -2703,6 +2703,7 @@ static struct r1conf *setup_conf(struct mddev *mddev)
>  
>  	err = -EINVAL;
>  	spin_lock_init(&conf->device_lock);
> +	conf->raid_disks = mddev->raid_disks;
>  	rdev_for_each(rdev, mddev) {
>  		struct request_queue *q;
>  		int disk_idx = rdev->raid_disk;
> @@ -2724,7 +2725,6 @@ static struct r1conf *setup_conf(struct mddev *mddev)
>  		disk->head_position = 0;
>  		disk->seq_start = MaxSector;
>  	}
> -	conf->raid_disks = mddev->raid_disks;
>  	conf->mddev = mddev;
>  	INIT_LIST_HEAD(&conf->retry_list);
>  

Thanks.  I had already discovered that bug and have a fix in my tree.  I just
haven't pushed it out yet.

NeilBrown

Attachment: signature.asc
Description: PGP signature


[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