diff options
author | NeilBrown <neilb@suse.de> | 2013-07-10 02:47:22 +0200 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2013-07-10 02:47:22 +0200 |
commit | 3eff7c1d2fd658df69d8379cb87f3a766dd5ab5c (patch) | |
tree | cc478ce279270936f8077bc79d1224042865ab48 /super-ddf.c | |
parent | DDF: ddf_process_update: Fix updates for SVDs (diff) | |
download | mdadm-3eff7c1d2fd658df69d8379cb87f3a766dd5ab5c.tar.xz mdadm-3eff7c1d2fd658df69d8379cb87f3a766dd5ab5c.zip |
DDF load headers: if primary is invalid, don't check fields.
Currently we compare fields between primary and secondary
superblocks, before we check if the primary is even valid.
This is a bit backwards, so reverse it.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to '')
-rw-r--r-- | super-ddf.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/super-ddf.c b/super-ddf.c index dd1095bd..a3799b81 100644 --- a/super-ddf.c +++ b/super-ddf.c @@ -817,13 +817,13 @@ static int load_ddf_headers(int fd, struct ddf_super *super, char *devname) if (load_ddf_header(fd, __be64_to_cpu(super->anchor.secondary_lba), dsize >> 9, 2, &super->secondary, &super->anchor)) { - if ((__be32_to_cpu(super->primary.seq) - < __be32_to_cpu(super->secondary.seq) && - !super->secondary.openflag) + if (super->active == NULL + || (__be32_to_cpu(super->primary.seq) + < __be32_to_cpu(super->secondary.seq) && + !super->secondary.openflag) || (__be32_to_cpu(super->primary.seq) == __be32_to_cpu(super->secondary.seq) && super->primary.openflag && !super->secondary.openflag) - || super->active == NULL ) super->active = &super->secondary; } else if (devname) |