From 9fe452316ed225a176ea63f41b34a6e15d6ed51a Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Mon, 7 Feb 2011 13:13:31 -0600 Subject: [PATCH] viced: Enforce lwps limit for -L 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 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear (cherry picked from commit 9315c66f15fb0d178e1c322cf14c0d64eea46c65) Change-Id: Ia1fed73cc3f227b2bba2c1a66de86b67b58139ce Reviewed-on: http://gerrit.openafs.org/4083 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- src/viced/viced.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/viced/viced.c b/src/viced/viced.c index afb7bfb5e..a5017cc28 100644 --- a/src/viced/viced.c +++ b/src/viced/viced.c @@ -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 */ -- 2.39.5