Commit 21e0139e authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

More paranoia in the fetch processor.

parent 9d2730de
...@@ -100,12 +100,12 @@ VFP_GetStorage(struct busyobj *bo, ssize_t sz) ...@@ -100,12 +100,12 @@ VFP_GetStorage(struct busyobj *bo, ssize_t sz)
st = STV_alloc(bo, l); st = STV_alloc(bo, l);
if (st == NULL) { if (st == NULL) {
(void)VFP_Error(bo, "Could not get storage"); (void)VFP_Error(bo, "Could not get storage");
return (NULL); } else {
}
AZ(st->len); AZ(st->len);
Lck_Lock(&bo->mtx); Lck_Lock(&bo->mtx);
VTAILQ_INSERT_TAIL(&obj->store, st, list); VTAILQ_INSERT_TAIL(&obj->store, st, list);
Lck_Unlock(&bo->mtx); Lck_Unlock(&bo->mtx);
}
return (st); return (st);
} }
...@@ -201,35 +201,32 @@ VFP_Fetch_Body(struct busyobj *bo, ssize_t est) ...@@ -201,35 +201,32 @@ VFP_Fetch_Body(struct busyobj *bo, ssize_t est)
} }
do { do {
assert(bo->state != BOS_FAILED);
if (st == NULL) { if (st == NULL) {
l = fetchfrag; st = VFP_GetStorage(bo, est);
if (l == 0) {
l = est;
est = 0; est = 0;
} }
if (l == 0)
l = cache_param->fetch_chunksize;
st = STV_alloc(bo, l);
if (st == NULL) { if (st == NULL) {
bo->should_close = 1; bo->should_close = 1;
/* XXX Close VFP stack */
(void)VFP_Error(bo, "Out of storage"); (void)VFP_Error(bo, "Out of storage");
break; break;
} }
AZ(st->len);
Lck_Lock(&bo->mtx); CHECK_OBJ_NOTNULL(st, STORAGE_MAGIC);
VTAILQ_INSERT_TAIL(&bo->fetch_obj->store, st, list); assert(st == VTAILQ_LAST(&bo->fetch_obj->store, storagehead));
Lck_Unlock(&bo->mtx);
}
l = st->space - st->len; l = st->space - st->len;
assert(bo->state != BOS_FAILED);
vfps = VFP_Suck(bo, st->ptr + st->len, &l); vfps = VFP_Suck(bo, st->ptr + st->len, &l);
if (l > 0) if (l > 0 && vfps != VFP_ERROR) {
assert(!VTAILQ_EMPTY(&bo->fetch_obj->store));
VBO_extend(bo, l); VBO_extend(bo, l);
}
if (st->len == st->space) if (st->len == st->space)
st = NULL; st = NULL;
} while (vfps == VFP_OK); } while (vfps == VFP_OK);
if (vfps == VFP_ERROR) { if (vfps == VFP_ERROR) {
assert(bo->state == BOS_FAILED);
(void)VFP_Error(bo, "Fetch Pipeline failed to process"); (void)VFP_Error(bo, "Fetch Pipeline failed to process");
bo->should_close = 1; bo->should_close = 1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment