[SCM] Samba Shared Repository - branch master updated
Volker Lendecke
vlendec at samba.org
Sun Jul 4 09:30:24 MDT 2010
The branch, master has been updated
via 8cf1cd2... s3: Use msg_ctx->id in messaging
via 7f0e6df... s3: Pass the new server_id through reinit_after_fork
via 5a3c646... s3: Re-initialize the server_id in messaging_reinit
from b3194be... s3: Fix some type-punned warnings
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 8cf1cd2d5c0469f170b0f81dda94a53ce8575af9
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jul 4 16:41:51 2010 +0200
s3: Use msg_ctx->id in messaging
This removes some references to procid_self() deep inside the code
commit 7f0e6df88345c1154f19fd263966ad20c73f5d52
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jul 4 16:28:13 2010 +0200
s3: Pass the new server_id through reinit_after_fork
commit 5a3c64668a33fc3fa8f87a78d06fa040eed9f8f8
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jul 4 16:18:12 2010 +0200
s3: Re-initialize the server_id in messaging_reinit
-----------------------------------------------------------------------
Summary of changes:
source3/include/messages.h | 3 ++-
source3/include/proto.h | 5 +++--
source3/lib/messages.c | 5 ++++-
source3/lib/messages_ctdbd.c | 2 +-
source3/lib/messages_local.c | 9 +++++----
source3/lib/util.c | 7 ++++---
source3/nmbd/asyncdns.c | 8 ++++++--
source3/nmbd/nmbd.c | 8 ++++++--
source3/printing/print_cups.c | 7 +++++--
source3/printing/printing.c | 9 ++++++---
source3/smbd/process.c | 3 ++-
source3/smbd/server.c | 10 +++++++---
source3/winbindd/winbindd.c | 8 +++++---
source3/winbindd/winbindd_dual.c | 8 +++++---
14 files changed, 61 insertions(+), 31 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/include/messages.h b/source3/include/messages.h
index 865ffd4..805889a 100644
--- a/source3/include/messages.h
+++ b/source3/include/messages.h
@@ -130,7 +130,8 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
/*
* re-init after a fork
*/
-NTSTATUS messaging_reinit(struct messaging_context *msg_ctx);
+NTSTATUS messaging_reinit(struct messaging_context *msg_ctx,
+ struct server_id id);
NTSTATUS messaging_register(struct messaging_context *msg_ctx,
void *private_data,
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 135820f..30a4325 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1226,8 +1226,9 @@ ssize_t write_data_at_offset(int fd, const char *buffer, size_t N, SMB_OFF_T pos
int set_blocking(int fd, bool set);
void smb_msleep(unsigned int t);
NTSTATUS reinit_after_fork(struct messaging_context *msg_ctx,
- struct event_context *ev_ctx,
- bool parent_longlived);
+ struct event_context *ev_ctx,
+ struct server_id id,
+ bool parent_longlived);
void *malloc_(size_t size);
void *memalign_array(size_t el_size, size_t align, unsigned int count);
void *calloc_array(size_t size, size_t nmemb);
diff --git a/source3/lib/messages.c b/source3/lib/messages.c
index 2fcdc24..d53297e 100644
--- a/source3/lib/messages.c
+++ b/source3/lib/messages.c
@@ -226,12 +226,15 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
/*
* re-init after a fork
*/
-NTSTATUS messaging_reinit(struct messaging_context *msg_ctx)
+NTSTATUS messaging_reinit(struct messaging_context *msg_ctx,
+ struct server_id id)
{
NTSTATUS status;
TALLOC_FREE(msg_ctx->local);
+ msg_ctx->id = id;
+
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",
diff --git a/source3/lib/messages_ctdbd.c b/source3/lib/messages_ctdbd.c
index 847ab0f..8713346 100644
--- a/source3/lib/messages_ctdbd.c
+++ b/source3/lib/messages_ctdbd.c
@@ -80,7 +80,7 @@ static NTSTATUS messaging_ctdb_send(struct messaging_context *msg_ctx,
msg.msg_version = MESSAGE_VERSION;
msg.msg_type = msg_type;
msg.dest = pid;
- msg.src = procid_self();
+ msg.src = msg_ctx->id;
msg.buf = *data;
return ctdbd_messaging_send(ctx->conn, pid.vnn, pid.pid, &msg);
diff --git a/source3/lib/messages_local.c b/source3/lib/messages_local.c
index 15b2e47..c475773 100644
--- a/source3/lib/messages_local.c
+++ b/source3/lib/messages_local.c
@@ -381,7 +381,7 @@ static NTSTATUS messaging_tdb_send(struct messaging_context *msg_ctx,
rec[msg_array->num_messages].msg_version = MESSAGE_VERSION;
rec[msg_array->num_messages].msg_type = msg_type & MSG_TYPE_MASK;
rec[msg_array->num_messages].dest = pid;
- rec[msg_array->num_messages].src = procid_self();
+ rec[msg_array->num_messages].src = msg_ctx->id;
rec[msg_array->num_messages].buf = *data;
msg_array->messages = rec;
@@ -408,15 +408,16 @@ static NTSTATUS messaging_tdb_send(struct messaging_context *msg_ctx,
}
/****************************************************************************
- Retrieve all messages for the current process.
+ Retrieve all messages for a process.
****************************************************************************/
static NTSTATUS retrieve_all_messages(TDB_CONTEXT *msg_tdb,
+ struct server_id id,
TALLOC_CTX *mem_ctx,
struct messaging_array **presult)
{
struct messaging_array *result;
- TDB_DATA key = message_key_pid(mem_ctx, procid_self());
+ TDB_DATA key = message_key_pid(mem_ctx, id);
NTSTATUS status;
if (tdb_chainlock(msg_tdb, key) == -1) {
@@ -464,7 +465,7 @@ static void message_dispatch(struct messaging_context *msg_ctx)
DEBUG(10, ("message_dispatch: received_messages = %d\n",
ctx->received_messages));
- status = retrieve_all_messages(tdb->tdb, NULL, &msg_array);
+ status = retrieve_all_messages(tdb->tdb, msg_ctx->id, NULL, &msg_array);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("message_dispatch: failed to retrieve messages: %s\n",
nt_errstr(status)));
diff --git a/source3/lib/util.c b/source3/lib/util.c
index d7e765d..2a4d050 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -872,8 +872,9 @@ void smb_msleep(unsigned int t)
}
NTSTATUS reinit_after_fork(struct messaging_context *msg_ctx,
- struct event_context *ev_ctx,
- bool parent_longlived)
+ struct event_context *ev_ctx,
+ struct server_id id,
+ bool parent_longlived)
{
NTSTATUS status = NT_STATUS_OK;
@@ -899,7 +900,7 @@ NTSTATUS reinit_after_fork(struct messaging_context *msg_ctx,
* For clustering, we need to re-init our ctdbd connection after the
* fork
*/
- status = messaging_reinit(msg_ctx);
+ status = messaging_reinit(msg_ctx, id);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("messaging_reinit() failed: %s\n",
nt_errstr(status)));
diff --git a/source3/nmbd/asyncdns.c b/source3/nmbd/asyncdns.c
index 21ac5a0..2701c96 100644
--- a/source3/nmbd/asyncdns.c
+++ b/source3/nmbd/asyncdns.c
@@ -137,6 +137,7 @@ void kill_async_dns_child(void)
void start_async_dns(void)
{
int fd1[2], fd2[2];
+ NTSTATUS status;
CatchChild();
@@ -164,8 +165,11 @@ void start_async_dns(void)
CatchSignal(SIGHUP, SIG_IGN);
CatchSignal(SIGTERM, sig_term);
- if (!NT_STATUS_IS_OK(reinit_after_fork(nmbd_messaging_context(),
- nmbd_event_context(), true))) {
+ status = reinit_after_fork(nmbd_messaging_context(),
+ nmbd_event_context(),
+ procid_self(), true);
+
+ if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("reinit_after_fork() failed\n"));
smb_panic("reinit_after_fork() failed");
}
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index d13607b..dd42675 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -779,6 +779,7 @@ static bool open_sockets(bool isdaemon, int port)
{ NULL }
};
TALLOC_CTX *frame = talloc_stackframe(); /* Setup tos. */
+ NTSTATUS status;
load_case_tables();
@@ -923,8 +924,11 @@ static bool open_sockets(bool isdaemon, int port)
pidfile_create("nmbd");
- if (!NT_STATUS_IS_OK(reinit_after_fork(nmbd_messaging_context(),
- nmbd_event_context(), false))) {
+ status = reinit_after_fork(nmbd_messaging_context(),
+ nmbd_event_context(),
+ procid_self(), false);
+
+ if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("reinit_after_fork() failed\n"));
exit(1);
}
diff --git a/source3/printing/print_cups.c b/source3/printing/print_cups.c
index 043cc96..cbefa07 100644
--- a/source3/printing/print_cups.c
+++ b/source3/printing/print_cups.c
@@ -397,6 +397,7 @@ static bool cups_pcap_load_async(int *pfd)
{
int fds[2];
pid_t pid;
+ NTSTATUS status;
*pfd = -1;
@@ -434,8 +435,10 @@ static bool cups_pcap_load_async(int *pfd)
close_all_print_db();
- if (!NT_STATUS_IS_OK(reinit_after_fork(server_messaging_context(),
- server_event_context(), true))) {
+ status = reinit_after_fork(server_messaging_context(),
+ server_event_context(), procid_self(),
+ true);
+ if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("cups_pcap_load_async: reinit_after_fork() failed\n"));
smb_panic("cups_pcap_load_async: reinit_after_fork() failed");
}
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index 93624f0..1b5decc 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -1430,6 +1430,7 @@ void start_background_queue(void)
if(background_lpq_updater_pid == 0) {
struct tevent_fd *fde;
int ret;
+ NTSTATUS status;
/* Child. */
DEBUG(5,("start_background_queue: background LPQ thread started\n"));
@@ -1437,9 +1438,11 @@ void start_background_queue(void)
close(pause_pipe[0]);
pause_pipe[0] = -1;
- if (!NT_STATUS_IS_OK(reinit_after_fork(server_messaging_context(),
- server_event_context(),
- true))) {
+ status = reinit_after_fork(server_messaging_context(),
+ server_event_context(),
+ procid_self(), true);
+
+ if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("reinit_after_fork() failed\n"));
smb_panic("reinit_after_fork() failed");
}
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 8c2060d..b0bae92 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -2807,7 +2807,8 @@ static bool fork_echo_handler(struct smbd_server_connection *sconn)
close(listener_pipe[0]);
status = reinit_after_fork(smbd_messaging_context(),
- smbd_event_context(), false);
+ smbd_event_context(),
+ procid_self(), false);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("reinit_after_fork failed: %s\n",
nt_errstr(status)));
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index a125079..f30d761 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -409,7 +409,8 @@ static void smbd_accept_connection(struct tevent_context *ev,
s = NULL;
status = reinit_after_fork(smbd_messaging_context(),
- smbd_event_context(), true);
+ smbd_event_context(), procid_self(),
+ true);
if (!NT_STATUS_IS_OK(status)) {
if (NT_STATUS_EQUAL(status,
NT_STATUS_TOO_MANY_OPENED_FILES)) {
@@ -806,6 +807,7 @@ extern void build_options(bool screen);
};
struct smbd_parent_context *parent = NULL;
TALLOC_CTX *frame = talloc_stackframe(); /* Setup tos. */
+ NTSTATUS status;
smbd_init_globals();
@@ -998,8 +1000,10 @@ extern void build_options(bool screen);
if (is_daemon)
pidfile_create("smbd");
- if (!NT_STATUS_IS_OK(reinit_after_fork(smbd_messaging_context(),
- smbd_event_context(), false))) {
+ status = reinit_after_fork(smbd_messaging_context(),
+ smbd_event_context(),
+ procid_self(), false);
+ if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("reinit_after_fork() failed\n"));
exit(1);
}
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index 34fd271..cdbf2d6 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -1122,6 +1122,7 @@ int main(int argc, char **argv, char **envp)
poptContext pc;
int opt;
TALLOC_CTX *frame = talloc_stackframe();
+ NTSTATUS status;
/* glibc (?) likes to print "User defined signal 1" and exit if a
SIGUSR[12] is received before a handler is installed */
@@ -1278,9 +1279,10 @@ int main(int argc, char **argv, char **envp)
* winbindd-specific resources we must free yet. JRA.
*/
- if (!NT_STATUS_IS_OK(reinit_after_fork(winbind_messaging_context(),
- winbind_event_context(),
- false))) {
+ status = reinit_after_fork(winbind_messaging_context(),
+ winbind_event_context(),
+ procid_self(), false);
+ if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("reinit_after_fork() failed\n"));
exit(1);
}
diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c
index 2ae32e7..e506d2a 100644
--- a/source3/winbindd/winbindd_dual.c
+++ b/source3/winbindd/winbindd_dual.c
@@ -1106,10 +1106,12 @@ bool winbindd_reinit_after_fork(const char *logfilename)
{
struct winbindd_domain *domain;
struct winbindd_child *cl;
+ NTSTATUS status;
- if (!NT_STATUS_IS_OK(reinit_after_fork(winbind_messaging_context(),
- winbind_event_context(),
- true))) {
+ status = reinit_after_fork(winbind_messaging_context(),
+ winbind_event_context(),
+ procid_self(), true);
+ if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("reinit_after_fork() failed\n"));
return false;
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list