Skip to content

Commit

Permalink
Merge "Fix parallel access to flow from LogHandler" into R3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Apr 19, 2016
2 parents 2078559 + c5be183 commit 194ccf5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
11 changes: 5 additions & 6 deletions src/vnsw/agent/pkt/flow_mgmt.cc
Expand Up @@ -432,10 +432,11 @@ bool FlowMgmtManager::DBRequestHandler(FlowMgmtRequestPtr req) {
}

bool FlowMgmtManager::LogHandler(FlowMgmtRequestPtr req) {
FlowEntry *flow = req->flow().get();
tbb::mutex::scoped_lock mutex(flow->mutex());
switch (req->event()) {
case FlowMgmtRequest::ADD_FLOW: {
FlowEntry *flow = req->flow().get();
LogFlow(flow, "ADD");
LogFlowUnlocked(flow, "ADD");

//Enqueue Add request to flow-stats-collector
agent_->flow_stats_manager()->AddEvent(req->flow());
Expand All @@ -447,8 +448,7 @@ bool FlowMgmtManager::LogHandler(FlowMgmtRequestPtr req) {
}

case FlowMgmtRequest::DELETE_FLOW: {
FlowEntry *flow = req->flow().get();
LogFlow(flow, "DEL");
LogFlowUnlocked(flow, "DEL");

//Enqueue Delete request to flow-stats-collector
agent_->flow_stats_manager()->DeleteEvent(flow, req->params());
Expand All @@ -472,9 +472,8 @@ void FlowMgmtManager::RetryVrfDelete(uint32_t vrf_id) {
}

// Extract all the FlowMgmtKey for a flow
void FlowMgmtManager::LogFlow(FlowEntry *flow, const std::string &op) {
void FlowMgmtManager::LogFlowUnlocked(FlowEntry *flow, const std::string &op) {
FlowInfo trace;
tbb::mutex::scoped_lock mutex(flow->mutex());
flow->FillFlowInfo(trace);
FLOW_TRACE(Trace, op, trace);
}
Expand Down
2 changes: 1 addition & 1 deletion src/vnsw/agent/pkt/flow_mgmt.h
Expand Up @@ -1080,7 +1080,7 @@ class FlowMgmtManager {
FlowEntryInfo *LocateFlowEntryInfo(FlowEntryPtr &flow);
void DeleteFlowEntryInfo(FlowEntryPtr &flow);
void MakeFlowMgmtKeyTree(FlowEntry *flow, FlowMgmtKeyTree *tree);
void LogFlow(FlowEntry *flow, const std::string &op);
void LogFlowUnlocked(FlowEntry *flow, const std::string &op);
void SetAceSandeshData(const AclDBEntry *acl, AclFlowCountResp &data,
int ace_id);
void SetAclFlowSandeshData(const AclDBEntry *acl, AclFlowResp &data,
Expand Down
2 changes: 1 addition & 1 deletion src/vnsw/agent/pkt/flow_proto.cc
Expand Up @@ -652,7 +652,7 @@ FlowTokenPtr FlowProto::GetToken(FlowEvent::Event event) {
return del_tokens_.GetToken(NULL);
break;

// FIXME: Remove this post testing
case FlowEvent::EVICT_FLOW:
case FlowEvent::INVALID:
break;

Expand Down

0 comments on commit 194ccf5

Please sign in to comment.