From: wessels <> Date: Thu, 16 Jul 1998 10:24:49 +0000 (+0000) Subject: We had a sort of a race condition problem. For object data in memory X-Git-Tag: SQUID_3_0_PRE1~3072 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3157c72f8cb89f8260d3024a1f1b127320303b73;p=thirdparty%2Fsquid.git We had a sort of a race condition problem. For object data in memory we were freeing up to the QUEUED offset instead of the DONE offset. This resulted in a chunk of the object which was not in memory and not yet written to disk. --- diff --git a/src/store_client.cc b/src/store_client.cc index 30e4ff40e4..12d98ef4ca 100644 --- a/src/store_client.cc +++ b/src/store_client.cc @@ -243,13 +243,16 @@ storeClientFileRead(store_client * sc) 0, storeClientReadHeader, sc); - else + else { + if (sc->entry->swap_status == SWAPOUT_WRITING) + assert(mem->swapout.done_offset > sc->copy_offset + mem->swap_hdr_sz); file_read(sc->swapin_fd, sc->copy_buf, sc->copy_size, sc->copy_offset + mem->swap_hdr_sz, storeClientReadBody, sc); + } sc->flags.disk_io_pending = 1; } diff --git a/src/store_swapout.cc b/src/store_swapout.cc index 40b28082f0..1099c6a43d 100644 --- a/src/store_swapout.cc +++ b/src/store_swapout.cc @@ -138,8 +138,19 @@ storeCheckSwapOut(StoreEntry * e) mem->inmem_lo = new_mem_lo; return; } +#if USE_QUEUE_OFFSET + /* + * This feels wrong. We should only free up to what we know + * has been written to disk, not what has been queued for + * writing. Otherwise there will be a chunk of the data which + * is not in memory and is not yet on disk. + */ if (mem->swapout.queue_offset < new_mem_lo) new_mem_lo = mem->swapout.queue_offset; +#else + if (mem->swapout.done_offset < new_mem_lo) + new_mem_lo = mem->swapout.done_offset; +#endif stmemFreeDataUpto(&mem->data_hdr, new_mem_lo); mem->inmem_lo = new_mem_lo;