summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2011-08-16 11:07:27 -0400
committerSimo Sorce <idra@samba.org>2011-08-21 09:05:05 -0400
commitdf6f320aa47026bbf589a3276a0708ea3f93504b (patch)
tree37d5b377387992e62e401568e9b273df72f309be
parente3736f826b434bcdff5493fc533c11eba9bedc61 (diff)
downloadsamba-df6f320aa47026bbf589a3276a0708ea3f93504b.tar.gz
samba-df6f320aa47026bbf589a3276a0708ea3f93504b.tar.bz2
samba-df6f320aa47026bbf589a3276a0708ea3f93504b.zip
s3-prefrok: Handle only valid children
Children that are about to exit shouldn't be counted as a source of connections, and also makes no sense to chenge their allowances if they are about to exit. Also children with negative num_clients are faulty, exclude them as well. Signed-off-by: Andreas Schneider <asn@samba.org> Signed-off-by: Simo Sorce <idra@samba.org>
-rw-r--r--source3/lib/server_prefork.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/source3/lib/server_prefork.c b/source3/lib/server_prefork.c
index 7d675485a0..71441c3303 100644
--- a/source3/lib/server_prefork.c
+++ b/source3/lib/server_prefork.c
@@ -292,7 +292,7 @@ int prefork_count_active_children(struct prefork_pool *pfp, int *total)
t++;
- if (pfp->pool[i].num_clients == 0) {
+ if (pfp->pool[i].num_clients <= 0) {
continue;
}
@@ -343,7 +343,12 @@ int prefork_count_allowed_connections(struct prefork_pool *pfp)
c = 0;
for (i = 0; i < pfp->pool_size; i++) {
- if (pfp->pool[i].status == PF_WORKER_NONE) {
+ if (pfp->pool[i].status == PF_WORKER_NONE ||
+ pfp->pool[i].status == PF_WORKER_EXITING) {
+ continue;
+ }
+
+ if (pfp->pool[i].num_clients < 0) {
continue;
}
@@ -358,7 +363,12 @@ void prefork_increase_allowed_clients(struct prefork_pool *pfp, int max)
int i;
for (i = 0; i < pfp->pool_size; i++) {
- if (pfp->pool[i].status == PF_WORKER_NONE) {
+ if (pfp->pool[i].status == PF_WORKER_NONE ||
+ pfp->pool[i].status == PF_WORKER_EXITING) {
+ continue;
+ }
+
+ if (pfp->pool[i].num_clients < 0) {
continue;
}
@@ -373,7 +383,12 @@ void prefork_decrease_allowed_clients(struct prefork_pool *pfp)
int i;
for (i = 0; i < pfp->pool_size; i++) {
- if (pfp->pool[i].status == PF_WORKER_NONE) {
+ if (pfp->pool[i].status == PF_WORKER_NONE ||
+ pfp->pool[i].status == PF_WORKER_EXITING) {
+ continue;
+ }
+
+ if (pfp->pool[i].num_clients < 0) {
continue;
}