revalidator: Prevent handling the same flow twice.
authorJoe Stringer <joestringer@nicira.com>
Wed, 23 Apr 2014 03:31:17 +0000 (15:31 +1200)
committerJoe Stringer <joestringer@nicira.com>
Wed, 23 Apr 2014 23:57:49 +0000 (11:57 +1200)
commit73a3c4757e596ff156d40f41496a0264373e5bc4
treefe08333e5e23b931845ccb616e702063babe1e0b
parentc12cea0e269986bb0ab75a702da760db745b8143
revalidator: Prevent handling the same flow twice.

When the datapath flow table is modified while a flow dump operation is
in progress, it is possible for the same flow to be dumped twice. In
such cases, revalidators may perform redundant work, or attempt to
delete the same flow twice.

This was causing intermittent testsuite failures for test #670 -
"ofproto-dpif, active-backup bonding" where a flow (that had not
previously been dumped) was dumped, revalidated and deleted twice.

The logs show errors such as:
"failed to flow_get (No such file or directory) skb_priority(0),..."
"failed to flow_del (No such file or directory) skb_priority(0),..."

This patch adds a 'flow_exists' field to 'struct udpif_key' to track
whether the flow is (in progress) to be deleted. After doing a ukey
lookup, we check whether ukey->mark or ukey->flow indicates that the
flow has already been handled. If it has already been handled, we skip
handling the flow again.

We also defer ukey cleanup for flows that fail revalidation, so that the
ukey will still exist if the same flow is dumped twice. This allows the
above logic to work in this case.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
ofproto/ofproto-dpif-upcall.c