]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
We had a sort of a race condition problem. For object data in memory
authorwessels <>
Thu, 16 Jul 1998 10:24:49 +0000 (10:24 +0000)
committerwessels <>
Thu, 16 Jul 1998 10:24:49 +0000 (10:24 +0000)
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.

src/store_client.cc
src/store_swapout.cc

index 30e4ff40e439ec7e0346820cd53fdf9c9fa01507..12d98ef4cae1dd972be777cc01703b6f061c82a5 100644 (file)
@@ -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;
 }
 
index 40b28082f0db3c780325519d601cd0a1dd49ddda..1099c6a43dc7bdc686a314324448eb11646867b4 100644 (file)
@@ -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;