[ovs-git] [openvswitch/ovs] c0e327: dpif-netdev: Fix improper use of CMAP_FOR_EACH.

GitHub noreply at github.com
Wed Feb 3 04:59:24 UTC 2016


  Branch: refs/heads/branch-2.5
  Home:   https://github.com/openvswitch/ovs
  Commit: c0e327583c133acf6bdaa3cbbdcb154d92c08f31
      https://github.com/openvswitch/ovs/commit/c0e327583c133acf6bdaa3cbbdcb154d92c08f31
  Author: Daniele Di Proietto <diproiettod at vmware.com>
  Date:   2016-02-02 (Tue, 02 Feb 2016)

  Changed paths:
    M lib/dpif-netdev.c

  Log Message:
  -----------
  dpif-netdev: Fix improper use of CMAP_FOR_EACH.

It is ok to iterate a cmap with CMAP_FOR_EACH and remove elements with
cmap_remove(), but having quiescent states inside the loop might create
problems, since some of the postponed cleanup done inside the cmap might
be executed, freeing the memory that the iterator is using.

We had several of these errors in dpif-netdev, because when we rearrange
ports or threads we often need to wait on a condition variable (which
implies a quiescent state).

This problem caused iterations to skip elements or to list them twice,
resulting in the main thread waiting on a condition without anyone else
to signal.

Fix these cases by moving the possible quiescent states outside
CMAP_FOR_EACH loops.

Signed-off-by: Daniele Di Proietto <diproiettod at vmware.com>
Tested-by: Ilya Maximets <i.maximets at samsung.com>
Acked-by: Ilya Maximets <i.maximets at samsung.com>
Acked-by: Jarno Rajahalme <jarno at ovn.org>




More information about the git mailing list