]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
lock entries during abort
authorwessels <>
Thu, 16 Apr 1998 23:47:27 +0000 (23:47 +0000)
committerwessels <>
Thu, 16 Apr 1998 23:47:27 +0000 (23:47 +0000)
src/store.cc

index 69d41be22cfee58399c7095ae6a10c2f8fdd9a81..7cee257a0095646491ab10e30dc4e9b59c9fecc2 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store.cc,v 1.403 1998/04/09 11:32:10 rousskov Exp $
+ * $Id: store.cc,v 1.404 1998/04/16 17:47:27 wessels Exp $
  *
  * DEBUG: section 20    Storage Manager
  * AUTHOR: Harvest Derived
@@ -561,6 +561,7 @@ storeAbort(StoreEntry * e, int cbflag)
     assert(e->store_status == STORE_PENDING);
     assert(mem != NULL);
     debug(20, 6) ("storeAbort: %s\n", storeKeyText(e->key));
+    storeLockObject(e);                /* lock while aborting */
     storeNegativeCache(e);
     storeReleaseRequest(e);
     e->store_status = STORE_ABORTED;
@@ -585,18 +586,17 @@ storeAbort(StoreEntry * e, int cbflag)
 #if USE_ASYNC_IO
     aioCancel(-1, e);
 #endif
-    if (e->swap_file_number == -1)
-       return;
+    if (e->swap_file_number > -1) {
 #if USE_ASYNC_IO
-    /* Need to cancel any pending ASYNC writes right now */
-    if (mem->swapout.fd >= 0)
-       aioCancel(mem->swapout.fd, NULL);
+       /* Need to cancel any pending ASYNC writes right now */
+       if (mem->swapout.fd >= 0)
+           aioCancel(mem->swapout.fd, NULL);
 #endif
-    /* but dont close if a disk write is queued, the handler will close up */
-    if (mem->swapout.queue_offset > mem->swapout.done_offset)
-       return;
-    /* we do */
-    storeSwapOutFileClose(e);
+       /* we have to close the disk file if there is no write pending */
+       if (mem->swapout.queue_offset == mem->swapout.done_offset)
+           storeSwapOutFileClose(e);
+    }
+    storeUnlockObject(e);      /* unlock */
 }
 
 /* Clear Memory storage to accommodate the given object len */
@@ -1131,8 +1131,8 @@ HttpReply *
 storeEntryReply(StoreEntry * e)
 {
     if (NULL == e)
-       return NULL;
+       return NULL;
     if (NULL == e->mem_obj)
-       return NULL;
+       return NULL;
     return e->mem_obj->reply;
 }