summaryrefslogtreecommitdiff
path: root/source4/smbd
diff options
context:
space:
mode:
authorGary Lockyer <gary@catalyst.net.nz>2017-10-19 15:15:33 +1300
committerAndrew Bartlett <abartlet@samba.org>2017-10-19 05:33:10 +0200
commit62d7bf9e0ae94baaaa090051bd6b7cb40e5ef3c3 (patch)
treeab6dea962aac36c2547ca5c7c1d746395f53b301 /source4/smbd
parent193afc55e6e467fa362ad93ea09ba0a92b6074a5 (diff)
downloadsamba-62d7bf9e0ae94baaaa090051bd6b7cb40e5ef3c3.tar.gz
process_standard: Honour proc_ctx->inhibit_fork_on_accept
This allows the service to control if it should fork per accept() without needing to replace the whole process model with process_single. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Diffstat (limited to 'source4/smbd')
-rw-r--r--source4/smbd/process_standard.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/source4/smbd/process_standard.c b/source4/smbd/process_standard.c
index f5922c8d91c..a17a1ec3b06 100644
--- a/source4/smbd/process_standard.c
+++ b/source4/smbd/process_standard.c
@@ -263,6 +263,21 @@ static void standard_accept_connection(
proc_ctx = talloc_get_type_abort(process_context,
struct process_context);
+ if (proc_ctx->inhibit_fork_on_accept) {
+ pid = getpid();
+ /*
+ * Service does not support forking a new process on a
+ * new connection, either it's maintaining shared
+ * state or the overhead of forking a new process is a
+ * significant fraction of the response time.
+ */
+ talloc_steal(private_data, sock2);
+ new_conn(ev, lp_ctx, sock2,
+ cluster_id(pid, socket_get_fd(sock2)), private_data,
+ process_context);
+ return;
+ }
+
state = setup_standard_child_pipe(ev, NULL);
if (state == NULL) {
return;