aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwanghanlin <wanghanlin@corp.netease.com>2021-06-22 17:34:08 +0800
committerFlorin Coras <florin.coras@gmail.com>2021-06-22 14:30:15 +0000
commit5788a34be6ccdc974e87a4ce068056d1ef8e585f (patch)
treeb300c53b84c8ed93d3cdde4704412849bf8d66c3
parentd72a034bf9e12aabdb1df21cab0a5c86a3dca8fa (diff)
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 <wanghanlin@corp.netease.com> Change-Id: I7696ecd898460c9a296d2800e46c7140e2218ed7
-rw-r--r--src/vcl/vcl_locked.c31
1 files changed, 31 insertions, 0 deletions
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);
}