Skip to content

Commit

Permalink
Acquire flow locks in FlowMgmt task
Browse files Browse the repository at this point in the history
Locks are required since we are accessing fields of flow in EnqueueUveAddEvent
and EnqueueUveDeleteEvent

Partial-Bug: #1641833
(cherry picked from commit 28bd277)

Change-Id: Ib914d9c107e5e7385f2b154aaf8f9b90531e0be3
  • Loading branch information
ashoksr committed Mar 23, 2017
1 parent 0cbb373 commit 95ebf43
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/vnsw/agent/pkt/flow_mgmt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -417,16 +417,14 @@ bool FlowMgmtManager::RequestHandler(FlowMgmtRequestPtr req) {
switch (req->event()) {
case FlowMgmtRequest::UPDATE_FLOW: {
FlowEntry *flow = req->flow().get();
{
// Before processing event, set the request pointer in flow to
// NULL. This ensures flow-entry enqueues new request from now
// onwards
tbb::mutex::scoped_lock mutex(flow->mutex());
flow->set_flow_mgmt_request(NULL);
}
// Before processing event, set the request pointer in flow to
// NULL. This ensures flow-entry enqueues new request from now
// onwards
tbb::mutex::scoped_lock mutex(flow->mutex());
flow->set_flow_mgmt_request(NULL);

// Update flow-mgmt information based on flow-state
if (req->flow()->deleted() == false) {
if (flow->deleted() == false) {
FlowMgmtRequestPtr log_req(new FlowMgmtRequest
(FlowMgmtRequest::ADD_FLOW,
req->flow().get()));
Expand Down Expand Up @@ -540,7 +538,6 @@ void FlowMgmtManager::LogFlowUnlocked(FlowEntry *flow, const std::string &op) {
// Extract all the FlowMgmtKey for a flow
void FlowMgmtManager::MakeFlowMgmtKeyTree(FlowEntry *flow,
FlowMgmtKeyTree *tree) {
tbb::mutex::scoped_lock mutex(flow->mutex());
acl_flow_mgmt_tree_.ExtractKeys(flow, tree);
interface_flow_mgmt_tree_.ExtractKeys(flow, tree);
vn_flow_mgmt_tree_.ExtractKeys(flow, tree);
Expand Down

0 comments on commit 95ebf43

Please sign in to comment.