From: wessels <> Date: Sat, 26 Jun 1999 05:37:31 +0000 (+0000) Subject: STORE fixes and async cleanup from trying to get ASYNCUFS working X-Git-Tag: SQUID_3_0_PRE1~2135 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5bd1abacba84480cce6e2a5546e1cafee28d28b5;p=thirdparty%2Fsquid.git STORE fixes and async cleanup from trying to get ASYNCUFS working with FreeBSD 3.1. --- diff --git a/src/store_client.cc b/src/store_client.cc index e7568ecfa3..ee94b6b673 100644 --- a/src/store_client.cc +++ b/src/store_client.cc @@ -1,6 +1,6 @@ /* - * $Id: store_client.cc,v 1.72 1999/06/19 16:36:05 wessels Exp $ + * $Id: store_client.cc,v 1.73 1999/06/25 23:37:31 wessels Exp $ * * DEBUG: section 20 Storage Manager Client-Side Interface * AUTHOR: Duane Wessels @@ -303,7 +303,7 @@ storeClientFileRead(store_client * sc) } static void -storeClientReadBody(void *data, const char *buf, size_t len) +storeClientReadBody(void *data, const char *buf, ssize_t len) { store_client *sc = data; MemObject *mem = sc->entry->mem_obj; @@ -319,7 +319,7 @@ storeClientReadBody(void *data, const char *buf, size_t len) } static void -storeClientReadHeader(void *data, const char *buf, size_t len) +storeClientReadHeader(void *data, const char *buf, ssize_t len) { store_client *sc = data; StoreEntry *e = sc->entry; diff --git a/src/store_io.cc b/src/store_io.cc index 359c4e38fd..fcf6ae3696 100644 --- a/src/store_io.cc +++ b/src/store_io.cc @@ -14,7 +14,8 @@ void storeClose(storeIOState * sio) { SwapDir *SD = &Config.cacheSwap.swapDirs[sio->swap_file_number >> SWAP_DIR_SHIFT]; - assert(!sio->flags.closing); + if (sio->flags.closing) + return; sio->flags.closing = 1; SD->obj.close(sio); } diff --git a/src/store_swapin.cc b/src/store_swapin.cc index 7656daeaca..2d2f6d0d55 100644 --- a/src/store_swapin.cc +++ b/src/store_swapin.cc @@ -1,6 +1,6 @@ /* - * $Id: store_swapin.cc,v 1.18 1999/05/03 21:55:13 wessels Exp $ + * $Id: store_swapin.cc,v 1.19 1999/06/25 23:37:33 wessels Exp $ * * DEBUG: section 20 Storage Manager Swapin Functions * AUTHOR: Duane Wessels @@ -55,8 +55,15 @@ storeSwapInStart(StoreEntry * e) } debug(20, 3) ("storeSwapInStart: called for %08X %s \n", e->swap_file_number, storeKeyText(e->key)); - assert(e->swap_status == SWAPOUT_WRITING || e->swap_status == SWAPOUT_DONE); - assert(e->swap_file_number >= 0); + if (e->swap_status != SWAPOUT_WRITING && e->swap_status != SWAPOUT_DONE) { + debug(20, 1) ("storeSwapInStart: bad swap_status (%s)\n", + swapStatusStr[e->swap_status]); + return NULL; + } + if (e->swap_file_number < 0) { + debug(20, 1) ("storeSwapInStart: swap_file_number < 0\n"); + return NULL; + } assert(e->mem_obj != NULL); debug(20, 3) ("storeSwapInStart: Opening fileno %08X\n", e->swap_file_number); diff --git a/src/store_swapout.cc b/src/store_swapout.cc index 098e0dd0c3..6f574a963b 100644 --- a/src/store_swapout.cc +++ b/src/store_swapout.cc @@ -1,6 +1,6 @@ /* - * $Id: store_swapout.cc,v 1.54 1999/06/24 20:20:17 wessels Exp $ + * $Id: store_swapout.cc,v 1.55 1999/06/25 23:37:34 wessels Exp $ * * DEBUG: section 20 Storage Manager Swapout Functions * AUTHOR: Duane Wessels @@ -199,11 +199,10 @@ storeSwapOutFileClose(StoreEntry * e) MemObject *mem = e->mem_obj; assert(mem != NULL); debug(20, 3) ("storeSwapOutFileClose: %s\n", storeKeyText(e->key)); + debug(20, 3) ("storeSwapOutFileClose: sio = %p\n", mem->swapout.sio); if (mem->swapout.sio == NULL) return; storeClose(mem->swapout.sio); - mem->swapout.sio = NULL; - storeUnlockObject(e); } static void @@ -217,7 +216,6 @@ storeSwapOutFileClosed(void *data, int errflag, storeIOState * sio) if (errflag) { debug(20, 1) ("storeSwapOutFileClosed: swapfile %08X, errflag=%d\n\t%s\n", e->swap_file_number, errflag, xstrerror()); - storeDirMapBitReset(e->swap_file_number); /* * yuck. don't clear the filemap bit for some errors so that * we don't try re-using it over and over @@ -229,9 +227,9 @@ storeSwapOutFileClosed(void *data, int errflag, storeIOState * sio) storeDirConfigure(); storeConfigure(); } + storeReleaseRequest(e); e->swap_file_number = -1; e->swap_status = SWAPOUT_NONE; - return; } else { /* swapping complete */ debug(20, 3) ("storeSwapOutFileClosed: SwapOut complete: '%s' to %08X\n", @@ -247,7 +245,10 @@ storeSwapOutFileClosed(void *data, int errflag, storeIOState * sio) storeDirSwapLog(e, SWAP_LOG_ADD); } } + debug(20, 3) ("storeSwapOutFileClosed: %s:%d\n", __FILE__, __LINE__); + mem->swapout.sio = NULL; cbdataUnlock(sio); + storeUnlockObject(e); } /* diff --git a/src/typedefs.h b/src/typedefs.h index 34cc32c56a..8a49b43d8b 100644 --- a/src/typedefs.h +++ b/src/typedefs.h @@ -1,6 +1,6 @@ /* - * $Id: typedefs.h,v 1.95 1999/05/27 03:21:43 wessels Exp $ + * $Id: typedefs.h,v 1.96 1999/06/25 23:37:35 wessels Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -198,7 +198,7 @@ typedef void UH(void *data, wordlist *); typedef int DEFER(int fd, void *data); typedef void STIOCB(void *their_data, int errflag, storeIOState *); -typedef void STRCB(void *their_data, const char *buf, size_t len); +typedef void STRCB(void *their_data, const char *buf, ssize_t len); typedef void SIH(storeIOState *, void *); /* swap in */ typedef int QS(const void *, const void *); /* qsort */