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
dc39f2c2
Commit
dc39f2c2
authored
May 03, 2016
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Try to make it more obvious what happens and answer a good question
with a resounding yes!
parent
d20dc79b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
32 deletions
+22
-32
cache_ban_lurker.c
bin/varnishd/cache/cache_ban_lurker.c
+22
-32
No files found.
bin/varnishd/cache/cache_ban_lurker.c
View file @
dc39f2c2
...
...
@@ -164,6 +164,13 @@ ban_lurker_test_ban(struct worker *wrk, struct vsl_log *vsl, struct ban *bt,
return
;
i
=
0
;
VTAILQ_FOREACH_REVERSE_SAFE
(
bl
,
obans
,
banhead_s
,
l_list
,
bln
)
{
if
(
oc
->
ban
!=
bt
)
{
/*
* HSH_Lookup() grabbed this oc, killed
* it or tested it to top. We're done.
*/
break
;
}
if
(
bl
->
flags
&
BANS_FLAG_COMPLETED
)
{
/* Ban was overtaken by new (dup) ban */
VTAILQ_REMOVE
(
obans
,
bl
,
l_list
);
...
...
@@ -174,44 +181,27 @@ ban_lurker_test_ban(struct worker *wrk, struct vsl_log *vsl, struct ban *bt,
i
=
ban_evaluate
(
wrk
,
bl
->
spec
,
oc
,
NULL
,
&
tests
);
VSC_C_main
->
bans_lurker_tested
++
;
VSC_C_main
->
bans_lurker_tests_tested
+=
tests
;
if
(
i
)
break
;
/*
* XXX can we do this? can we safely assert that if
* lookup has raced us it will have moved the oc
* above the olist?
*
if (oc->ban != bt)
if
(
i
)
{
VSLb
(
vsl
,
SLT_ExpBan
,
"%u banned by lurker"
,
ObjGetXID
(
wrk
,
oc
));
HSH_Kill
(
oc
);
VSC_C_main
->
bans_lurker_obj_killed
++
;
break
;
*/
}
}
if
(
i
)
{
VSLb
(
vsl
,
SLT_ExpBan
,
"%u banned by lurker"
,
ObjGetXID
(
wrk
,
oc
));
HSH_Kill
(
oc
);
VSC_C_main
->
bans_lurker_obj_killed
++
;
}
else
{
/*
* we race lookup-time ban checks - oc may have moved up
* the ban list already and we do not want to move it
* down again.
*/
while
(
oc
->
ban
==
bt
)
{
Lck_Lock
(
&
ban_mtx
);
if
(
oc
->
ban
!=
bt
)
{
Lck_Unlock
(
&
ban_mtx
);
break
;
}
oc
->
ban
->
refcount
--
;
VTAILQ_REMOVE
(
&
oc
->
ban
->
objcore
,
oc
,
ban_list
);
if
(
i
==
0
&&
oc
->
ban
==
bt
)
{
Lck_Lock
(
&
ban_mtx
);
if
(
oc
->
ban
==
bt
)
{
bt
->
refcount
--
;
VTAILQ_REMOVE
(
&
bt
->
objcore
,
oc
,
ban_list
);
oc
->
ban
=
bd
;
bd
->
refcount
++
;
VTAILQ_INSERT_TAIL
(
&
bd
->
objcore
,
oc
,
ban_list
);
Lck_Unlock
(
&
ban_mtx
);
ObjSendEvent
(
wrk
,
oc
,
OEV_BANCHG
);
break
;
i
=
1
;
}
Lck_Unlock
(
&
ban_mtx
);
if
(
i
)
ObjSendEvent
(
wrk
,
oc
,
OEV_BANCHG
);
}
(
void
)
HSH_DerefObjCore
(
wrk
,
&
oc
);
}
...
...
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