diff options
author | Neil Brown <neilb@suse.de> | 2006-06-02 06:58:39 +0000 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2006-06-02 06:58:39 +0000 |
commit | 6a255b69be733fa43fe34a9fc9785817a88e935d (patch) | |
tree | 50d523f507d82f6538296c967302a0ead32b19fc /Assemble.c | |
parent | 8268ed740379a94300d20db6f1df1702320fe6fd (diff) | |
download | mdadm-6a255b69be733fa43fe34a9fc9785817a88e935d.tar.gz mdadm-6a255b69be733fa43fe34a9fc9785817a88e935d.tar.xz mdadm-6a255b69be733fa43fe34a9fc9785817a88e935d.zip |
Avoid misdetection of overlapping partitions...
As version-0.90 superblock don't record the superblock
offset, it is possible for overlapping partitions,
or a partition that starts on a 64K boundary in the whole device
to result in mis-detection - one partition or device might
be detected where the other was intended.
To avoid this awkward possibility, we reject assembly attempts
which seem to have two devices that are different but have the
same version-0.90 superblock.
To avoid this problem altogether, switch to version-1 metadata.
Signed-off-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'Assemble.c')
-rw-r--r-- | Assemble.c | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -514,6 +514,25 @@ int Assemble(struct supertype *st, char *mddev, int mdfd, best = newbest; bestcnt = newbestcnt; } + if (best[i] >=0 && + devices[best[i]].events == devices[devcnt].events && + devices[best[i]].minor != devices[devcnt].minor && + st->ss->major == 0 && + info.array.level != -4) { + /* two different devices with identical superblock. + * Could be a mis-detection caused by overlapping + * partitions. fail-safe. + */ + fprintf(stderr, Name ": WARNING %s and %s appear" + " to have very similar superblocks.\n" + " If they are really different, " + "please --zero the superblock on one\n" + " If they are the same, please remove " + "one from the list.\n", + devices[best[i]].devname, devname); + if (must_close) close(mdfd); + return 1; + } if (best[i] == -1 || devices[best[i]].events < devices[devcnt].events) best[i] = devcnt; |