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
Reviewed: https:/ /review. opencontrail. org/30399 github. com/Juniper/ contrail- vrouter/ commit/ b6d4054d29a5c95 5261ac48016c674 6c0b44f31d
Committed: http://
Submitter: Zuul (<email address hidden>)
Branch: R2.22.x
commit b6d4054d29a5c95 5261ac48016c674 6c0b44f31d
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: vr_interface. c
dp-core/
Change-Id: I2a9d41f2b0152f 700e2c5c96c9f39 825c22ce482