OVS lib deferred apply cannot handle concurrency

Bug #1263866 reported by Édouard Thuleau
20
This bug affects 2 people
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Medium
Édouard Thuleau
Havana
Fix Released
Medium
Édouard Thuleau
Icehouse
Fix Released
Medium
Édouard Thuleau

Bug Description

OVS lib propose a deferred apply methods to save system calls to 'ovs-ofctl' binaries ('ovs-ofctl' can apply flow from file or stdin if file is '-').

This method use a dict for 'add', mod' or 'del' flow actions that contain a concatenated string flows. This dict is purge after all flows are applied at the end of 'deferred_apply_off' method.
If another call is made on that dict during the 'deferred_apply_off', some flows could be deleted a the end when they have not been applied.

I can see that on ML2 plugin with l2-pop mechanism driver. If I delete more than one port at a time, some flooding flow rules could be not deleted on the br-tun bridge.

Tags: l2-pop ovs
Changed in neutron:
assignee: nobody → Édouard Thuleau (ethuleau)
Changed in neutron:
status: New → In Progress
Kyle Mestery (mestery)
Changed in neutron:
importance: Undecided → Medium
Revision history for this message
Yves-Gwenael Bourhis (yves-gwenael-bourhis) wrote :

Fix proposed to branch: master
Review: https://review.openstack.org/63917

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/havana)

Fix proposed to branch: stable/havana
Review: https://review.openstack.org/84966

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/63917
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=501213686886baccd3280e10b8856a25d3517519
Submitter: Jenkins
Branch: master

commit 501213686886baccd3280e10b8856a25d3517519
Author: Édouard Thuleau <email address hidden>
Date: Mon Mar 3 18:08:33 2014 +0100

    OVS lib defer apply doesn't handle concurrency

    The OVS lib deferred apply methods use a dict to save flows to add,
    modify or delete when deffered apply is switched off.
    If another thread adds, modifies or deletes flows on that dict during
    another process called deffered_apply_off, its flows could be ignored.

    This fix stash reference flows list and point the flows list to a new
    cleared flows list. Then, it applies flows from the stashed flows list.

    Closes-bug: #1263866
    Change-Id: Ia3c6ce181e1599d1474da7eb944feff7d84f1d73

Changed in neutron:
status: In Progress → Fix Committed
tags: added: folsom-backport-potential
tags: added: icehouse-backport-potential
removed: folsom-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/icehouse)

Fix proposed to branch: stable/icehouse
Review: https://review.openstack.org/94250

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/havana)

Fix proposed to branch: stable/havana
Review: https://review.openstack.org/94253

tags: added: havana-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/icehouse)

Reviewed: https://review.openstack.org/94250
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=efa4f2895f739ba191cfdd8dbe35e37fbead06c4
Submitter: Jenkins
Branch: stable/icehouse

commit efa4f2895f739ba191cfdd8dbe35e37fbead06c4
Author: Édouard Thuleau <email address hidden>
Date: Mon Mar 3 18:08:33 2014 +0100

    OVS lib defer apply doesn't handle concurrency

    The OVS lib deferred apply methods use a dict to save flows to add,
    modify or delete when deffered apply is switched off.
    If another thread adds, modifies or deletes flows on that dict during
    another process called deffered_apply_off, its flows could be ignored.

    This fix stash reference flows list and point the flows list to a new
    cleared flows list. Then, it applies flows from the stashed flows list.

    Closes-bug: #1263866
    Change-Id: Ia3c6ce181e1599d1474da7eb944feff7d84f1d73
    (cherry picked from commit 501213686886baccd3280e10b8856a25d3517519)

tags: added: in-stable-icehouse
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/havana)

Reviewed: https://review.openstack.org/94253
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=ff973b6d754846694569f4d402cf38034a9a1e0f
Submitter: Jenkins
Branch: stable/havana

commit ff973b6d754846694569f4d402cf38034a9a1e0f
Author: Édouard Thuleau <email address hidden>
Date: Mon Mar 3 18:08:33 2014 +0100

    OVS lib defer apply doesn't handle concurrency

    The OVS lib deferred apply methods use a dict to save flows to add,
    modify or delete when deffered apply is switched off.
    If another thread adds, modifies or deletes flows on that dict during
    another process called deffered_apply_off, its flows could be ignored.

    This fix stash reference flows list and point the flows list to a new
    cleared flows list. Then, it applies flows from the stashed flows list.

    Closes-bug: #1263866
    (cherry picked from commit 501213686886baccd3280e10b8856a25d3517519)

    Conflicts:
     neutron/tests/unit/agent/linux/test_ovs_lib.py

    Change-Id: I3b22c7ec055934d7f30067924c7a7fd71b2f6081

tags: added: in-stable-havana
Alan Pevec (apevec)
tags: removed: havana-backport-potential icehouse-backport-potential in-stable-havana in-stable-icehouse
Thierry Carrez (ttx)
Changed in neutron:
milestone: none → juno-1
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to neutron (master)

Reviewed: https://review.openstack.org/77578
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=990d596ec09242733f8bc3669b70136ca6741d6e
Submitter: Jenkins
Branch: master

commit 990d596ec09242733f8bc3669b70136ca6741d6e
Author: cedric.brandily <email address hidden>
Date: Fri May 16 16:18:45 2014 -0400

    OVS flows apply concurrently using a deferred OVSBridge

    This change is an improvement of the commit
    501213686886baccd3280e10b8856a25d3517519 and provides a cleaner
    implementation. Previously flows were applied on
    OVSBridge.defer_apply_off which could be called by an other
    greenthread: it was impossible to ensure that all flows are applied
    in a unique OVSBridge.defer_apply_off call. This change ensures that
    all flows defined using a DeferredOVSBridge are applied on
    DeferredOVSBridge.apply_flows or DeferredOVSBridge.__exit__ if not
    exception is raised.

    Author: Cedric Brandily <email address hidden>
    Co-Authored-By: Edouard Thuleau <email address hidden>

    Related-bug: #1263866
    Change-Id: I1f260629ef95b98ee80e2ff946c3606da8fe7608

Thierry Carrez (ttx)
Changed in neutron:
milestone: juno-1 → 2014.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.