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

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

 



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);
 
-- 
1.7.9.5
?韬{.n?????%??檩??w?{.n???{炳盯w???塄}?财??j:+v??????2??璀??摺?囤??z夸z罐?+?????w棹f



[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