[ovs-dev] [PATCH v1] ofproto-dpif-upcall: fix push_dp_ops

hepeng.0320 hepeng.0320 at bytedance.com
Fri Oct 9 12:07:14 UTC 2020


From: Peng He <hepeng.0320 at bytedance.com>

if for some reason, the dpif ops in push_dp_ops failed with op->dop.type
not equal to DPIF_OP_FLOW_DEL, the generated ukey is installed however
the corresponding datapath flow is not. The consequent upcalls will
always fail to install datapath flows as:

try_ukey_replace
  -> return false
     -> upcall return NOSPC error, however the ukey still exist.

note that, the revalidator_sweep__ will not certainly clean such ukeys.
The current code would try firstly to call revalidate_ukey and it might
result in keeping such ukeys in the end.

In this case, a large amount of warning logs are observed:

ofproto_dpif_upcall(pmd-c22/id:13)|WARN|Dropped 3898 log messages in last 87 seconds (most recently, 29 seconds ago) due to excessive rate
ofproto_dpif_upcall(pmd-c22/id:13)|WARN|upcall_cb failure: ukey installation fails

and it will not recovery unless you manually run revalidator/purge.

this path checks if ops succeeded, if not, will changed
ukey->state into EVICTED state.

Signed-off-by: Peng He <hepeng.0320 at bytedance.com>
---
 ofproto/ofproto-dpif-upcall.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c
index 72a5b4d73..c4c20b30c 100644
--- a/ofproto/ofproto-dpif-upcall.c
+++ b/ofproto/ofproto-dpif-upcall.c
@@ -2367,11 +2367,6 @@ push_dp_ops(struct udpif *udpif, struct ukey_op *ops, size_t n_ops)
         stats = op->dop.flow_del.stats;
         push = &push_buf;
 
-        if (op->dop.type != DPIF_OP_FLOW_DEL) {
-            /* Only deleted flows need their stats pushed. */
-            continue;
-        }
-
         if (op->dop.error) {
             /* flow_del error, 'stats' is unusable. */
             if (op->ukey) {
@@ -2382,6 +2377,11 @@ push_dp_ops(struct udpif *udpif, struct ukey_op *ops, size_t n_ops)
             continue;
         }
 
+        if (op->dop.type != DPIF_OP_FLOW_DEL) {
+            /* Only deleted flows need their stats pushed. */
+            continue;
+        }
+
         if (op->ukey) {
             ovs_mutex_lock(&op->ukey->mutex);
             transition_ukey(op->ukey, UKEY_EVICTED);
-- 
2.20.1



More information about the dev mailing list