]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
ddf: set vcnum correctly when creating a new virtual device in conflist
authorNeilBrown <neilb@suse.de>
Mon, 14 Mar 2011 07:47:47 +0000 (18:47 +1100)
committerNeilBrown <neilb@suse.de>
Mon, 14 Mar 2011 07:47:47 +0000 (18:47 +1100)
We weren't setting ->vcnum at all when an array was added.  This
meant that a subsequent device failure could be assigned to the
wrong array.

Reported-by: Albert Pauw <albert.pauw@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
super-ddf.c

index 8cc738ab83c193f26bc525cfe66b655df49fab9b..be15e43ebc9b9f74f1a94bd7ada1d564e9531162 100644 (file)
@@ -3417,6 +3417,14 @@ static void ddf_process_update(struct supertype *st,
                        memcpy(&vcl->conf, vc, update->len);
                        vcl->lba_offset = (__u64*)
                                &vcl->conf.phys_refnum[mppe];
+                       for (ent = 0;
+                            ent < __be16_to_cpu(ddf->virt->populated_vdes);
+                            ent++)
+                               if (memcmp(vc->guid, ddf->virt->entries[ent].guid,
+                                          DDF_GUID_LEN) == 0) {
+                                       vcl->vcnum = ent;
+                                       break;
+                               }
                        ddf->conflist = vcl;
                }
                /* Now make sure vlist is correct for each dl. */