diff options
author | NeilBrown <neilb@suse.de> | 2013-09-12 14:57:28 +1000 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2013-09-12 14:57:28 +1000 |
commit | b95cb4b9d88c8adf2adb7f2efef3ae3f72b27b8e (patch) | |
tree | eb31ef4b835e3ed59c87d2c7beedebc36512cf9c /super-ddf.c | |
parent | dbdf3f15e7ed9d5462a6ece09dd1c57ca430d912 (diff) |
DDF: allow for possibility that there is no secondary copy of metadata.
If there isn't, we currently write the second copy at some
random location :-)
Reported-and-tested-by: Francis Moreau <francis.moro@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'super-ddf.c')
-rw-r--r-- | super-ddf.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/super-ddf.c b/super-ddf.c index 636d7b49..d2cdda4c 100644 --- a/super-ddf.c +++ b/super-ddf.c @@ -880,7 +880,8 @@ static int load_ddf_headers(int fd, struct ddf_super *super, char *devname) super->primary.openflag && !super->secondary.openflag) ) super->active = &super->secondary; - } else if (devname) + } else if (devname && + be64_to_cpu(super->anchor.secondary_lba) != ~(__u64)0) pr_err("Failed to load secondary DDF header on %s\n", devname); if (super->active == NULL) @@ -2810,7 +2811,9 @@ static int add_to_super_ddf(struct supertype *st, } while (0) __calc_lba(dd, ddf->dlist, workspace_lba, 32); __calc_lba(dd, ddf->dlist, primary_lba, 16); - __calc_lba(dd, ddf->dlist, secondary_lba, 32); + if (ddf->dlist == NULL || + be64_to_cpu(ddf->dlist->secondary_lba) != ~(__u64)0) + __calc_lba(dd, ddf->dlist, secondary_lba, 32); pde->config_size = dd->workspace_lba; sprintf(pde->path, "%17.17s","Information: nil") ; @@ -2892,6 +2895,8 @@ static int __write_ddf_structure(struct dl *d, struct ddf_super *ddf, __u8 type) default: return 0; } + if (sector == ~(__u64)0) + return 0; header->type = type; header->openflag = 1; |