]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: Alex Rousskov <rousskov@measurement-factory.com>
authorAmos Jeffries <amosjeffries@squid-cache.org>
Fri, 15 Oct 2010 10:24:57 +0000 (04:24 -0600)
committerAmos Jeffries <amosjeffries@squid-cache.org>
Fri, 15 Oct 2010 10:24:57 +0000 (04:24 -0600)
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
src/cf.data.pre

index 0c8530f5f5352b39307e8eef8c8149927a5ad9ea..87ffbf5cb2cf24207b4261695c31215791ac7d0d 100644 (file)
@@ -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<SwapDir> sd;
index b9de3dbce2c2ae4f0d7c036d92b959e2c7b2991e..b06bca8a4f3b52365e0e2aef0b00178e8a601101 100644 (file)
@@ -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