Comment 16 for bug 1677571

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

Reviewed: https://review.opencontrail.org/30289
Committed: http://github.org/Juniper/contrail-vrouter/commit/f39f54f2db6a90f9eadb01d8decd46111db99e96
Submitter: Zuul (<email address hidden>)
Branch: R2.21.x

commit f39f54f2db6a90f9eadb01d8decd46111db99e96
Author: Divakar D <email address hidden>
Date: Thu Apr 6 10:33:18 2017 +0530

Cleanup SubVIF properly if addition fails

On a given physical interface there can only be one subinterface per
given Vlan ID. If Agent attempts to add multiple subinterfaces with same
Valn ID, vrouter rejects that addition with -EEXIST error. As part of
this rejection, the temproary subinterface need to be properly
cleaned up. Right now the clean up is not proper w.r.t memory and the
refcount of the physical interface is lso not handled well. This is
leading to either memory leak/corruption.

Also currently the ref counting of VIF is not symetric w.r.t increment
and decrement. Decrement of ref count is done in atomic way but not
increment. This as such can lead to issues when RCU callbacks
of NH (which eventually decrement VIF ref count in atomic manner) are
executed in parallel to new NH addition from Agent (which increments VIF
ref count non atomic manner).

As a fix, sub VIF is cleaned up properly and VIF ref count is
incremented in atomic manner

closes-bug: #1677571

Conflicts:
 dp-core/vr_interface.c

Change-Id: I2a9d41f2b0152f700e2c5c96c9f39825c22ce482