Comment 12 for bug 1571584

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/19848
Committed: http://github.org/Juniper/contrail-controller/commit/40e5eb0ab00c65c151f04bcbc7aafee8ba77a513
Submitter: Zuul
Branch: R3.0

commit 40e5eb0ab00c65c151f04bcbc7aafee8ba77a513
Author: Manish <email address hidden>
Date: Mon May 2 11:14:59 2016 +0530

Take interface nh reference after creating in VmInterface.

Previously say a db entry is created so it has ref count of 0. Now references
are being taken and released in multiple partition (currently in flow). The
refcount manipulation is atomic but operations after manipulations are not. In
absence of self reference refcount can go to 0 and come back to 1 and in turn
dbstate could be deleted. Entry is not marked for deletion and is valid. This
results in double call to free state and second call asserts as there was no
state.
Bit more explanation on why refcount is 1 and there is no state above.
Say there are two referrers a and b. a has taken reference and then releasing
it. So refcount goes to 1 and then back to 0. While it has modified refcount and
going through clearrefstate (refcount being 0), b runs in parallel and
increments refcount as well as tried adding state. Meanwhile a also proceeds and
then deletes state. Result is refcount is at 1 and there is no state which is
wrong.

Closes-bug: #1571584
Change-Id: I2237971d2f36aac00fa76b90770943bdddc86c19