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>
Thu, 24 Apr 2014 00:03:23 +0000 (12:03 +1200)
commit80c5e4ea9a9ff685ccd0e1c75ac90d5c0c5428d9
treea26c6b2309a96f58c193ac1e694f74fa22439a9e
parenta2946b415e52059607a43d41ba7ad0123b39c587
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