diff options
author | Anoob Soman <anoob.soman@citrix.com> | 2014-05-20 12:40:35 +0100 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2014-06-09 10:45:28 -0700 |
commit | 3a208109f5e91b0cfbc387877b81aba743eab5f3 (patch) | |
tree | b03b9eb77715243847fbaf918b877999b3c1c9af /ofproto/netflow.c | |
parent | 059ef3c65f596f93e56c7062e35977d429faa4ab (diff) | |
download | openvswitch-3a208109f5e91b0cfbc387877b81aba743eab5f3.tar.gz |
netflow: Fold netflow_expire() into netflow_flow_clear().
netflow_flow_clear() asserted that no packets or bytes were included
in the statistics for the flow being cleared. Before threading Open
vSwitch, this assertion was always true because netflow_expire() was
always called before calling netflow_flow_clear(). Since Open
vSwitch was threaded, however, it was possible that a packet arrived
after netflow_expire() but before netflow_flow_clear(), since each of
these function separately took the netflow mutex.
This commit fixes the problem by merging netflow_expire() into
netflow_flow_clear(), under a single acquisition of the netflow
mutex.
Signed-off-by: Anoob Soman <anoob.soman@citrix.com>
[blp@nicira.com modified the patch to remove netflow_expire() and
rewrote the commit message]
Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'ofproto/netflow.c')
-rw-r--r-- | ofproto/netflow.c | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/ofproto/netflow.c b/ofproto/netflow.c index e9382afe9..c7af01042 100644 --- a/ofproto/netflow.c +++ b/ofproto/netflow.c @@ -276,19 +276,6 @@ netflow_expire__(struct netflow *nf, struct netflow_flow *nf_flow) } void -netflow_expire(struct netflow *nf, struct flow *flow) OVS_EXCLUDED(mutex) -{ - struct netflow_flow *nf_flow; - - ovs_mutex_lock(&mutex); - nf_flow = netflow_flow_lookup(nf, flow); - if (nf_flow) { - netflow_expire__(nf, nf_flow); - } - ovs_mutex_unlock(&mutex); -} - -void netflow_flow_clear(struct netflow *nf, struct flow *flow) OVS_EXCLUDED(mutex) { struct netflow_flow *nf_flow; @@ -296,8 +283,7 @@ netflow_flow_clear(struct netflow *nf, struct flow *flow) OVS_EXCLUDED(mutex) ovs_mutex_lock(&mutex); nf_flow = netflow_flow_lookup(nf, flow); if (nf_flow) { - ovs_assert(!nf_flow->packet_count); - ovs_assert(!nf_flow->byte_count); + netflow_expire__(nf, nf_flow); hmap_remove(&nf->flows, &nf_flow->hmap_node); free(nf_flow); } |