From: Andrew Deason Date: Mon, 7 Feb 2011 19:13:31 +0000 (-0600) Subject: viced: Enforce lwps limit for -L X-Git-Tag: openafs-devel-1_7_1~930 X-Git-Url: http://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=9315c66f15fb0d178e1c322cf14c0d64eea46c65 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. Change-Id: Ia9fc29855e74631509ea558cfe1b17fcf46e900e Reviewed-on: http://gerrit.openafs.org/3903 Tested-by: BuildBot Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- diff --git a/src/viced/viced.c b/src/viced/viced.c index 5f57f0d..50a259a 100644 --- a/src/viced/viced.c +++ b/src/viced/viced.c @@ -1089,6 +1089,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++) { @@ -1116,18 +1117,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) { @@ -1533,6 +1528,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 */