summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2014-04-10 11:41:18 +1000
committerNeilBrown <neilb@suse.de>2014-05-21 11:54:48 +1000
commit30bee020130a6569be8a4f58c973c9288f8c5747 (patch)
treeeb947b6aba2ae4ec739ac644cbb6db7017620faf
parent609ce16109794ae768cd873606047e534fb7277f (diff)
DDF: don't assume the anchor is fully up-to-date.
We currently copy the anchor to both primary and secondary blocks. This assumes that the anchor is uptodate, but it might not be. We should trust the 'active' block and copy from there. Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r--super-ddf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/super-ddf.c b/super-ddf.c
index e4553d27..91b1797f 100644
--- a/super-ddf.c
+++ b/super-ddf.c
@@ -3095,6 +3095,7 @@ static int _write_super_to_disk(struct ddf_super *ddf, struct dl *d)
*/
get_dev_size(fd, NULL, &size);
size /= 512;
+ memcpy(&ddf->anchor, ddf->active, 512);
if (be64_to_cpu(d->workspace_lba) != 0ULL)
ddf->anchor.workspace_lba = d->workspace_lba;
else
@@ -3110,7 +3111,6 @@ static int _write_super_to_disk(struct ddf_super *ddf, struct dl *d)
else
ddf->anchor.secondary_lba =
cpu_to_be64(size - 32*1024*2);
- ddf->anchor.seq = ddf->active->seq;
ddf->anchor.timestamp = cpu_to_be32(time(0) - DECADE);
memcpy(&ddf->primary, &ddf->anchor, 512);
memcpy(&ddf->secondary, &ddf->anchor, 512);