Currently when a flow entry is deleted, the corresponding hash entry is
kept at the head of the free list and after successfully inserting into
the list the entry's flags are reset. If any other core is
attempting to fetch a free entry, there is a likely chance that just
added entry will be given as free entry before the flags are reset as
this entry is at the head of the list. Because of this there is a race
condition for setting the flags between deletion of entry and additin of
entry. If deletion overwrites the addition flags, the Valid flags gets
overwritten. Because of this the entry would not be in free list but
still would not be considered a valid entry. Searching this entry by
index fails as this is not a valid entry.
As a fix, the flags while inserting the entry to free list are modified
before inserting so that there would not be any race condition.
Reviewed: https:/ /review. opencontrail. org/18137 github. org/Juniper/ contrail- vrouter/ commit/ 4b84e39d7d3bb23 4252291213c850d 2fc98dba59
Committed: http://
Submitter: Zuul
Branch: R3.0
commit 4b84e39d7d3bb23 4252291213c850d 2fc98dba59
Author: Divakar <email address hidden>
Date: Thu Mar 3 11:02:13 2016 +0530
Modify hentry flags before adding to free list
Currently when a flow entry is deleted, the corresponding hash entry is
kept at the head of the free list and after successfully inserting into
the list the entry's flags are reset. If any other core is
attempting to fetch a free entry, there is a likely chance that just
added entry will be given as free entry before the flags are reset as
this entry is at the head of the list. Because of this there is a race
condition for setting the flags between deletion of entry and additin of
entry. If deletion overwrites the addition flags, the Valid flags gets
overwritten. Because of this the entry would not be in free list but
still would not be considered a valid entry. Searching this entry by
index fails as this is not a valid entry.
As a fix, the flags while inserting the entry to free list are modified
before inserting so that there would not be any race condition.
Change-Id: I67b1077e75a8a9 f4ca5ddcfe3a751 3061fd20681
closes-bug: #1552544