From acf69d74918a4d3570274a4ffd8181445f334eb6 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Fri, 15 Oct 2010 04:24:57 -0600 Subject: [PATCH] Author: Alex Rousskov Bug 3002 pt2: store initialization (-z) does not work with SMP configs. In SMP mode, when -z command line option is specified, start kids and allow them to create their cache_dirs instead of trying to create macro-dependent cache_dirs in the Master process. In SMP mode, quit if cache_dir option is found before the workers option. --- src/cache_cf.cc | 12 ++++++++++++ src/cf.data.pre | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 0c8530f5f5..87ffbf5cb2 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1712,6 +1712,18 @@ find_fstype(char *type) static void parse_cachedir(SquidConfig::_cacheSwap * swap) { + // The workers option must preceed cache_dir for the IamWorkerProcess check + // below to work. TODO: Redo IamWorkerProcess to work w/o Config and remove + if (KidIdentifier > 1 && Config.workers == 1) { + debugs(3, DBG_CRITICAL, + "FATAL: cache_dir found before the workers option. Reorder."); + self_destruct(); + } + + // Among all processes, only workers may need and can handle cache_dir. + if (!IamWorkerProcess()) + return; + char *type_str; char *path_str; RefCount sd; diff --git a/src/cf.data.pre b/src/cf.data.pre index b9de3dbce2..b06bca8a4f 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -2499,6 +2499,10 @@ DOC_START The directory must exist and be writable by the Squid process. Squid will NOT create this directory for you. + In SMP configurations, cache_dir must not precede the workers option + and should use configuration macros or conditionals to give each + worker interested in disk caching a dedicated cache directory. + The ufs store type: "ufs" is the old well-known Squid storage format that has always -- 2.39.5