r5370 - trunk/varnish-cache/bin/varnishd
phk at varnish-cache.org
phk at varnish-cache.org
Thu Sep 30 12:05:56 CEST 2010
Author: phk
Date: 2010-09-30 12:05:55 +0200 (Thu, 30 Sep 2010)
New Revision: 5370
Modified:
trunk/varnish-cache/bin/varnishd/cache_hash.c
Log:
'hash_always_miss' should not modify the object it would have found
to expire now.
Reverse the order objects are inserted on the objhdr list to newest
first.
Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_hash.c 2010-09-30 09:52:11 UTC (rev 5369)
+++ trunk/varnish-cache/bin/varnishd/cache_hash.c 2010-09-30 10:05:55 UTC (rev 5370)
@@ -411,29 +411,20 @@
oc = grace_oc;
}
- if (oc != NULL) {
+ if (oc != NULL && !sp->hash_always_miss) {
o = oc->obj;
CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
assert(oc->objhead == oh);
- if(sp->hash_always_miss) {
- if (o->ttl >= sp->t_req) {
- o->ttl = sp->t_req - 1;
- o->grace = HSH_Grace(sp->grace);
- EXP_Rearm(o);
- }
- o = NULL;
- } else {
- /* We found an object we like */
- oc->refcnt++;
- if (o->hits < INT_MAX)
- o->hits++;
- assert(oh->refcnt > 1);
- Lck_Unlock(&oh->mtx);
- assert(hash->deref(oh));
- *poh = oh;
- return (oc);
- }
+ /* We found an object we like */
+ oc->refcnt++;
+ if (o->hits < INT_MAX)
+ o->hits++;
+ assert(oh->refcnt > 1);
+ Lck_Unlock(&oh->mtx);
+ assert(hash->deref(oh));
+ *poh = oh;
+ return (oc);
}
if (busy_oc != NULL && !sp->hash_ignore_busy) {
@@ -461,8 +452,7 @@
AN(oc->flags & OC_F_BUSY);
oc->refcnt = 1;
- /* XXX: Should this not be ..._HEAD now ? */
- VTAILQ_INSERT_TAIL(&oh->objcs, oc, list);
+ VTAILQ_INSERT_HEAD(&oh->objcs, oc, list);
oc->objhead = oh;
/* NB: do not deref objhead the new object inherits our reference */
Lck_Unlock(&oh->mtx);
More information about the varnish-commit
mailing list