[ovs-dev] [PATCH] ofproto-dpif-upcall: Fix flow setup/delete race.

Joe Stringer joe at ovn.org
Mon Mar 20 21:08:19 UTC 2017

If a handler thread takes a long time to set up a set of flows, it is
possible for one of the installed flows to be dumped and scheduled
for deletion by a revalidator thread before the handler is able to
transition the ukey into an operational state---Between the
dpif_operate() above this function and the ukey lock / transition logic
modified by this patch.

Only transition the ukey for the flow if it wasn't already transitioned
to a later state by a revalidator thread.

Fixes: 54ebeff4c03d ("upcall: Track ukey states.")
Reported-by: Paul Blakey <paulb at mellanox.com>
Signed-off-by: Joe Stringer <joe at ovn.org>
 ofproto/ofproto-dpif-upcall.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c
index 07086ee385cc..0854807e4482 100644
--- a/ofproto/ofproto-dpif-upcall.c
+++ b/ofproto/ofproto-dpif-upcall.c
@@ -1404,7 +1404,7 @@ handle_upcalls(struct udpif *udpif, struct upcall *upcalls,
             if (ops[i].dop.error) {
                 transition_ukey(ukey, UKEY_EVICTED);
-            } else {
+            } else if (ukey->state < UKEY_OPERATIONAL) {
                 transition_ukey(ukey, UKEY_OPERATIONAL);

More information about the dev mailing list