[master] 0041032 Let the body-fetching thread Unbusy the object.
Poul-Henning Kamp
phk at varnish-cache.org
Mon Mar 12 23:45:28 CET 2012
commit 0041032c2b01f865ed83adcf94e8789a3f31e2ce
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Mar 12 22:45:04 2012 +0000
Let the body-fetching thread Unbusy the object.
diff --git a/bin/varnishd/cache/cache_center.c b/bin/varnishd/cache/cache_center.c
index 9f69bfa..bc22656 100644
--- a/bin/varnishd/cache/cache_center.c
+++ b/bin/varnishd/cache/cache_center.c
@@ -929,13 +929,6 @@ cnt_fetchbody(struct sess *sp, struct worker *wrk, struct req *req)
return (0);
}
- if (req->obj->objcore != NULL) {
- EXP_Insert(req->obj);
- AN(req->obj->objcore);
- AN(req->obj->objcore->ban);
- AZ(req->obj->ws_o->overflow);
- HSH_Unbusy(&wrk->stats, req->obj->objcore);
- }
VBO_DerefBusyObj(wrk, &req->busyobj);
wrk->acct_tmp.fetch++;
sp->step = STP_PREPRESP;
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index feebd9b..968db87 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -35,6 +35,8 @@
#include "cache.h"
+#include "hash/hash_slinger.h"
+
#include "cache_backend.h"
#include "vcli_priv.h"
#include "vct.h"
@@ -674,13 +676,22 @@ FetchBody(struct worker *wrk, void *priv)
"Content-Length: %zd", obj->len);
}
- bo->state = BOS_FINISHED;
if (cls)
VDI_CloseFd(&bo->vbc);
else
VDI_RecycleFd(&bo->vbc);
+ if (obj->objcore != NULL) {
+ EXP_Insert(obj);
+ AN(obj->objcore->ban);
+ AZ(obj->ws_o->overflow);
+ HSH_Unbusy(&wrk->stats, obj->objcore);
+ }
+
+ /* XXX: Atomic assignment, needs volatile/membar ? */
+ bo->state = BOS_FINISHED;
+
}
bo->stats = NULL;
VBO_DerefBusyObj(wrk, &bo);
More information about the varnish-commit
mailing list