2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

ofproto-dpif-upcall: Fix flow setup/delete race.

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: 54ebeff4c0 ("upcall: Track ukey states.")
Reported-by: Paul Blakey <paulb@mellanox.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
Tested-by: Paul Blakey <paulb@mellanox.com>
This commit is contained in:
Joe Stringer
2017-03-20 14:08:19 -07:00
parent 0ced2a5c5e
commit e34bbe31b4

View File

@@ -1407,7 +1407,7 @@ handle_upcalls(struct udpif *udpif, struct upcall *upcalls,
ovs_mutex_lock(&ukey->mutex);
if (ops[i].dop.error) {
transition_ukey(ukey, UKEY_EVICTED);
} else {
} else if (ukey->state < UKEY_OPERATIONAL) {
transition_ukey(ukey, UKEY_OPERATIONAL);
}
ovs_mutex_unlock(&ukey->mutex);