On Mon, Sep 22, 2008 at 04:01:14PM +0300, Timo Teräs wrote:
No that doesn't work. Let's say we store the entry X in walk->state,
and we hold X as well as X->next. Now X, X->next, and X->next->next
get deleted from the list. What'll happen is that X and X->next
will stick around but X->next->next will be freed. So when we
resume from X we'll dump X and X->next correctly, but then hit
X->next->next and be in the same shithole.
Really, the only way to do what you want here is to hold everything
from X to the very end of the list. The problem with that is that
you can no longer drop the reference counts when we resume.
You can see why even if we only hold X and X->next. Should X->next
be deleted from the list, when we resume from X we'll no longer be
able to drop the reference count on the original X->next since it
now points to a new entry.
I think this is a lot more efficient than storing every single
entry from X to the end of the list :)
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html