[ovs-git] [ovn-org/ovn] c659ed: lflow.c: Avoid adding redundant resource refs for ...

Han Zhou noreply at github.com
Thu Sep 17 17:52:18 UTC 2020


  Branch: refs/heads/branch-20.06
  Home:   https://github.com/ovn-org/ovn
  Commit: c659ed732f77979bfc7d8c0e6dfc2032e73d4257
      https://github.com/ovn-org/ovn/commit/c659ed732f77979bfc7d8c0e6dfc2032e73d4257
  Author: Han Zhou <hzhou at ovn.org>
  Date:   2020-09-17 (Thu, 17 Sep 2020)

  Changed paths:
    M controller/lflow.c
    M controller/lflow.h
    M tests/ovn.at

  Log Message:
  -----------
  lflow.c: Avoid adding redundant resource refs for port-bindings.

When a lport is referenced by a logical flow where port-binding refs
needs to be added, currently it can add the same reference pair multiple
times in below situations (introduced in commit ade4e77):

1) In add_matches_to_flow_table(), different matches from same lflow
   can have same inport/outport.

2) In is_chassis_resident_cb(), a lflow can have multiple is_chassis_resident
   check for same lport (although not very common), and at the same time
   the lport used in is_chassis_resident can overlap with the inport/
   outport of the same flow.

Now because of the redundant entries added, it results in unexpected behavior
such as same lflow being processed multiple times as a waste of processing.
More severely, after commit 580aea72e it can result in orphaned pointer leading
to crash, as reported in [0].

This patch fixes the problems by checking existence of same reference before
adding in lflow_resource_add(). To do this check efficiently, hmap is used to
replace the list struct for the resource-to-lflow index.

[0] https://mail.openvswitch.org/pipermail/ovs-dev/2020-September/374991.html

Reported-by: Dumitru Ceara <dceara at redhat.com>
Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2020-September/374991.html
Fixes: ade4e779d3fb ("ovn-controller: Use the tracked runtime data changes for flow calculation.")
Fixes: 580aea72e26f ("ovn-controller: Fix conjunction handling with incremental processing.")
Acked-by: Dumitru Ceara <dceara at redhat.com>
Acked-by: Numan Siddique <numans at ovn.org>
Signed-off-by: Han Zhou <hzhou at ovn.org>


  Commit: e8467b8002f9bb098550fb96fbe71420f91f9e84
      https://github.com/ovn-org/ovn/commit/e8467b8002f9bb098550fb96fbe71420f91f9e84
  Author: Han Zhou <hzhou at ovn.org>
  Date:   2020-09-17 (Thu, 17 Sep 2020)

  Changed paths:
    M controller/lflow.c

  Log Message:
  -----------
  lflow.c: Release ref_lflow_node as soon as it is not needed.

If a resource doesn't have any lflows referencing it any more, the
node ref_lflow_node in lflow_resource_ref.ref_lflow_table should
be removed and released. Otherwise, the table could keep growing
in some scenarios, until a recompute is triggered. Now that the
chance of triggering recompute is lower and there are more resources
references maintained (for type port-binding), this problem is
more likely to happen than before. This patch fixes the problem
by releasing the node as soon as it is not needed.

Fixes: d2aa2c7cafe ("ovn-controller: Maintain resource references for logical flows.")
Acked-by: Dumitru Ceara <dceara at redhat.com>
Acked-by: Numan Siddique <numans at ovn.org>
Signed-off-by: Han Zhou <hzhou at ovn.org>


Compare: https://github.com/ovn-org/ovn/compare/28720796fae9...e8467b8002f9


More information about the git mailing list