aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuslan Ermilov <ru@nginx.com>2017-11-03 22:22:21 +0300
committerAleksei Bavshin <a.bavshin@f5.com>2024-11-07 07:57:42 -0800
commit1524c5e3fc9cbff6ef97ab97017a4b73bd85694b (patch)
treeaaf6206bd2ef23ba38eabb2ccbccb0896680a6c2
parent9fe119b431c957824d7bed75fce47dfbda74ca33 (diff)
downloadnginx-1524c5e3fc9cbff6ef97ab97017a4b73bd85694b.tar.gz
nginx-1524c5e3fc9cbff6ef97ab97017a4b73bd85694b.zip
Core: inheritance of non-reusable shared memory zones.
When re-creating a non-reusable zone, make the pointer to the old zone available during the new zone initialization.
-rw-r--r--src/core/ngx_cycle.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/core/ngx_cycle.c b/src/core/ngx_cycle.c
index 6978c3e43..a75bdf878 100644
--- a/src/core/ngx_cycle.c
+++ b/src/core/ngx_cycle.c
@@ -38,7 +38,7 @@ static ngx_connection_t dumb;
ngx_cycle_t *
ngx_init_cycle(ngx_cycle_t *old_cycle)
{
- void *rv;
+ void *rv, *data;
char **senv;
ngx_uint_t i, n;
ngx_log_t *log;
@@ -438,6 +438,8 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
opart = &old_cycle->shared_memory.part;
oshm_zone = opart->elts;
+ data = NULL;
+
for (n = 0; /* void */ ; n++) {
if (n >= opart->nelts) {
@@ -461,9 +463,13 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
continue;
}
+ if (shm_zone[i].tag == oshm_zone[n].tag && shm_zone[i].noreuse) {
+ data = oshm_zone[n].data;
+ break;
+ }
+
if (shm_zone[i].tag == oshm_zone[n].tag
- && shm_zone[i].shm.size == oshm_zone[n].shm.size
- && !shm_zone[i].noreuse)
+ && shm_zone[i].shm.size == oshm_zone[n].shm.size)
{
shm_zone[i].shm.addr = oshm_zone[n].shm.addr;
#if (NGX_WIN32)
@@ -490,7 +496,7 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
goto failed;
}
- if (shm_zone[i].init(&shm_zone[i], NULL) != NGX_OK) {
+ if (shm_zone[i].init(&shm_zone[i], data) != NGX_OK) {
goto failed;
}