Skip to content

Commit

Permalink
Merge "Vrouter to generate EEXIST error appropriately" into R2.20
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Mar 7, 2016
2 parents 6ff5582 + 1e56a59 commit 367d5c6
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions dp-core/vr_flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -1691,7 +1691,7 @@ static int
vr_flow_set(struct vrouter *router, vr_flow_req *req)
{
int ret;
unsigned int fe_index;
unsigned int fe_index = (unsigned int)-1;
bool new_flow = false, modified = false;

struct vr_flow_entry *fe = NULL, *rfe = NULL;
Expand Down Expand Up @@ -1735,8 +1735,19 @@ vr_flow_set(struct vrouter *router, vr_flow_req *req)
*/
if (!fe) {
fe = vr_add_flow_req(req, &fe_index);
if (!fe)
if (!fe) {
if (fe_index != (unsigned int)-1) {
/*
* add flow req failed to allocate an entry due to race
* between agent and datapath, where flow entry at fe_index
* was already created due to packet trap, return EEXIST
* error and allow agent to wait and handle flow add due to
* packet trap
*/
return -EEXIST;
}
return -ENOSPC;
}

new_flow = true;
infop->vfti_added++;
Expand Down

0 comments on commit 367d5c6

Please sign in to comment.