summaryrefslogtreecommitdiff
path: root/file_server
diff options
context:
space:
mode:
authorGary Lockyer <gary@catalyst.net.nz>2018-08-23 09:35:52 +1200
committerGary Lockyer <gary@samba.org>2018-11-01 23:49:24 +0100
commit99aea42520fc10564dbba013c365adb3059febad (patch)
treef3b63d2d703983b23dc9b6aaddc764c105c10637 /file_server
parentd6777a66c0dbd0c356059644b57070d4587d83ea (diff)
downloadsamba-99aea42520fc10564dbba013c365adb3059febad.tar.gz
source4 smdb: Add a post fork hook to the service API
Add a post fork hook to the service API this will be called: - standard process model immediately after the task_init. - single process model immediately after the task_init - prefork process model, inhibit_pre_fork = true immediately after the task_init - prefork process model, inhibit_pre_fork = false after each service worker has forked. It is not run on the service master process. The post fork hook is not called in the standard model if a new process is forked on a new connection. It is instead called immediately after the task_init. The task_init hook has been changed to return an error code. This ensures the post_fork code is only run if the task_init code completed successfully. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Diffstat (limited to 'file_server')
-rw-r--r--file_server/file_server.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/file_server/file_server.c b/file_server/file_server.c
index 1b6a01b0b56..4c216695a1f 100644
--- a/file_server/file_server.c
+++ b/file_server/file_server.c
@@ -53,7 +53,7 @@ static void file_server_smbd_done(struct tevent_req *subreq)
/*
startup a copy of smbd as a child daemon
*/
-static void s3fs_task_init(struct task_server *task)
+static NTSTATUS s3fs_task_init(struct task_server *task)
{
struct tevent_req *subreq;
const char *smbd_path;
@@ -78,17 +78,19 @@ static void s3fs_task_init(struct task_server *task)
if (!winbind_off()) {
DEBUG(0,("Failed to re-disable recursive winbindd calls after forking smbd\n"));
task_server_terminate(task, "Failed to re-disable recursive winbindd calls", true);
- return;
+ return NT_STATUS_UNSUCCESSFUL;
}
if (subreq == NULL) {
DEBUG(0, ("Failed to start smbd as child daemon\n"));
task_server_terminate(task, "Failed to startup s3fs smb task", true);
- return;
+ return NT_STATUS_UNSUCCESSFUL;
}
tevent_req_set_callback(subreq, file_server_smbd_done, task);
DEBUG(5,("Started file server child smbd\n"));
+
+ return NT_STATUS_OK;
}
/* called at smbd startup - register ourselves as a server service */
@@ -98,7 +100,9 @@ NTSTATUS server_service_s3fs_init(TALLOC_CTX *ctx)
{
struct service_details details = {
.inhibit_fork_on_accept = true,
- .inhibit_pre_fork = true
+ .inhibit_pre_fork = true,
+ .task_init = s3fs_task_init,
+ .post_fork = NULL
};
- return register_server_service(ctx, "s3fs", s3fs_task_init, &details);
+ return register_server_service(ctx, "s3fs", &details);
}