]> git.neil.brown.name Git - mdadm.git/commitdiff
DDF: ddf_process_update: handle update of conf records for SVD
authormwilck@arcor.de <mwilck@arcor.de>
Wed, 3 Jul 2013 20:28:05 +0000 (22:28 +0200)
committerNeilBrown <neilb@suse.de>
Mon, 8 Jul 2013 06:50:46 +0000 (16:50 +1000)
For secondary RAID, we need to check which BVD needs to be updated.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
super-ddf.c

index c50faf9dae9c91d0991978da6ec8a006dcafd584..ccf44ce78e42071a108badec257d81a7fba268fe 100644 (file)
@@ -4285,7 +4285,22 @@ static void ddf_process_update(struct supertype *st,
                        /* An update, just copy the phys_refnum and lba_offset
                         * fields
                         */
-                       memcpy(vcl->conf.phys_refnum, vc->phys_refnum,
+                       struct vd_config *conf = &vcl->conf;
+                       if (vcl->other_bvds != NULL &&
+                           conf->sec_elmnt_seq != vc->sec_elmnt_seq) {
+                               unsigned int i;
+                               for (i = 1; i < conf->sec_elmnt_count; i++)
+                                       if (vcl->other_bvds[i-1]->sec_elmnt_seq
+                                           == vc->sec_elmnt_seq)
+                                               break;
+                               if (i == conf->sec_elmnt_count) {
+                                       pr_err("%s/DDF_VD_CONF_MAGIC: BVD %u not found\n",
+                                              __func__, vc->sec_elmnt_seq);
+                                       return;
+                               }
+                               conf = vcl->other_bvds[i-1];
+                       }
+                       memcpy(conf->phys_refnum, vc->phys_refnum,
                               mppe * (sizeof(__u32) + sizeof(__u64)));
                } else {
                        /* A new VD_CONF */