DDF: getinfo_super_ddf_bvd: fix raid_disk calculation

The return value of disk.raid_disk may be wrong.
The old code was using raiddisk, which is only valid with auto
layout. This leads to errors when arrays are created with
specified disks and mdmon is already running, like this:

mdadm -CR /dev/md/container -n5 $d1 $d2 $d3 $d4 $d5
mdadm -CR /dev/md/r5 -n5 -l5 /dev/md/container -z 5000
mdadm -CR /dev/md/r1 -n2 -l1 $d1 $d2
  => resulting array will use wrong disks

This patch fixes that.

Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
mwilck@arcor.de 2013-07-08 23:50:42 +02:00 committed by NeilBrown
parent f5ded78768
commit 7c3fb3ecb3
1 changed files with 2 additions and 1 deletions

View File

@ -1887,7 +1887,8 @@ static void getinfo_super_ddf_bvd(struct supertype *st, struct mdinfo *info, cha
if (dl) {
info->disk.major = dl->major;
info->disk.minor = dl->minor;
info->disk.raid_disk = dl->raiddisk;
info->disk.raid_disk = cd + conf->sec_elmnt_seq
* __be16_to_cpu(conf->prim_elmnt_count);
info->disk.number = dl->pdnum;
info->disk.state = (1<<MD_DISK_SYNC)|(1<<MD_DISK_ACTIVE);
}