Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
unique-xids
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
unique-xids
Commits
41a719c9
Commit
41a719c9
authored
Feb 20, 2012
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Urg, forgot the outher loop of the ban-lurker:
Fix previous change to not madly leak memory.
parent
81400111
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
cache_ban.c
bin/varnishd/cache/cache_ban.c
+14
-14
No files found.
bin/varnishd/cache/cache_ban.c
View file @
41a719c9
...
@@ -796,20 +796,17 @@ ban_CheckLast(void)
...
@@ -796,20 +796,17 @@ ban_CheckLast(void)
*/
*/
static
int
static
int
ban_lurker_work
(
struct
worker
*
wrk
,
unsigned
pass
)
ban_lurker_work
(
struct
worker
*
wrk
,
struct
vsl_log
*
vsl
,
unsigned
pass
)
{
{
struct
ban
*
b
,
*
b0
,
*
b2
;
struct
ban
*
b
,
*
b0
,
*
b2
;
struct
objhead
*
oh
;
struct
objhead
*
oh
;
struct
objcore
*
oc
,
*
oc2
;
struct
objcore
*
oc
,
*
oc2
;
struct
object
*
o
;
struct
object
*
o
;
struct
vsl_log
vsl
;
int
i
;
int
i
;
AN
(
pass
&
BAN_F_LURK
);
AN
(
pass
&
BAN_F_LURK
);
AZ
(
pass
&
~
BAN_F_LURK
);
AZ
(
pass
&
~
BAN_F_LURK
);
VSL_Setup
(
&
vsl
,
NULL
,
0
);
/* First route the last ban(s) */
/* First route the last ban(s) */
do
{
do
{
Lck_Lock
(
&
ban_mtx
);
Lck_Lock
(
&
ban_mtx
);
...
@@ -839,13 +836,13 @@ ban_lurker_work(struct worker *wrk, unsigned pass)
...
@@ -839,13 +836,13 @@ ban_lurker_work(struct worker *wrk, unsigned pass)
b
->
flags
|=
pass
;
b
->
flags
|=
pass
;
}
}
if
(
cache_param
->
diag_bitmap
&
0x80000
)
if
(
cache_param
->
diag_bitmap
&
0x80000
)
VSLb
(
&
vsl
,
SLT_Debug
,
"lurker: %d actionable bans"
,
i
);
VSLb
(
vsl
,
SLT_Debug
,
"lurker: %d actionable bans"
,
i
);
if
(
i
==
0
)
if
(
i
==
0
)
return
(
0
);
return
(
0
);
VTAILQ_FOREACH_REVERSE
(
b
,
&
ban_head
,
banhead_s
,
list
)
{
VTAILQ_FOREACH_REVERSE
(
b
,
&
ban_head
,
banhead_s
,
list
)
{
if
(
cache_param
->
diag_bitmap
&
0x80000
)
if
(
cache_param
->
diag_bitmap
&
0x80000
)
VSLb
(
&
vsl
,
SLT_Debug
,
"lurker doing %f %d"
,
VSLb
(
vsl
,
SLT_Debug
,
"lurker doing %f %d"
,
ban_time
(
b
->
spec
),
b
->
refcount
);
ban_time
(
b
->
spec
),
b
->
refcount
);
while
(
1
)
{
while
(
1
)
{
Lck_Lock
(
&
ban_mtx
);
Lck_Lock
(
&
ban_mtx
);
...
@@ -854,7 +851,7 @@ ban_lurker_work(struct worker *wrk, unsigned pass)
...
@@ -854,7 +851,7 @@ ban_lurker_work(struct worker *wrk, unsigned pass)
break
;
break
;
CHECK_OBJ_NOTNULL
(
oc
,
OBJCORE_MAGIC
);
CHECK_OBJ_NOTNULL
(
oc
,
OBJCORE_MAGIC
);
if
(
cache_param
->
diag_bitmap
&
0x80000
)
if
(
cache_param
->
diag_bitmap
&
0x80000
)
VSLb
(
&
vsl
,
SLT_Debug
,
"test: %p %u %u"
,
VSLb
(
vsl
,
SLT_Debug
,
"test: %p %u %u"
,
oc
,
oc
->
flags
&
OC_F_LURK
,
pass
);
oc
,
oc
->
flags
&
OC_F_LURK
,
pass
);
if
((
oc
->
flags
&
OC_F_LURK
)
==
pass
)
if
((
oc
->
flags
&
OC_F_LURK
)
==
pass
)
break
;
break
;
...
@@ -862,7 +859,7 @@ ban_lurker_work(struct worker *wrk, unsigned pass)
...
@@ -862,7 +859,7 @@ ban_lurker_work(struct worker *wrk, unsigned pass)
CHECK_OBJ_NOTNULL
(
oh
,
OBJHEAD_MAGIC
);
CHECK_OBJ_NOTNULL
(
oh
,
OBJHEAD_MAGIC
);
if
(
Lck_Trylock
(
&
oh
->
mtx
))
{
if
(
Lck_Trylock
(
&
oh
->
mtx
))
{
Lck_Unlock
(
&
ban_mtx
);
Lck_Unlock
(
&
ban_mtx
);
VSL_Flush
(
&
vsl
,
0
);
VSL_Flush
(
vsl
,
0
);
VTIM_sleep
(
cache_param
->
ban_lurker_sleep
);
VTIM_sleep
(
cache_param
->
ban_lurker_sleep
);
continue
;
continue
;
}
}
...
@@ -892,9 +889,9 @@ ban_lurker_work(struct worker *wrk, unsigned pass)
...
@@ -892,9 +889,9 @@ ban_lurker_work(struct worker *wrk, unsigned pass)
* Get the object and check it against all relevant bans
* Get the object and check it against all relevant bans
*/
*/
o
=
oc_getobj
(
&
wrk
->
stats
,
oc
);
o
=
oc_getobj
(
&
wrk
->
stats
,
oc
);
i
=
ban_check_object
(
o
,
&
vsl
,
NULL
);
i
=
ban_check_object
(
o
,
vsl
,
NULL
);
if
(
cache_param
->
diag_bitmap
&
0x80000
)
if
(
cache_param
->
diag_bitmap
&
0x80000
)
VSLb
(
&
vsl
,
SLT_Debug
,
"lurker got: %p %d"
,
VSLb
(
vsl
,
SLT_Debug
,
"lurker got: %p %d"
,
oc
,
i
);
oc
,
i
);
if
(
i
==
-
1
)
{
if
(
i
==
-
1
)
{
/* Not banned, not moved */
/* Not banned, not moved */
...
@@ -906,7 +903,7 @@ ban_lurker_work(struct worker *wrk, unsigned pass)
...
@@ -906,7 +903,7 @@ ban_lurker_work(struct worker *wrk, unsigned pass)
}
}
Lck_Unlock
(
&
oh
->
mtx
);
Lck_Unlock
(
&
oh
->
mtx
);
if
(
cache_param
->
diag_bitmap
&
0x80000
)
if
(
cache_param
->
diag_bitmap
&
0x80000
)
VSLb
(
&
vsl
,
SLT_Debug
,
"lurker done: %p %u %u"
,
VSLb
(
vsl
,
SLT_Debug
,
"lurker done: %p %u %u"
,
oc
,
oc
->
flags
&
OC_F_LURK
,
pass
);
oc
,
oc
->
flags
&
OC_F_LURK
,
pass
);
(
void
)
HSH_Deref
(
&
wrk
->
stats
,
NULL
,
&
o
);
(
void
)
HSH_Deref
(
&
wrk
->
stats
,
NULL
,
&
o
);
VTIM_sleep
(
cache_param
->
ban_lurker_sleep
);
VTIM_sleep
(
cache_param
->
ban_lurker_sleep
);
...
@@ -918,7 +915,7 @@ ban_lurker_work(struct worker *wrk, unsigned pass)
...
@@ -918,7 +915,7 @@ ban_lurker_work(struct worker *wrk, unsigned pass)
VSC_C_main
->
bans_gone
++
;
VSC_C_main
->
bans_gone
++
;
}
}
if
(
cache_param
->
diag_bitmap
&
0x80000
)
if
(
cache_param
->
diag_bitmap
&
0x80000
)
VSLb
(
&
vsl
,
SLT_Debug
,
"lurker BAN %f now gone"
,
VSLb
(
vsl
,
SLT_Debug
,
"lurker BAN %f now gone"
,
ban_time
(
b
->
spec
));
ban_time
(
b
->
spec
));
}
}
Lck_Unlock
(
&
ban_mtx
);
Lck_Unlock
(
&
ban_mtx
);
...
@@ -934,8 +931,11 @@ ban_lurker(struct worker *wrk, void *priv)
...
@@ -934,8 +931,11 @@ ban_lurker(struct worker *wrk, void *priv)
{
{
struct
ban
*
bf
;
struct
ban
*
bf
;
unsigned
pass
=
(
1
<<
LURK_SHIFT
);
unsigned
pass
=
(
1
<<
LURK_SHIFT
);
struct
vsl_log
vsl
;
int
i
=
0
;
int
i
=
0
;
VSL_Setup
(
&
vsl
,
NULL
,
0
);
(
void
)
priv
;
(
void
)
priv
;
while
(
1
)
{
while
(
1
)
{
...
@@ -953,8 +953,8 @@ ban_lurker(struct worker *wrk, void *priv)
...
@@ -953,8 +953,8 @@ ban_lurker(struct worker *wrk, void *priv)
VTIM_sleep
(
1
.
0
);
VTIM_sleep
(
1
.
0
);
}
}
i
=
ban_lurker_work
(
wrk
,
pass
);
i
=
ban_lurker_work
(
wrk
,
&
vsl
,
pass
);
VSL_Flush
(
wrk
->
vsl
,
0
);
VSL_Flush
(
&
vsl
,
0
);
WRK_SumStat
(
wrk
);
WRK_SumStat
(
wrk
);
if
(
i
)
{
if
(
i
)
{
pass
+=
(
1
<<
LURK_SHIFT
);
pass
+=
(
1
<<
LURK_SHIFT
);
...
...
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