summaryrefslogtreecommitdiff
path: root/source3/smbd/process.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbd/process.c')
-rw-r--r--source3/smbd/process.c79
1 files changed, 12 insertions, 67 deletions
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 44cacfafdd..dc038b6b95 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -407,9 +407,6 @@ static void smbd_deferred_open_timer(struct event_context *ev,
TALLOC_CTX *mem_ctx = talloc_tos();
uint8_t *inbuf;
- /* TODO: remove this hack */
- message_dispatch(smbd_messaging_context());
-
inbuf = (uint8_t *)talloc_memdup(mem_ctx, msg->buf.data,
msg->buf.length);
if (inbuf == NULL) {
@@ -700,13 +697,13 @@ struct idle_event *event_add_idle(struct event_context *event_ctx,
notify events etc.
****************************************************************************/
-static void async_processing(fd_set *pfds)
+static void async_processing(void)
{
DEBUG(10,("async_processing: Doing async processing.\n"));
process_aio_queue();
- process_kernel_oplocks(smbd_messaging_context(), pfds);
+ process_kernel_oplocks(smbd_messaging_context());
/* Do the aio check again after receive_local_message as it does a
select and may have eaten our signal. */
@@ -727,20 +724,6 @@ static void async_processing(fd_set *pfds)
}
/****************************************************************************
- Add a fd to the set we will be select(2)ing on.
-****************************************************************************/
-
-static int select_on_fd(int fd, int maxfd, fd_set *fds)
-{
- if (fd != -1) {
- FD_SET(fd, fds);
- maxfd = MAX(maxfd, fd);
- }
-
- return maxfd;
-}
-
-/****************************************************************************
Do a select on an two fd's - with timeout.
If a local udp message has been pushed onto the
@@ -772,13 +755,6 @@ static NTSTATUS smbd_server_connection_loop_once(struct smbd_server_connection *
to.tv_usec = 0;
/*
- * Note that this call must be before processing any SMB
- * messages as we need to synchronously process any messages
- * we may have sent to ourselves from the previous SMB.
- */
- message_dispatch(smbd_messaging_context());
-
- /*
* Setup the select fd sets.
*/
@@ -794,9 +770,9 @@ static NTSTATUS smbd_server_connection_loop_once(struct smbd_server_connection *
* This is hideously complex - *MUST* be simplified for 3.0 ! JRA.
*/
- if (oplock_message_waiting(&r_fds)) {
+ if (oplock_message_waiting()) {
DEBUG(10,("receive_message_or_smb: oplock_message is waiting.\n"));
- async_processing(&r_fds);
+ async_processing();
/*
* After async processing we must go and do the select again, as
* the state of the flag in fds for the server file descriptor is
@@ -818,19 +794,15 @@ static NTSTATUS smbd_server_connection_loop_once(struct smbd_server_connection *
&r_fds, &w_fds, &to, &maxfd);
}
- if (timeval_is_zero(&to)) {
- /* Process a timed event now... */
- if (run_events(smbd_event_context(), 0, NULL, NULL)) {
- return NT_STATUS_RETRY;
- }
+ /* Process a signal and timed events now... */
+ if (run_events(smbd_event_context(), 0, NULL, NULL)) {
+ return NT_STATUS_RETRY;
}
-
+
{
int sav;
START_PROFILE(smbd_idle);
- maxfd = select_on_fd(oplock_notify_fd(), maxfd, &r_fds);
-
selrtn = sys_select(maxfd+1,&r_fds,&w_fds,NULL,&to);
sav = errno;
@@ -847,7 +819,7 @@ static NTSTATUS smbd_server_connection_loop_once(struct smbd_server_connection *
is the best we can do until the oplock code knows more about
signals */
if (selrtn == -1 && errno == EINTR) {
- async_processing(&r_fds);
+ async_processing();
/*
* After async processing we must go and do the select again, as
* the state of the flag in fds for the server file descriptor is
@@ -867,32 +839,8 @@ static NTSTATUS smbd_server_connection_loop_once(struct smbd_server_connection *
return NT_STATUS_RETRY;
}
- /*
- * Ensure we process oplock break messages by preference.
- * This is IMPORTANT ! Otherwise we can starve other processes
- * sending us an oplock break message. JRA.
- */
-
- if (oplock_message_waiting(&r_fds)) {
- async_processing(&r_fds);
- /*
- * After async processing we must go and do the select again, as
- * the state of the flag in fds for the server file descriptor is
- * indeterminate - we may have done I/O on it in the oplock processing. JRA.
- */
- return NT_STATUS_RETRY;
- }
-
- /*
- * We've just woken up from a protentially long select sleep.
- * Ensure we process local messages as we need to synchronously
- * process any messages from other smbd's to avoid file rename race
- * conditions. This call is cheap if there are no messages waiting.
- * JRA.
- */
- message_dispatch(smbd_messaging_context());
-
- return NT_STATUS_OK;
+ /* should not be reached */
+ return NT_STATUS_INTERNAL_ERROR;
}
/*
@@ -937,7 +885,7 @@ void respond_to_all_remaining_local_messages(void)
return;
}
- process_kernel_oplocks(smbd_messaging_context(), NULL);
+ process_kernel_oplocks(smbd_messaging_context());
return;
}
@@ -1908,9 +1856,6 @@ static void smbd_server_connection_read_handler(struct smbd_server_connection *c
TALLOC_CTX *mem_ctx = talloc_tos();
NTSTATUS status;
- /* TODO: remove this hack */
- message_dispatch(smbd_messaging_context());
-
/* TODO: make this completely nonblocking */
status = receive_smb_talloc(mem_ctx, smbd_server_fd(),