When reading cluster-heads, track the seq number, both for validation
and, later, for optimisation.
Signed-off-by: NeilBrown <neilb@suse.de>
goto bad_header;
if (memcmp(tc->ch->uuid, fs->state->uuid, 16) != 0)
goto bad_header;
- /* FIXME should I check 'seq' as well? */
+ if (tc->seq == 0)
+ tc->seq = le64_to_cpu(tc->ch->seq);
+ else {
+ tc->seq++;
+ if (tc->seq != le64_to_cpu(tc->ch->seq)) {
+ printk("Bad seq number\n");
+ goto bad_header;
+ }
+ }
tc->gh = tc->ch->groups;
tc->desc = tc->gh->u.desc;
if (lafs_calc_cluster_csum(tc->ch) != tc->ch->checksum) {
tc->gh = NULL;
tc->desc = NULL;
tc->ac.state = 1;
+ tc->seq = 0;
INIT_LIST_HEAD(&tc->cleaning);
fs->cleaner.active = 1;
}
u16 dev;
u32 seg;
u64 haddr; /* Address of this write-cluster-header */
+ u64 seq; /* seq of most recent header loaded */
struct cluster_head *ch;
struct group_head *gh; /* current group head */
struct descriptor *desc;