[master] 27c7ff0 Snapshot obj->st->len so it staus consistent in the loop.
Poul-Henning Kamp
phk at varnish-cache.org
Tue Nov 5 23:05:05 CET 2013
commit 27c7ff03ceb4a00811bfa546ee7e176bb880b182
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Nov 5 22:04:38 2013 +0000
Snapshot obj->st->len so it staus consistent in the loop.
diff --git a/bin/varnishd/cache/cache_obj.c b/bin/varnishd/cache/cache_obj.c
index 739d7ab..5b3dab9 100644
--- a/bin/varnishd/cache/cache_obj.c
+++ b/bin/varnishd/cache/cache_obj.c
@@ -63,6 +63,7 @@ ObjIter(struct objiter *oi, void **p, ssize_t *l)
{
ssize_t ol;
ssize_t nl;
+ volatile unsigned u;
CHECK_OBJ_NOTNULL(oi, OBJITER_MAGIC);
CHECK_OBJ_NOTNULL(oi->obj, OBJECT_MAGIC);
@@ -97,14 +98,15 @@ ObjIter(struct objiter *oi, void **p, ssize_t *l)
Lck_Lock(&oi->bo->mtx);
AZ(VTAILQ_EMPTY(&oi->obj->store));
VTAILQ_FOREACH(oi->st, &oi->obj->store, list) {
- if (oi->st->len > ol) {
+ u = (volatile unsigned)(oi->st->len);
+ if (u > ol) {
*p = oi->st->ptr + ol;
- *l = oi->st->len - ol;
+ *l = u - ol;
oi->len += *l;
break;
}
- ol -= oi->st->len;
- nl -= oi->st->len;
+ ol -= u;
+ nl -= u;
}
CHECK_OBJ_NOTNULL(oi->obj, OBJECT_MAGIC);
CHECK_OBJ_NOTNULL(oi->st, STORAGE_MAGIC);
More information about the varnish-commit
mailing list