r4212 - trunk/varnish-cache/bin/varnishd
phk at projects.linpro.no
phk at projects.linpro.no
Thu Aug 27 01:01:06 CEST 2009
Author: phk
Date: 2009-08-27 01:01:06 +0200 (Thu, 27 Aug 2009)
New Revision: 4212
Modified:
trunk/varnish-cache/bin/varnishd/cache_ban.c
trunk/varnish-cache/bin/varnishd/cache_expire.c
trunk/varnish-cache/bin/varnishd/cache_hash.c
trunk/varnish-cache/bin/varnishd/storage_persistent.c
Log:
Fix an reference count issue relating to non-instantiated objects.
Modified: trunk/varnish-cache/bin/varnishd/cache_ban.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_ban.c 2009-08-26 21:13:16 UTC (rev 4211)
+++ trunk/varnish-cache/bin/varnishd/cache_ban.c 2009-08-26 23:01:06 UTC (rev 4212)
@@ -506,6 +506,7 @@
struct ban *b, *bf;
struct objcore *oc;
struct object *o;
+ int i;
(void)priv;
while (1) {
@@ -542,9 +543,10 @@
TIM_sleep(1.0);
continue;
}
+ AZ(oc->flags & OC_F_PERSISTENT);
o = oc->obj;
- (void)ban_check_object(o, sp, 0);
- WSP(sp, SLT_Debug, "lurker: %p %g", oc, o->ttl);
+ i = ban_check_object(o, sp, 0);
+ WSP(sp, SLT_Debug, "lurker: %p %g %d", oc, o->ttl, i);
HSH_Deref(sp->wrk, &o);
TIM_sleep(params->ban_lurker_sleep);
}
Modified: trunk/varnish-cache/bin/varnishd/cache_expire.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_expire.c 2009-08-26 21:13:16 UTC (rev 4211)
+++ trunk/varnish-cache/bin/varnishd/cache_expire.c 2009-08-26 23:01:06 UTC (rev 4212)
@@ -101,6 +101,7 @@
{
CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
+ CHECK_OBJ_NOTNULL(lrut, OBJCORE_MAGIC);
Lck_Lock(&exp_mtx);
assert(oc->timer_idx == BINHEAP_NOIDX);
@@ -260,7 +261,6 @@
continue;
}
-
/* It's time... */
CHECK_OBJ_NOTNULL(oc->objhead, OBJHEAD_MAGIC);
Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_hash.c 2009-08-26 21:13:16 UTC (rev 4211)
+++ trunk/varnish-cache/bin/varnishd/cache_hash.c 2009-08-26 23:01:06 UTC (rev 4212)
@@ -401,6 +401,7 @@
/* Insert (precreated) objcore in objecthead */
oc = w->nobjcore;
w->nobjcore = NULL;
+ CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
AZ(oc->flags & OC_F_BUSY);
/* XXX: Should this not be ..._HEAD now ? */
@@ -681,13 +682,13 @@
CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC);
Lck_Lock(&oh->mtx);
VTAILQ_FOREACH(oc2, &oh->objcs, list)
- if (oc1 == oc2) {
- oc1->obj->refcnt++;
+ if (oc1 == oc2)
break;
- }
if (oc2 != NULL && oc2->flags & OC_F_PERSISTENT)
SMP_Fixup(sp, oh, oc2);
- Lck_Unlock(&oc1->objhead->mtx);
+ if (oc2 != NULL)
+ oc2->obj->refcnt++;
+ Lck_Unlock(&oh->mtx);
*oc = oc2;
}
Modified: trunk/varnish-cache/bin/varnishd/storage_persistent.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/storage_persistent.c 2009-08-26 21:13:16 UTC (rev 4211)
+++ trunk/varnish-cache/bin/varnishd/storage_persistent.c 2009-08-26 23:01:06 UTC (rev 4212)
@@ -836,6 +836,7 @@
oc->ban = BAN_RefBan(oc, so->ban, sc->tailban);
memcpy(sp->wrk->nobjhead->digest, so->hash, SHA256_LEN);
(void)HSH_Insert(sp);
+ AZ(sp->wrk->nobjcore);
EXP_Inject(oc, sc->parent->lru_tail, so->ttl);
sg->nalloc++;
}
@@ -993,6 +994,7 @@
sc->flags |= SMP_F_LOADED;
BAN_Deref(&sc->tailban);
sc->tailban = NULL;
+ printf("Silo completely loaded\n");
while (1)
sleep (1);
return (NULL);
More information about the varnish-commit
mailing list