diff options
author | mwilck@arcor.de <mwilck@arcor.de> | 2013-07-08 23:50:42 +0200 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2013-07-10 02:41:34 +0200 |
commit | 7c3fb3ecb327f34335d17c49fba5968c5d019965 (patch) | |
tree | 125c3d82c35c653f3eadfa28e767a3a84837bf0f /super-ddf.c | |
parent | DDF: getinfo_super_ddf_bvd: identify disk by refnum (diff) | |
download | mdadm-7c3fb3ecb327f34335d17c49fba5968c5d019965.tar.xz mdadm-7c3fb3ecb327f34335d17c49fba5968c5d019965.zip |
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>
Diffstat (limited to 'super-ddf.c')
-rw-r--r-- | super-ddf.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/super-ddf.c b/super-ddf.c index bff420cd..7da4ce0f 100644 --- a/super-ddf.c +++ b/super-ddf.c @@ -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); } |