Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
b90a8354
Commit
b90a8354
authored
Jun 30, 2015
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Lock the backend tcp-pools under the backends_mtx, rather than the
(implicit) CLI lock.
parent
7585d89a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
9 deletions
+13
-9
cache_backend_cfg.c
bin/varnishd/cache/cache_backend_cfg.c
+13
-8
cache_backend_tcp.c
bin/varnishd/cache/cache_backend_tcp.c
+0
-1
No files found.
bin/varnishd/cache/cache_backend_cfg.c
View file @
b90a8354
...
@@ -49,6 +49,7 @@
...
@@ -49,6 +49,7 @@
static
VTAILQ_HEAD
(,
backend
)
backends
=
VTAILQ_HEAD_INITIALIZER
(
backends
);
static
VTAILQ_HEAD
(,
backend
)
backends
=
VTAILQ_HEAD_INITIALIZER
(
backends
);
static
struct
lock
backends_mtx
;
static
struct
lock
backends_mtx
;
/*--------------------------------------------------------------------
/*--------------------------------------------------------------------
* Create/Delete a new director::backend instance.
* Create/Delete a new director::backend instance.
*/
*/
...
@@ -59,6 +60,7 @@ VRT_new_backend(VRT_CTX, const struct vrt_backend *vrt)
...
@@ -59,6 +60,7 @@ VRT_new_backend(VRT_CTX, const struct vrt_backend *vrt)
struct
backend
*
b
;
struct
backend
*
b
;
char
buf
[
128
];
char
buf
[
128
];
struct
vcl
*
vcl
;
struct
vcl
*
vcl
;
struct
tcp_pool
*
tp
=
NULL
;
const
struct
vrt_backend_probe
*
vbp
;
const
struct
vrt_backend_probe
*
vbp
;
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
...
@@ -87,25 +89,28 @@ VRT_new_backend(VRT_CTX, const struct vrt_backend *vrt)
...
@@ -87,25 +89,28 @@ VRT_new_backend(VRT_CTX, const struct vrt_backend *vrt)
b
->
vcl
=
vcl
;
b
->
vcl
=
vcl
;
b
->
tcp_pool
=
VBT_Ref
(
vrt
->
ipv4_suckaddr
,
vrt
->
ipv6_suckaddr
);
b
->
healthy
=
1
;
b
->
healthy
=
1
;
b
->
health_changed
=
VTIM_real
();
b
->
health_changed
=
VTIM_real
();
b
->
admin_health
=
ah_probe
;
b
->
admin_health
=
ah_probe
;
vbp
=
vrt
->
probe
;
if
(
vbp
==
NULL
)
vbp
=
VCL_DefaultProbe
(
vcl
);
Lck_Lock
(
&
backends_mtx
);
Lck_Lock
(
&
backends_mtx
);
VTAILQ_INSERT_TAIL
(
&
backends
,
b
,
list
);
VTAILQ_INSERT_TAIL
(
&
backends
,
b
,
list
);
VSC_C_main
->
n_backend
++
;
VSC_C_main
->
n_backend
++
;
b
->
tcp_pool
=
VBT_Ref
(
vrt
->
ipv4_suckaddr
,
vrt
->
ipv6_suckaddr
);
if
(
vbp
!=
NULL
)
{
tp
=
VBT_Ref
(
vrt
->
ipv4_suckaddr
,
vrt
->
ipv6_suckaddr
);
assert
(
b
->
tcp_pool
==
tp
);
}
Lck_Unlock
(
&
backends_mtx
);
Lck_Unlock
(
&
backends_mtx
);
VBE_fill_director
(
b
);
VBE_fill_director
(
b
);
vbp
=
vrt
->
probe
;
if
(
vbp
==
NULL
)
vbp
=
VCL_DefaultProbe
(
vcl
);
if
(
vbp
!=
NULL
)
if
(
vbp
!=
NULL
)
VBP_Insert
(
b
,
vbp
,
VBP_Insert
(
b
,
vbp
,
tp
);
VBT_Ref
(
vrt
->
ipv4_suckaddr
,
vrt
->
ipv6_suckaddr
));
VCL_AddBackend
(
ctx
->
vcl
,
b
);
VCL_AddBackend
(
ctx
->
vcl
,
b
);
...
@@ -167,6 +172,7 @@ VBE_Delete(struct backend *be)
...
@@ -167,6 +172,7 @@ VBE_Delete(struct backend *be)
Lck_Lock
(
&
backends_mtx
);
Lck_Lock
(
&
backends_mtx
);
VTAILQ_REMOVE
(
&
backends
,
be
,
list
);
VTAILQ_REMOVE
(
&
backends
,
be
,
list
);
VSC_C_main
->
n_backend
--
;
VSC_C_main
->
n_backend
--
;
VBT_Rel
(
&
be
->
tcp_pool
);
Lck_Unlock
(
&
backends_mtx
);
Lck_Unlock
(
&
backends_mtx
);
#define DA(x) do { if (be->x != NULL) free(be->x); } while (0)
#define DA(x) do { if (be->x != NULL) free(be->x); } while (0)
...
@@ -177,7 +183,6 @@ VBE_Delete(struct backend *be)
...
@@ -177,7 +183,6 @@ VBE_Delete(struct backend *be)
free
(
be
->
display_name
);
free
(
be
->
display_name
);
AZ
(
be
->
vsc
);
AZ
(
be
->
vsc
);
VBT_Rel
(
&
be
->
tcp_pool
);
Lck_Delete
(
&
be
->
mtx
);
Lck_Delete
(
&
be
->
mtx
);
FREE_OBJ
(
be
);
FREE_OBJ
(
be
);
}
}
...
...
bin/varnishd/cache/cache_backend_tcp.c
View file @
b90a8354
...
@@ -127,7 +127,6 @@ VBT_Ref(const struct suckaddr *ip4, const struct suckaddr *ip6)
...
@@ -127,7 +127,6 @@ VBT_Ref(const struct suckaddr *ip4, const struct suckaddr *ip6)
{
{
struct
tcp_pool
*
tp
;
struct
tcp_pool
*
tp
;
ASSERT_CLI
();
VTAILQ_FOREACH
(
tp
,
&
pools
,
list
)
{
VTAILQ_FOREACH
(
tp
,
&
pools
,
list
)
{
assert
(
tp
->
refcnt
>
0
);
assert
(
tp
->
refcnt
>
0
);
if
(
ip4
==
NULL
)
{
if
(
ip4
==
NULL
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment