summaryrefslogtreecommitdiff
path: root/source3/lib/server_prefork.h
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2011-08-16 09:30:28 -0400
committerSimo Sorce <idra@samba.org>2011-08-21 09:05:05 -0400
commitee0c69a25e7a0dca0c54989b1d6887a114d93ed4 (patch)
treee14825b26c28a5d196c9aadad0c73f577e1f2e3d /source3/lib/server_prefork.h
parent07238713722c7454b87ed9c99d65c37ad3bcee85 (diff)
downloadsamba-ee0c69a25e7a0dca0c54989b1d6887a114d93ed4.tar.gz
samba-ee0c69a25e7a0dca0c54989b1d6887a114d93ed4.tar.bz2
samba-ee0c69a25e7a0dca0c54989b1d6887a114d93ed4.zip
s3-prefork: do not use a lock_fd, just race on accept()
We used a lock mimicking what apache does for preforked children. But it doesn't work properly in our case because we do not stop once a request has been served. Clients are allowed to perform multiple requests and keep the connection open. This means that if we allow multiple clients per children, then a child could take the lock and then be asked to do a long or even locking operation by a client it already is serving. This woulkd cause the whole server to deadlock, as the child is now busy and also holding on the lock. Using a race on accept() by having a tevent_fd on the listening socket wait for read events we never deadlock. At most we cause a bit of contention among children. But in the generic case connections are much less frequent for us as clients tend to be long lived. So the little contention we may have is not a big deal. Signed-off-by: Andreas Schneider <asn@samba.org> Signed-off-by: Simo Sorce <idra@samba.org>
Diffstat (limited to 'source3/lib/server_prefork.h')
-rw-r--r--source3/lib/server_prefork.h6
1 files changed, 1 insertions, 5 deletions
diff --git a/source3/lib/server_prefork.h b/source3/lib/server_prefork.h
index a861993c7a..2685f50700 100644
--- a/source3/lib/server_prefork.h
+++ b/source3/lib/server_prefork.h
@@ -67,7 +67,6 @@ struct pf_worker_data {
* @param pf The mmaped area used to communicate with parent
* @param listen_fd_size The number of file descriptors to monitor
* @param listen_fds The array of file descriptors
-* @param lock_fd The locking file descriptor
* @param private_data Private data that needs to be passed to the main
* function from the calling parent.
*
@@ -79,7 +78,6 @@ typedef int (prefork_main_fn_t)(struct tevent_context *ev,
int child_id,
int listen_fd_size,
int *listen_fds,
- int lock_fd,
void *private_data);
/**
@@ -256,7 +254,6 @@ void prefork_set_sigchld_callback(struct prefork_pool *pfp,
* @param pf The child/parent shared structure
* @param listen_fd_size The number of listening file descriptors
* @param listen_fds The array of listening file descriptors
-* @param lock_fd The locking file descriptor
*
* @return The tevent request pointer or NULL on allocation errors.
*/
@@ -264,8 +261,7 @@ struct tevent_req *prefork_listen_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct pf_worker_data *pf,
int listen_fd_size,
- int *listen_fds,
- int lock_fd);
+ int *listen_fds);
/**
* @brief Returns the file descriptor after the new client connection has
* been accepted.