[prev in list] [next in list] [prev in thread] [next in thread]
List: squid-dev
Subject: Re: Various COSS minor problems (Repost with forgotten patch)
From: Guido Serassio <guido.serassio () acmeconsulting ! it>
Date: 2006-09-24 17:14:45
Message-ID: 6.2.5.6.2.20060924191357.044eb8d8 () acmeconsulting ! it
[Download RAW message or body]
Hi Adrian,
At 04.05 24/09/2006, Adrian Chadd wrote:
> > - During squid shutdown, storeCossDirShutdown() is never invoked,
> > because it's registered ad sd->freefs, this is executed from
> > configFreeMemory() only when LEAK_CHECK_MODE is defined, and after
> > storeCossDirDone(), this is the cache.log content:
> > 2006/09/23 14:29:19| aioSync: done
> > 2006/09/23 14:29:19| Open FD 24
> > /usr/local/squid/var/cache1/stripe
> > 2006/09/23 14:29:19| Squid Cache (Version 2.6.STABLE4-CVS): Exiting
> > normally.
> > This is easy to fix, because it was already fixed in old 2.6 Windows port.
>
>Ok, thankje.
This is the combined patch for the coss shutdown and for the missing
cache_swap_log configuration.
I'have also still some doubt about the coss memory release: please
someone knowing well coss could check the if the all needed
memPoolDestroy() are present in storecossDirDone() ?
Thanks
Regards
Guido
-
========================================================
Guido Serassio
Acme Consulting S.r.l. - Microsoft Certified Partner
Via Lucia Savarino, 1 10098 - Rivoli (TO) - ITALY
Tel. : +39.011.9530135 Fax. : +39.011.9781115
Email: guido.serassio@acmeconsulting.it
WWW: http://www.acmeconsulting.it/
["coss.patch" (application/octet-stream)]
Index: src/cf.data.pre
===================================================================
RCS file: /squid/squid/src/cf.data.pre,v
retrieving revision 1.371
diff -u -p -r1.371 cf.data.pre
--- src/cf.data.pre 22 Sep 2006 06:36:51 -0000 1.371
+++ src/cf.data.pre 24 Sep 2006 11:59:22 -0000
@@ -1062,10 +1062,13 @@ DOC_START
see the --enable-storeio configure option.
'Directory' is a top-level directory where cache swap
- files will be stored. If you want to use an entire disk
+ files will be stored. If you want to use an entire disk
for caching, this can be the mount-point directory.
The directory must exist and be writable by the Squid
- process. Squid will NOT create this directory for you.
+ process. Squid will NOT create this directory for you.
+ Only using COSS, a raw disk device or a stripe file can
+ be specified, but the configuration of the "cache_wap_log"
+ tag is mandatory.
The ufs store type:
Index: src/fs/coss/store_coss.h
===================================================================
RCS file: /squid/squid/src/fs/coss/store_coss.h,v
retrieving revision 1.13
diff -u -p -r1.13 store_coss.h
--- src/fs/coss/store_coss.h 23 Sep 2006 10:34:41 -0000 1.13
+++ src/fs/coss/store_coss.h 24 Sep 2006 11:59:22 -0000
@@ -22,6 +22,8 @@ typedef struct _cossstripe CossStripe;
#define COSS_ALLOC_ALLOCATE 1
#define COSS_ALLOC_REALLOC 2
+#define SWAPDIR_COSS "coss"
+
#if USE_AUFSOPS
/* XXX a hack; the async ops should be broken out! */
typedef void AIOCB(int fd, void *cbdata, const char *buf,
Index: src/fs/coss/store_dir_coss.c
===================================================================
RCS file: /squid/squid/src/fs/coss/store_dir_coss.c,v
retrieving revision 1.59
diff -u -p -r1.59 store_dir_coss.c
--- src/fs/coss/store_dir_coss.c 23 Sep 2006 10:34:41 -0000 1.59
+++ src/fs/coss/store_dir_coss.c 24 Sep 2006 11:59:23 -0000
@@ -50,7 +50,7 @@
int n_coss_dirs = 0;
int max_coss_dir_size = 0;
-/* static int last_coss_pick_index = -1; */
+static int last_coss_pick_index = -1;
int coss_initialised = 0;
MemPool *coss_state_pool = NULL;
MemPool *coss_index_pool = NULL;
@@ -137,7 +137,8 @@ stripePath(SwapDir * sd)
if (stat(sd->path, &st) == 0) {
if (S_ISDIR(st.st_mode))
strcat(pathtmp, "/stripe");
- }
+ } else
+ fatalf("stripePath: Cannot stat %s.", sd->path);
cs->stripe_path = xstrdup(pathtmp);
}
return cs->stripe_path;
@@ -150,6 +151,8 @@ storeCossDirSwapLogFile(SwapDir * sd, co
LOCAL_ARRAY(char, pathtmp, SQUID_MAXPATHLEN);
LOCAL_ARRAY(char, digit, 32);
char *pathtmp2;
+ struct stat st;
+
if (Config.Log.swap) {
xstrncpy(pathtmp, sd->path, SQUID_MAXPATHLEN - 64);
pathtmp2 = pathtmp;
@@ -165,8 +168,14 @@ storeCossDirSwapLogFile(SwapDir * sd, co
strncat(path, digit, 3);
}
} else {
- xstrncpy(path, sd->path, SQUID_MAXPATHLEN - 64);
- strcat(path, "/swap.state");
+ if (stat(sd->path, &st) == 0) {
+ if (S_ISDIR(st.st_mode)) {
+ xstrncpy(path, sd->path, SQUID_MAXPATHLEN - 64);
+ strcat(path, "/swap.state");
+ } else
+ fatal("storeCossDirSwapLogFile: 'cache_swap_log' is needed in your COSS configuration.");
+ } else
+ fatalf("storeCossDirSwapLogFile: Cannot stat %s.", sd->path);
}
if (ext)
strncat(path, ext, 16);
@@ -568,6 +577,24 @@ storeCossDirNewfs(SwapDir * sd)
debug(47, 3) ("Creating swap space in %s\n", stripePath(sd));
}
+/*
+ * Only "free" the filesystem specific stuff here
+ */
+static void
+storeCossDirFree(SwapDir * SD)
+{
+ CossInfo *cs = (CossInfo *) SD->fsdata;
+ if (cs->swaplog_fd > -1) {
+ file_close(cs->swaplog_fd);
+ cs->swaplog_fd = -1;
+ }
+ xfree(cs->stripes);
+ xfree(cs->memstripes);
+ xfree(cs);
+ SD->fsdata = NULL; /* Will aid debugging... */
+
+}
+
/* we are shutting down, flush all membufs to disk */
static void
storeCossDirShutdown(SwapDir * SD)
@@ -575,10 +602,7 @@ storeCossDirShutdown(SwapDir * SD)
CossInfo *cs = (CossInfo *) SD->fsdata;
debug(47, 1) ("COSS: %s: syncing\n", stripePath(SD));
-#if USE_AUFSOPS
- aioSync(SD);
-#endif
- storeCossSync(SD); /* This'll call a_file_syncqueue() */
+ storeCossSync(SD); /* This'll call a_file_syncqueue() or a aioSync() */
#if !USE_AUFSOPS
a_file_closequeue(&cs->aq);
#endif
@@ -746,7 +770,7 @@ storeCossDirParse(SwapDir * sd, int inde
sd->init = storeCossDirInit;
sd->newfs = storeCossDirNewfs;
sd->dump = storeCossDirDump;
- sd->freefs = storeCossDirShutdown;
+ sd->freefs = storeCossDirFree;
sd->dblcheck = NULL;
sd->statfs = storeCossDirStats;
sd->maintainfs = NULL;
@@ -1004,7 +1028,6 @@ storeCossDirDumpBlkSize(StoreEntry * e,
storeAppendPrintf(e, " block-size=%d", 1 << cs->blksz_bits);
}
-#if OLD_UNUSED_CODE
SwapDir *
storeCossDirPick(void)
{
@@ -1015,7 +1038,7 @@ storeCossDirPick(void)
return NULL;
for (i = 0; i < Config.cacheSwap.n_configured; i++) {
SD = &Config.cacheSwap.swapDirs[i];
- if (SD->type == SWAPDIR_COSS) {
+ if (strcmp(SD->type, SWAPDIR_COSS) == 0) {
if ((last_coss_pick_index == -1) || (n_coss_dirs == 1)) {
last_coss_pick_index = i;
return SD;
@@ -1029,7 +1052,7 @@ storeCossDirPick(void)
}
for (i = 0; i < Config.cacheSwap.n_configured; i++) {
SD = &Config.cacheSwap.swapDirs[i];
- if (SD->type == SWAPDIR_COSS) {
+ if (strcmp(SD->type, SWAPDIR_COSS) == 0) {
if ((last_coss_pick_index == -1) || (n_coss_dirs == 1)) {
last_coss_pick_index = i;
return SD;
@@ -1043,7 +1066,6 @@ storeCossDirPick(void)
}
return NULL;
}
-#endif
/*
* initial setup/done code
@@ -1051,6 +1073,10 @@ storeCossDirPick(void)
static void
storeCossDirDone(void)
{
+ int i, n_dirs = n_coss_dirs;
+
+ for (i = 0; i < n_dirs; i++)
+ storeCossDirShutdown(storeCossDirPick());
memPoolDestroy(coss_state_pool);
coss_initialised = 0;
}
@@ -1099,7 +1125,7 @@ storeFsSetup_coss(storefs_entry_t * stor
coss_index_pool = memPoolCreate("COSS index data", sizeof(CossIndexNode));
coss_realloc_pool = memPoolCreate("COSS pending realloc", sizeof(CossPendingReloc));
coss_op_pool = memPoolCreate("COSS pending operation", sizeof(CossReadOp));
- cachemgrRegister("coss", "COSS Stats", storeCossStats, 0, 1);
+ cachemgrRegister(SWAPDIR_COSS, "COSS Stats", storeCossStats, 0, 1);
coss_initialised = 1;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic