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

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


  Branch: refs/heads/master
  Home:   https://github.com/openvswitch/ovs
  Commit: d916785ce98ccdaab4f4f0676d564852fb7c9451
      https://github.com/openvswitch/ovs/commit/d916785ce98ccdaab4f4f0676d564852fb7c9451
  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