]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
viced: Enforce lwps limit for -L
authorAndrew Deason <adeason@sinenomine.net>
Mon, 7 Feb 2011 19:13:31 +0000 (13:13 -0600)
committerDerrick Brashear <shadow@dementia.org>
Sun, 27 Feb 2011 15:09:32 +0000 (07:09 -0800)
Previously, we only enforced the calculated lwp/thread maximum when
the -p argument was specified. When -L was specified, we set lwps to
128, which can be over the max of (effectively)
MAX_FILESERVER_THREAD-FILESERVER_HELPER_THREADS, depending on the
value of MAX_FILESERVER_THREAD.

Instead, enforce the lwps min/max after all code to set the lwps has
run.

Reviewed-on: http://gerrit.openafs.org/3903
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 9315c66f15fb0d178e1c322cf14c0d64eea46c65)

Change-Id: Ia1fed73cc3f227b2bba2c1a66de86b67b58139ce
Reviewed-on: http://gerrit.openafs.org/4083
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
src/viced/viced.c

index afb7bfb5e4802c3feb215ad1572261b01789900a..a5017cc28b398b740bf494d1c95fcc020854c3c3 100644 (file)
@@ -1085,6 +1085,7 @@ ParseArgs(int argc, char *argv[])
     int Sawbusy = 0;
     int i;
     int bufSize = 0;           /* temp variable to read in udp socket buf size */
+    int lwps_max;
     char *auditFileName = NULL;
 
     for (i = 1; i < argc; i++) {
@@ -1112,18 +1113,12 @@ ParseArgs(int argc, char *argv[])
        } else if (!strcmp(argv[i], "-S")) {
            SawS = 1;
        } else if (!strcmp(argv[i], "-p")) {
-           int lwps_max =
-               max_fileserver_thread() - FILESERVER_HELPER_THREADS;
            Sawlwps = 1;
             if ((i + 1) >= argc) {
                fprintf(stderr, "missing argument for -p\n");
                return -1;
            }
            lwps = atoi(argv[++i]);
-           if (lwps > lwps_max)
-               lwps = lwps_max;
-           else if (lwps < 6)
-               lwps = 6;
        } else if (!strcmp(argv[i], "-b")) {
            Sawbufs = 1;
             if ((i + 1) >= argc) {
@@ -1484,6 +1479,12 @@ ParseArgs(int argc, char *argv[])
     if (auditFileName)
        osi_audit_file(auditFileName);
 
+    lwps_max = max_fileserver_thread() - FILESERVER_HELPER_THREADS;
+    if (lwps > lwps_max)
+       lwps = lwps_max;
+    else if (lwps < 6)
+       lwps = 6;
+
     return (0);
 
 }                              /*ParseArgs */