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
e6327393
Commit
e6327393
authored
Feb 19, 2012
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Eliminate the ban-lurkers need for struct sess
parent
219aa029
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
19 deletions
+15
-19
cache_ban.c
bin/varnishd/cache/cache_ban.c
+15
-19
No files found.
bin/varnishd/cache/cache_ban.c
View file @
e6327393
...
@@ -677,16 +677,17 @@ ban_evaluate(const uint8_t *bs, const struct http *objhttp,
...
@@ -677,16 +677,17 @@ ban_evaluate(const uint8_t *bs, const struct http *objhttp,
*/
*/
static
int
static
int
ban_check_object
(
struct
object
*
o
,
const
struct
sess
*
sp
,
int
has_req
)
ban_check_object
(
struct
object
*
o
,
struct
worker
*
wrk
,
const
struct
http
*
req_http
)
{
{
struct
ban
*
b
;
struct
ban
*
b
;
struct
objcore
*
oc
;
struct
objcore
*
oc
;
struct
ban
*
volatile
b0
;
struct
ban
*
volatile
b0
;
unsigned
tests
,
skipped
;
unsigned
tests
,
skipped
;
struct
http
*
http
;
CHECK_OBJ_NOTNULL
(
sp
,
SESS_MAGIC
);
CHECK_OBJ_NOTNULL
(
o
,
OBJECT_MAGIC
);
CHECK_OBJ_NOTNULL
(
o
,
OBJECT_MAGIC
);
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_ORNULL
(
req_http
,
HTTP_MAGIC
);
oc
=
o
->
objcore
;
oc
=
o
->
objcore
;
CHECK_OBJ_NOTNULL
(
oc
,
OBJCORE_MAGIC
);
CHECK_OBJ_NOTNULL
(
oc
,
OBJCORE_MAGIC
);
CHECK_OBJ_NOTNULL
(
oc
->
ban
,
BAN_MAGIC
);
CHECK_OBJ_NOTNULL
(
oc
->
ban
,
BAN_MAGIC
);
...
@@ -697,11 +698,6 @@ ban_check_object(struct object *o, const struct sess *sp, int has_req)
...
@@ -697,11 +698,6 @@ ban_check_object(struct object *o, const struct sess *sp, int has_req)
if
(
b0
==
oc
->
ban
)
if
(
b0
==
oc
->
ban
)
return
(
0
);
return
(
0
);
if
(
has_req
)
http
=
sp
->
req
->
http
;
else
http
=
NULL
;
/*
/*
* This loop is safe without locks, because we know we hold
* This loop is safe without locks, because we know we hold
* a refcount on a ban somewhere in the list and we do not
* a refcount on a ban somewhere in the list and we do not
...
@@ -719,13 +715,13 @@ ban_check_object(struct object *o, const struct sess *sp, int has_req)
...
@@ -719,13 +715,13 @@ ban_check_object(struct object *o, const struct sess *sp, int has_req)
/* Lurker already tested this */
/* Lurker already tested this */
continue
;
continue
;
}
}
if
(
!
has_req
&&
(
b
->
flags
&
BAN_F_REQ
))
{
if
(
req_http
==
NULL
&&
(
b
->
flags
&
BAN_F_REQ
))
{
/*
/*
* We cannot test this one, but there might
* We cannot test this one, but there might
* be other bans that match, so we soldier on
* be other bans that match, so we soldier on
*/
*/
skipped
++
;
skipped
++
;
}
else
if
(
ban_evaluate
(
b
->
spec
,
o
->
http
,
http
,
&
tests
))
}
else
if
(
ban_evaluate
(
b
->
spec
,
o
->
http
,
req_
http
,
&
tests
))
break
;
break
;
}
}
...
@@ -734,7 +730,7 @@ ban_check_object(struct object *o, const struct sess *sp, int has_req)
...
@@ -734,7 +730,7 @@ ban_check_object(struct object *o, const struct sess *sp, int has_req)
VSC_C_main
->
bans_tests_tested
+=
tests
;
VSC_C_main
->
bans_tests_tested
+=
tests
;
if
(
b
==
oc
->
ban
&&
skipped
>
0
)
{
if
(
b
==
oc
->
ban
&&
skipped
>
0
)
{
AZ
(
has_req
);
AZ
(
req_http
);
Lck_Unlock
(
&
ban_mtx
);
Lck_Unlock
(
&
ban_mtx
);
/*
/*
* Not banned, but some tests were skipped, so we cannot know
* Not banned, but some tests were skipped, so we cannot know
...
@@ -762,7 +758,7 @@ ban_check_object(struct object *o, const struct sess *sp, int has_req)
...
@@ -762,7 +758,7 @@ ban_check_object(struct object *o, const struct sess *sp, int has_req)
oc_updatemeta
(
oc
);
oc_updatemeta
(
oc
);
/* BAN also changed, but that is not important any more */
/* BAN also changed, but that is not important any more */
/* XXX: no req in lurker */
/* XXX: no req in lurker */
VSLb
(
sp
->
wrk
->
vsl
,
SLT_ExpBan
,
"%u was banned"
,
o
->
xid
);
VSLb
(
wrk
->
vsl
,
SLT_ExpBan
,
"%u was banned"
,
o
->
xid
);
EXP_Rearm
(
o
);
EXP_Rearm
(
o
);
return
(
1
);
return
(
1
);
}
}
...
@@ -772,7 +768,7 @@ int
...
@@ -772,7 +768,7 @@ int
BAN_CheckObject
(
struct
object
*
o
,
const
struct
sess
*
sp
)
BAN_CheckObject
(
struct
object
*
o
,
const
struct
sess
*
sp
)
{
{
return
(
ban_check_object
(
o
,
sp
,
1
)
>
0
);
return
(
ban_check_object
(
o
,
sp
->
wrk
,
sp
->
req
->
http
)
>
0
);
}
}
static
struct
ban
*
static
struct
ban
*
...
@@ -800,8 +796,8 @@ ban_CheckLast(void)
...
@@ -800,8 +796,8 @@ ban_CheckLast(void)
* Ban lurker thread
* Ban lurker thread
*/
*/
static
int
__match_proto__
(
bgthread_t
)
static
int
ban_lurker_work
(
const
struct
sess
*
sp
,
unsigned
pass
)
ban_lurker_work
(
struct
worker
*
wrk
,
unsigned
pass
)
{
{
struct
ban
*
b
,
*
b0
,
*
b2
;
struct
ban
*
b
,
*
b0
,
*
b2
;
struct
objhead
*
oh
;
struct
objhead
*
oh
;
...
@@ -892,8 +888,8 @@ ban_lurker_work(const struct sess *sp, unsigned pass)
...
@@ -892,8 +888,8 @@ ban_lurker_work(const struct sess *sp, 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
(
&
sp
->
wrk
->
stats
,
oc
);
o
=
oc_getobj
(
&
wrk
->
stats
,
oc
);
i
=
ban_check_object
(
o
,
sp
,
0
);
i
=
ban_check_object
(
o
,
wrk
,
NULL
);
if
(
cache_param
->
diag_bitmap
&
0x80000
)
if
(
cache_param
->
diag_bitmap
&
0x80000
)
VSL
(
SLT_Debug
,
0
,
"lurker got: %p %d"
,
VSL
(
SLT_Debug
,
0
,
"lurker got: %p %d"
,
oc
,
i
);
oc
,
i
);
...
@@ -909,7 +905,7 @@ ban_lurker_work(const struct sess *sp, unsigned pass)
...
@@ -909,7 +905,7 @@ ban_lurker_work(const struct sess *sp, unsigned pass)
if
(
cache_param
->
diag_bitmap
&
0x80000
)
if
(
cache_param
->
diag_bitmap
&
0x80000
)
VSL
(
SLT_Debug
,
0
,
"lurker done: %p %u %u"
,
VSL
(
SLT_Debug
,
0
,
"lurker done: %p %u %u"
,
oc
,
oc
->
flags
&
OC_F_LURK
,
pass
);
oc
,
oc
->
flags
&
OC_F_LURK
,
pass
);
(
void
)
HSH_Deref
(
&
sp
->
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
);
}
}
Lck_AssertHeld
(
&
ban_mtx
);
Lck_AssertHeld
(
&
ban_mtx
);
...
@@ -954,7 +950,7 @@ ban_lurker(struct sess *sp, void *priv)
...
@@ -954,7 +950,7 @@ ban_lurker(struct sess *sp, void *priv)
VTIM_sleep
(
1
.
0
);
VTIM_sleep
(
1
.
0
);
}
}
i
=
ban_lurker_work
(
sp
,
pass
);
i
=
ban_lurker_work
(
sp
->
wrk
,
pass
);
VSL_Flush
(
sp
->
wrk
->
vsl
,
0
);
VSL_Flush
(
sp
->
wrk
->
vsl
,
0
);
WRK_SumStat
(
sp
->
wrk
);
WRK_SumStat
(
sp
->
wrk
);
if
(
i
)
{
if
(
i
)
{
...
...
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