]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Keep anchor.basics.swap_file_sz in sync with slice sizes.
authorAlex Rousskov <rousskov@measurement-factory.com>
Sat, 27 Jul 2013 17:19:29 +0000 (11:19 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Sat, 27 Jul 2013 17:19:29 +0000 (11:19 -0600)
The old code updated anchor.basics.swap_file_sz _after_ copying all of the
available data into shared memory. An exception in the copying loop (e.g., the
map is out of available slots) could prevent that update. For another worker,
the entry would then appear to be fully completed (no writer, last slice size
stable, and last slice poiner is -1) and that worker would assert due to
anchor.basics.swap_file_sz mismatching the sum of slice sizes.

src/MemStore.cc

index 1cdf3a100d081ac33bb48b7155abe7145f284ce1..116ba0651a96c45e07c97d25515d65b5343a11d1 100644 (file)
@@ -534,7 +534,6 @@ MemStore::copyToShm(StoreEntry &e)
          copyToShmSlice(e, anchor);
     }
 
-    anchor.basics.swap_file_sz = e.mem_obj->memCache.offset;
     debugs(20, 7, "mem-cached available " << eSize << " bytes of " << e);
 }
 
@@ -569,6 +568,7 @@ MemStore::copyToShmSlice(StoreEntry &e, Ipc::StoreMapAnchor &anchor)
 
     slice.size += copied;
     e.mem_obj->memCache.offset += copied;
+    anchor.basics.swap_file_sz = e.mem_obj->memCache.offset;
 }
 
 /// finds a slot and a free page to fill or throws