From: wanghanlin Date: Tue, 22 Jun 2021 09:34:08 +0000 (+0800) Subject: vcl: validate vep handle when copying sessions on fork X-Git-Tag: v22.02-rc0~277 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=5788a34be6ccdc974e87a4ce068056d1ef8e585f;hp=d72a034bf9e12aabdb1df21cab0a5c86a3dca8fa;p=vpp.git vcl: validate vep handle when copying sessions on fork When copying sessions from parent on fork, we should validate vep handle in order to EPOLL_CTL_DEL in vcl_session_cleanup correctly when child exit. Type: fix Signed-off-by: wanghanlin Change-Id: I7696ecd898460c9a296d2800e46c7140e2218ed7 --- diff --git a/src/vcl/vcl_locked.c b/src/vcl/vcl_locked.c index 44b7cedc9af..30d5f5f67b0 100644 --- a/src/vcl/vcl_locked.c +++ b/src/vcl/vcl_locked.c @@ -800,6 +800,34 @@ vls_share_sessions (vls_worker_t * vls_parent_wrk, vls_worker_t * vls_wrk) /* *INDENT-ON* */ } +static void +vls_validate_veps (vcl_worker_t *wrk) +{ + vcl_session_t *s; + u32 session_index, wrk_index; + + pool_foreach (s, wrk->sessions) + { + if (s->vep.vep_sh != ~0) + { + vcl_session_handle_parse (s->vep.vep_sh, &wrk_index, &session_index); + s->vep.vep_sh = vcl_session_handle_from_index (session_index); + } + if (s->vep.next_sh != ~0) + { + vcl_session_handle_parse (s->vep.next_sh, &wrk_index, + &session_index); + s->vep.next_sh = vcl_session_handle_from_index (session_index); + } + if (s->vep.prev_sh != ~0) + { + vcl_session_handle_parse (s->vep.prev_sh, &wrk_index, + &session_index); + s->vep.prev_sh = vcl_session_handle_from_index (session_index); + } + } +} + void vls_worker_copy_on_fork (vcl_worker_t * parent_wrk) { @@ -829,6 +857,9 @@ vls_worker_copy_on_fork (vcl_worker_t * parent_wrk) /* *INDENT-ON* */ vls_wrk->vls_pool = pool_dup (vls_parent_wrk->vls_pool); + /* Validate vep's handle */ + vls_validate_veps (wrk); + vls_share_sessions (vls_parent_wrk, vls_wrk); }