mirror of
https://github.com/samba-team/samba.git
synced 2025-08-04 08:22:08 +03:00
s3-prefork: Add parent->client messaging
Signed-off-by: Andreas Schneider <asn@samba.org> Signed-off-by: Simo Sorce <idra@samba.org>
This commit is contained in:
@ -19,6 +19,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
|
#include "serverid.h"
|
||||||
|
#include "messages.h"
|
||||||
#include "system/time.h"
|
#include "system/time.h"
|
||||||
#include "system/shmem.h"
|
#include "system/shmem.h"
|
||||||
#include "system/filesys.h"
|
#include "system/filesys.h"
|
||||||
@ -423,6 +425,23 @@ void prefork_send_signal_to_all(struct prefork_pool *pfp, int signal_num)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void prefork_warn_active_children(struct messaging_context *msg_ctx,
|
||||||
|
struct prefork_pool *pfp)
|
||||||
|
{
|
||||||
|
const DATA_BLOB ping = data_blob_null;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < pfp->pool_size; i++) {
|
||||||
|
if (pfp->pool[i].status == PF_WORKER_NONE) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
messaging_send(msg_ctx,
|
||||||
|
pid_to_procid(pfp->pool[i].pid),
|
||||||
|
MSG_PREFORK_PARENT_EVENT, &ping);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void prefork_sigchld_handler(struct tevent_context *ev_ctx,
|
static void prefork_sigchld_handler(struct tevent_context *ev_ctx,
|
||||||
struct tevent_signal *se,
|
struct tevent_signal *se,
|
||||||
int signum, int count,
|
int signum, int count,
|
||||||
|
@ -225,6 +225,16 @@ void prefork_reset_allowed_clients(struct prefork_pool *pfp);
|
|||||||
*/
|
*/
|
||||||
void prefork_send_signal_to_all(struct prefork_pool *pfp, int signal_num);
|
void prefork_send_signal_to_all(struct prefork_pool *pfp, int signal_num);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Send a message to all children that the server changed something
|
||||||
|
* in the pool and they may want to take action.
|
||||||
|
*
|
||||||
|
* @param msg_ctx The messaging context.
|
||||||
|
* @param pfp The pool.
|
||||||
|
*/
|
||||||
|
void prefork_warn_active_children(struct messaging_context *msg_ctx,
|
||||||
|
struct prefork_pool *pfp);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sets the SIGCHLD callback
|
* @brief Sets the SIGCHLD callback
|
||||||
*
|
*
|
||||||
|
@ -67,6 +67,7 @@ void pfh_manage_pool(struct tevent_context *ev_ctx,
|
|||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
int total, avail;
|
int total, avail;
|
||||||
int ret, n;
|
int ret, n;
|
||||||
|
bool msg = false;
|
||||||
|
|
||||||
if ((cfg->prefork_status & PFH_NEW_MAX) &&
|
if ((cfg->prefork_status & PFH_NEW_MAX) &&
|
||||||
!(cfg->prefork_status & PFH_ENOSPC)) {
|
!(cfg->prefork_status & PFH_ENOSPC)) {
|
||||||
@ -119,6 +120,7 @@ void pfh_manage_pool(struct tevent_context *ev_ctx,
|
|||||||
if (n == avail) break;
|
if (n == avail) break;
|
||||||
n = avail;
|
n = avail;
|
||||||
}
|
}
|
||||||
|
msg = true;
|
||||||
} else if (avail > total + cfg->spawn_rate) {
|
} else if (avail > total + cfg->spawn_rate) {
|
||||||
n = avail;
|
n = avail;
|
||||||
while (avail > total + cfg->spawn_rate) {
|
while (avail > total + cfg->spawn_rate) {
|
||||||
@ -130,6 +132,14 @@ void pfh_manage_pool(struct tevent_context *ev_ctx,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* send message to all children when we change maximum allowed
|
||||||
|
* connections, so that they can decide to start again to listen to
|
||||||
|
* sockets if they were already topping the number of allowed
|
||||||
|
* clients. Useful only when we increase allowed clients */
|
||||||
|
if (msg) {
|
||||||
|
prefork_warn_active_children(msg_ctx, pool);
|
||||||
|
}
|
||||||
|
|
||||||
DEBUG(10, ("Stats: children: %d, allowed connections: %d\n",
|
DEBUG(10, ("Stats: children: %d, allowed connections: %d\n",
|
||||||
prefork_count_children(pool, NULL),
|
prefork_count_children(pool, NULL),
|
||||||
prefork_count_allowed_connections(pool)));
|
prefork_count_allowed_connections(pool)));
|
||||||
|
Reference in New Issue
Block a user