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
98791be3
Commit
98791be3
authored
Jan 20, 2016
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
When we ref/deref busy oc's, act on struct boc instead of busyobj
parent
5efe0cda
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
30 deletions
+54
-30
cache_hash.c
bin/varnishd/cache/cache_hash.c
+25
-4
cache_req_fsm.c
bin/varnishd/cache/cache_req_fsm.c
+17
-15
hash_slinger.h
bin/varnishd/hash/hash_slinger.h
+2
-1
storage_simple.c
bin/varnishd/storage/storage_simple.c
+10
-10
No files found.
bin/varnishd/cache/cache_hash.c
View file @
98791be3
...
...
@@ -706,11 +706,12 @@ HSH_Ref(struct objcore *oc)
* Gain a reference on the busyobj, if the objcore has one
*/
struct
b
usyobj
*
struct
b
oc
*
HSH_RefBusy
(
const
struct
objcore
*
oc
)
{
struct
objhead
*
oh
;
struct
busyobj
*
bo
;
struct
boc
*
boc
=
NULL
;
CHECK_OBJ_NOTNULL
(
oc
,
OBJCORE_MAGIC
);
oh
=
oc
->
objhead
;
...
...
@@ -719,10 +720,30 @@ HSH_RefBusy(const struct objcore *oc)
assert
(
oc
->
refcnt
>
0
);
bo
=
oc
->
busyobj
;
CHECK_OBJ_ORNULL
(
bo
,
BUSYOBJ_MAGIC
);
if
(
bo
!=
NULL
)
bo
->
boc
->
refcount
++
;
if
(
bo
!=
NULL
)
{
CHECK_OBJ_NOTNULL
(
bo
->
boc
,
BOC_MAGIC
);
boc
=
bo
->
boc
;
assert
(
boc
->
busyobj
==
bo
);
boc
->
refcount
++
;
}
Lck_Unlock
(
&
oh
->
mtx
);
return
(
bo
);
return
(
boc
);
}
void
HSH_DerefBusy
(
struct
worker
*
wrk
,
struct
boc
**
pp
)
{
struct
boc
*
boc
;
struct
busyobj
*
bo
;
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
AN
(
pp
);
boc
=
*
pp
;
*
pp
=
NULL
;
CHECK_OBJ_NOTNULL
(
boc
,
BOC_MAGIC
);
CHECK_OBJ_NOTNULL
(
boc
->
busyobj
,
BUSYOBJ_MAGIC
);
bo
=
boc
->
busyobj
;
VBO_DerefBusyObj
(
wrk
,
&
bo
);
}
/*--------------------------------------------------------------------
...
...
bin/varnishd/cache/cache_req_fsm.c
View file @
98791be3
...
...
@@ -115,7 +115,7 @@ cnt_vdp(struct req *req, struct boc *boc)
static
enum
req_fsm_nxt
cnt_deliver
(
struct
worker
*
wrk
,
struct
req
*
req
)
{
struct
b
usyobj
*
bo
;
struct
b
oc
*
boc
;
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
...
...
@@ -197,21 +197,23 @@ cnt_deliver(struct worker *wrk, struct req *req)
http_PutResponse
(
req
->
resp
,
"HTTP/1.1"
,
304
,
NULL
);
/* Grab a ref to the bo if there is one, and hand it down */
bo
=
HSH_RefBusy
(
req
->
objcore
);
if
(
bo
!=
NULL
)
{
if
(
req
->
esi_level
==
0
&&
bo
->
bo
c
->
state
==
BOS_FINISHED
)
{
VBO_DerefBusyObj
(
wrk
,
&
bo
);
}
else
if
(
!
bo
->
do_stream
)
{
ObjWaitState
(
bo
->
bo
c
,
BOS_FINISHED
);
VBO_DerefBusyObj
(
wrk
,
&
bo
);
bo
c
=
HSH_RefBusy
(
req
->
objcore
);
if
(
bo
c
!=
NULL
)
{
if
(
req
->
esi_level
==
0
&&
boc
->
state
==
BOS_FINISHED
)
{
HSH_DerefBusy
(
wrk
,
&
boc
);
}
else
if
(
!
bo
c
->
busyobj
->
do_stream
)
{
ObjWaitState
(
boc
,
BOS_FINISHED
);
HSH_DerefBusy
(
wrk
,
&
boc
);
}
}
cnt_vdp
(
req
,
bo
==
NULL
?
NULL
:
bo
->
bo
c
);
cnt_vdp
(
req
,
boc
);
/* pass+streaming, abandon fetch in case delivery terminated early */
if
(
bo
!=
NULL
&&
req
->
objcore
->
flags
&
OC_F_PASS
)
bo
->
abandon
=
1
;
if
(
boc
!=
NULL
&&
req
->
objcore
->
flags
&
OC_F_PASS
)
{
CHECK_OBJ_NOTNULL
(
boc
->
busyobj
,
BUSYOBJ_MAGIC
);
boc
->
busyobj
->
abandon
=
1
;
}
VSLb_ts_req
(
req
,
"Resp"
,
W_TIM_real
(
wrk
));
...
...
@@ -219,13 +221,13 @@ cnt_deliver(struct worker *wrk, struct req *req)
req
->
doclose
=
SC_RESP_CLOSE
;
if
(
req
->
objcore
->
flags
&
(
OC_F_PRIVATE
|
OC_F_PASS
))
{
if
(
bo
!=
NULL
)
ObjWaitState
(
bo
->
bo
c
,
BOS_FINISHED
);
if
(
bo
c
!=
NULL
)
ObjWaitState
(
boc
,
BOS_FINISHED
);
ObjSlim
(
wrk
,
req
->
objcore
);
}
if
(
bo
!=
NULL
)
VBO_DerefBusyObj
(
wrk
,
&
bo
);
if
(
bo
c
!=
NULL
)
HSH_DerefBusy
(
wrk
,
&
boc
);
(
void
)
HSH_DerefObjCore
(
wrk
,
&
req
->
objcore
);
http_Teardown
(
req
->
resp
);
...
...
bin/varnishd/hash/hash_slinger.h
View file @
98791be3
...
...
@@ -72,7 +72,8 @@ void HSH_Insert(struct worker *, const void *hash, struct objcore *);
void
HSH_Purge
(
struct
worker
*
,
struct
objhead
*
,
double
ttl
,
double
grace
,
double
keep
);
void
HSH_config
(
const
char
*
h_arg
);
struct
busyobj
*
HSH_RefBusy
(
const
struct
objcore
*
oc
);
struct
boc
*
HSH_RefBusy
(
const
struct
objcore
*
);
void
HSH_DerefBusy
(
struct
worker
*
wrk
,
struct
boc
**
);
struct
objcore
*
HSH_Private
(
struct
worker
*
wrk
);
#ifdef VARNISH_CACHE_CHILD
...
...
bin/varnishd/storage/storage_simple.c
View file @
98791be3
...
...
@@ -227,7 +227,7 @@ static int __match_proto__(objiterate_f)
sml_iterator
(
struct
worker
*
wrk
,
struct
objcore
*
oc
,
void
*
priv
,
objiterate_f
*
func
)
{
struct
b
usyobj
*
bo
;
struct
b
oc
*
boc
;
struct
object
*
obj
;
struct
storage
*
st
;
struct
storage
*
checkpoint
=
NULL
;
...
...
@@ -243,9 +243,9 @@ sml_iterator(struct worker *wrk, struct objcore *oc,
obj
=
sml_getobj
(
wrk
,
oc
);
CHECK_OBJ_NOTNULL
(
obj
,
OBJECT_MAGIC
);
bo
=
HSH_RefBusy
(
oc
);
bo
c
=
HSH_RefBusy
(
oc
);
if
(
bo
==
NULL
)
{
if
(
bo
c
==
NULL
)
{
VTAILQ_FOREACH
(
st
,
&
obj
->
list
,
list
)
if
(
func
(
priv
,
0
,
st
->
ptr
,
st
->
len
))
return
(
-
1
);
...
...
@@ -257,17 +257,17 @@ sml_iterator(struct worker *wrk, struct objcore *oc,
while
(
1
)
{
ol
=
len
;
nl
=
ObjWaitExtend
(
wrk
,
oc
,
bo
->
bo
c
,
ol
);
if
(
bo
->
bo
c
->
state
==
BOS_FAILED
)
{
nl
=
ObjWaitExtend
(
wrk
,
oc
,
boc
,
ol
);
if
(
boc
->
state
==
BOS_FAILED
)
{
ret
=
-
1
;
break
;
}
if
(
nl
==
ol
)
{
if
(
bo
->
bo
c
->
state
==
BOS_FINISHED
)
if
(
boc
->
state
==
BOS_FINISHED
)
break
;
continue
;
}
Lck_Lock
(
&
bo
->
bo
c
->
mtx
);
Lck_Lock
(
&
boc
->
mtx
);
AZ
(
VTAILQ_EMPTY
(
&
obj
->
list
));
if
(
checkpoint
==
NULL
)
{
st
=
VTAILQ_FIRST
(
&
obj
->
list
);
...
...
@@ -300,14 +300,14 @@ sml_iterator(struct worker *wrk, struct objcore *oc,
st
=
VTAILQ_NEXT
(
st
,
list
);
if
(
st
!=
NULL
&&
st
->
len
==
0
)
st
=
NULL
;
Lck_Unlock
(
&
bo
->
bo
c
->
mtx
);
assert
(
l
>
0
||
bo
->
bo
c
->
state
==
BOS_FINISHED
);
Lck_Unlock
(
&
boc
->
mtx
);
assert
(
l
>
0
||
boc
->
state
==
BOS_FINISHED
);
if
(
func
(
priv
,
st
!=
NULL
?
0
:
1
,
p
,
l
))
{
ret
=
-
1
;
break
;
}
}
VBO_DerefBusyObj
(
wrk
,
&
bo
);
HSH_DerefBusy
(
wrk
,
&
boc
);
return
(
ret
);
}
...
...
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