Fix new_seqno()'s recovery from seqno mismatch

A sequence number mismatch occurs when an invalid copy (with a stale
sequence number) gets written.  To continue after the error, we need
to use the current sequence number.  But new_seqno() used the larger
one of the two, which is correct only as long as sequence numbers do
not overflow.  Overflow is rather unlikely, though.
This commit is contained in:
Markus Armbruster 2009-12-31 12:12:39 +01:00
parent 0ba61f1714
commit 18148f03fa

View file

@ -603,8 +603,7 @@ new_seqno(struct empfile *ep, void *buf)
if (!(ep->flags & EFF_TYPED))
return;
old_seqno = get_seqno(ep, elt->uid);
if (CANT_HAPPEN(old_seqno != elt->seqno))
old_seqno = MAX(old_seqno, elt->seqno);
CANT_HAPPEN(old_seqno != elt->seqno);
elt->seqno = old_seqno + 1;
}