The branch, master has been updated via bd576b93bd8a136e1da8cbac154aa87ab1873c1c (commit) via 930b3c15da0bb24672d95ed388957b542cb24f89 (commit) via 26e863e6dd864d6466165adebce716f79bec73b6 (commit) via 8d203d3cabdea6b3b8903432bcbc889ad6358011 (commit) via fcf9f72e042ca97ede28a3d39c3ce406a3808b18 (commit) via 3347ed7e6e416b0534777a73663a353c12cfece7 (commit) from 0118b2301b29af0f22845c7e3ebb5df74ba13aeb (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit bd576b93bd8a136e1da8cbac154aa87ab1873c1c Author: Stefan Metzmacher <me...@samba.org> Date: Tue Jan 20 00:37:57 2009 +0100 socket_wrapper: fix PCAP support broken by aaea68791cfea45c6fa69abc93ad6d0e832d0283 We should note close the fd after writing the first packet. metze commit 930b3c15da0bb24672d95ed388957b542cb24f89 Author: Stefan Metzmacher <me...@samba.org> Date: Wed Jan 14 12:25:31 2009 +0100 s3:messaging: also recreate the local messaging backend in messaging_reinit() This prepares the change to use signal events in the tdb backend. metze commit 26e863e6dd864d6466165adebce716f79bec73b6 Author: Stefan Metzmacher <me...@samba.org> Date: Wed Jan 14 12:21:43 2009 +0100 s3: reinit_after_fork() should reinit the event context before the messaging context Because messaging_reinit() may add events to the event context, which will removed by event_context_reinit(). metze commit 8d203d3cabdea6b3b8903432bcbc889ad6358011 Author: Stefan Metzmacher <me...@samba.org> Date: Mon Jan 12 18:11:40 2009 +0100 s3:events: add support for signal events metze commit fcf9f72e042ca97ede28a3d39c3ce406a3808b18 Author: Stefan Metzmacher <me...@samba.org> Date: Sun Jan 18 23:01:59 2009 +0100 s3:smbd: call message_dispatch() before processing incoming PDUs This is a hack to fix races which happen with the RAW-RENAME and RAW-OPLOCK tests. We should try to remove it later. metze commit 3347ed7e6e416b0534777a73663a353c12cfece7 Author: Stefan Metzmacher <me...@samba.org> Date: Wed Jan 14 12:07:45 2009 +0100 tevent: rename signal handler functions to start with tevent_common_ This makes debugging with gdb easier. metze ----------------------------------------------------------------------- Summary of changes: lib/socket_wrapper/socket_wrapper.c | 4 +--- lib/tevent/tevent_signal.c | 11 ++++++----- source3/lib/events.c | 6 ++++++ source3/lib/messages.c | 14 +++++++++++--- source3/lib/util.c | 8 ++++---- source3/smbd/process.c | 6 ++++++ 6 files changed, 34 insertions(+), 15 deletions(-) Changeset truncated at 500 lines: diff --git a/lib/socket_wrapper/socket_wrapper.c b/lib/socket_wrapper/socket_wrapper.c index dc0124b..1e39277 100644 --- a/lib/socket_wrapper/socket_wrapper.c +++ b/lib/socket_wrapper/socket_wrapper.c @@ -901,7 +901,7 @@ static int swrap_get_pcap_fd(const char *fname) if (write(fd, &file_hdr, sizeof(file_hdr)) != sizeof(file_hdr)) { close(fd); - return -1; + fd = -1; } return fd; } @@ -1194,11 +1194,9 @@ static void swrap_dump_packet(struct socket_info *si, fd = swrap_get_pcap_fd(file_name); if (fd != -1) { if (write(fd, packet, packet_len) != packet_len) { - close(fd); free(packet); return; } - close(fd); } free(packet); diff --git a/lib/tevent/tevent_signal.c b/lib/tevent/tevent_signal.c index f4a56cd..c21ba20 100644 --- a/lib/tevent/tevent_signal.c +++ b/lib/tevent/tevent_signal.c @@ -75,7 +75,7 @@ static uint32_t sig_count(struct sigcounter s) /* signal handler - redirects to registered signals */ -static void signal_handler(int signum) +static void tevent_common_signal_handler(int signum) { char c = 0; SIG_INCREMENT(sig_state->signal_count[signum]); @@ -88,12 +88,13 @@ static void signal_handler(int signum) /* signal handler with SA_SIGINFO - redirects to registered signals */ -static void signal_handler_info(int signum, siginfo_t *info, void *uctx) +static void tevent_common_signal_handler_info(int signum, siginfo_t *info, + void *uctx) { uint32_t count = sig_count(sig_state->signal_count[signum]); sig_state->sig_info[signum][count] = *info; - signal_handler(signum); + tevent_common_signal_handler(signum); /* handle SA_SIGINFO */ if (count+1 == SA_INFO_QUEUE_COUNT) { @@ -215,12 +216,12 @@ struct tevent_signal *tevent_common_add_signal(struct tevent_context *ev, if (sig_state->sig_handlers[signum] == NULL) { struct sigaction act; ZERO_STRUCT(act); - act.sa_handler = signal_handler; + act.sa_handler = tevent_common_signal_handler; act.sa_flags = sa_flags; #ifdef SA_SIGINFO if (sa_flags & SA_SIGINFO) { act.sa_handler = NULL; - act.sa_sigaction = signal_handler_info; + act.sa_sigaction = tevent_common_signal_handler_info; if (sig_state->sig_info[signum] == NULL) { sig_state->sig_info[signum] = talloc_array(sig_state, siginfo_t, SA_INFO_QUEUE_COUNT); if (sig_state->sig_info[signum] == NULL) { diff --git a/source3/lib/events.c b/source3/lib/events.c index 8deaa18..74f30a7 100644 --- a/source3/lib/events.c +++ b/source3/lib/events.c @@ -86,6 +86,11 @@ bool run_events(struct tevent_context *ev, bool fired = false; struct tevent_fd *fde, *next; + if (ev->signal_events && + tevent_common_check_signal(ev)) { + return true; + } + /* Run all events that are pending, not just one (as we did previously. */ @@ -262,6 +267,7 @@ static const struct tevent_ops s3_event_ops = { .get_fd_flags = tevent_common_fd_get_flags, .set_fd_flags = tevent_common_fd_set_flags, .add_timer = tevent_common_add_timer, + .add_signal = tevent_common_add_signal, .loop_once = s3_event_loop_once, .loop_wait = s3_event_loop_wait, }; diff --git a/source3/lib/messages.c b/source3/lib/messages.c index f5933ca..e4b20c7 100644 --- a/source3/lib/messages.c +++ b/source3/lib/messages.c @@ -235,13 +235,21 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx, */ NTSTATUS messaging_reinit(struct messaging_context *msg_ctx) { -#ifdef CLUSTER_SUPPORT + NTSTATUS status; + + TALLOC_FREE(msg_ctx->local); + + status = messaging_tdb_init(msg_ctx, msg_ctx, &msg_ctx->local); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(0, ("messaging_tdb_init failed: %s\n", + nt_errstr(status))); + return status; + } +#ifdef CLUSTER_SUPPORT TALLOC_FREE(msg_ctx->remote); if (lp_clustering()) { - NTSTATUS status; - status = messaging_ctdbd_init(msg_ctx, msg_ctx, &msg_ctx->remote); diff --git a/source3/lib/util.c b/source3/lib/util.c index 70eabbf..2485d1d 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -966,6 +966,10 @@ bool reinit_after_fork(struct messaging_context *msg_ctx, return false; } + if (ev_ctx) { + event_context_reinit(ev_ctx); + } + if (msg_ctx) { /* * For clustering, we need to re-init our ctdbd connection after the @@ -979,10 +983,6 @@ bool reinit_after_fork(struct messaging_context *msg_ctx, } } - if (ev_ctx) { - event_context_reinit(ev_ctx); - } - return true; } diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 0c076b3..ae115f3 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -407,6 +407,9 @@ 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) { @@ -1907,6 +1910,9 @@ 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(), -- Samba Shared Repository