The Samba-Bugzilla – Attachment 14805 Details for
Bug 13752
smbcontrol <pid> debug/debuglevel/shutdown don't work with 'samba' processes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patches for v4-10-test
tmp410.diff.txt (text/plain), 9.46 KB, created by
Stefan Metzmacher
on 2019-01-30 10:18:41 UTC
(
hide
)
Description:
Patches for v4-10-test
Filename:
MIME Type:
Creator:
Stefan Metzmacher
Created:
2019-01-30 10:18:41 UTC
Size:
9.46 KB
patch
obsolete
>From ef82625268dfb76b0b49999d41452db532fd33bc Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Thu, 17 Jan 2019 16:29:37 +0100 >Subject: [PATCH 1/5] manpages/samba.7.xml: smbcontrol can also work with > 'samba' >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13752 > >Signed-off-by: Stefan Metzmacher <metze@samba.org> >Reviewed-by: Björn Baumbach <bbaumbach@samba.org> >(cherry picked from commit 12b9adec3ff48f4356f9ff865891dc3c652ff86b) >--- > docs-xml/manpages/samba.7.xml | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/docs-xml/manpages/samba.7.xml b/docs-xml/manpages/samba.7.xml >index 5b72d6598714..836ed23619f6 100644 >--- a/docs-xml/manpages/samba.7.xml >+++ b/docs-xml/manpages/samba.7.xml >@@ -166,7 +166,7 @@ > <manvolnum>1</manvolnum></citerefentry></term> > <listitem><para><command>smbcontrol</command> is a utility > that can change the behaviour of running >- <command>smbd</command>, <command>nmbd</command> and >+ <command>samba</command>, <command>smbd</command>, <command>nmbd</command> and > <command>winbindd</command> daemons. > </para></listitem> > </varlistentry> >-- >2.17.1 > > >From 3d74afe8440f8718e49af570602efae25327bda7 Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Tue, 15 Jan 2019 01:39:06 +0100 >Subject: [PATCH 2/5] s4:messaging: add support 'smbcontrol <pid> > debug/debuglevel' >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13752 > >Signed-off-by: Stefan Metzmacher <metze@samba.org> >Reviewed-by: Björn Baumbach <bbaumbach@samba.org> >(cherry picked from commit 3a0c1da432c53de234b54bac90a3fb84534994eb) >--- > source4/lib/messaging/messaging.c | 72 +++++++++++++++++++++++++++++++ > 1 file changed, 72 insertions(+) > >diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c >index 6c10289515f5..6cf58539a750 100644 >--- a/source4/lib/messaging/messaging.c >+++ b/source4/lib/messaging/messaging.c >@@ -121,6 +121,68 @@ static void ringbuf_log_msg(struct imessaging_context *msg, > imessaging_send(msg, src, MSG_RINGBUF_LOG, &blob); > } > >+/**************************************************************************** >+ Receive a "set debug level" message. >+****************************************************************************/ >+ >+static void debug_imessage(struct imessaging_context *msg_ctx, >+ void *private_data, >+ uint32_t msg_type, >+ struct server_id src, >+ DATA_BLOB *data) >+{ >+ const char *params_str = (const char *)data->data; >+ struct server_id_buf src_buf; >+ struct server_id dst = imessaging_get_server_id(msg_ctx); >+ struct server_id_buf dst_buf; >+ >+ /* Check, it's a proper string! */ >+ if (params_str[(data->length)-1] != '\0') { >+ DBG_ERR("Invalid debug message from pid %s to pid %s\n", >+ server_id_str_buf(src, &src_buf), >+ server_id_str_buf(dst, &dst_buf)); >+ return; >+ } >+ >+ DBG_ERR("INFO: Remote set of debug to `%s' (pid %s from pid %s)\n", >+ params_str, >+ server_id_str_buf(dst, &dst_buf), >+ server_id_str_buf(src, &src_buf)); >+ >+ debug_parse_levels(params_str); >+} >+ >+/**************************************************************************** >+ Return current debug level. >+****************************************************************************/ >+ >+static void debuglevel_imessage(struct imessaging_context *msg_ctx, >+ void *private_data, >+ uint32_t msg_type, >+ struct server_id src, >+ DATA_BLOB *data) >+{ >+ char *message = debug_list_class_names_and_levels(); >+ DATA_BLOB blob = data_blob_null; >+ struct server_id_buf src_buf; >+ struct server_id dst = imessaging_get_server_id(msg_ctx); >+ struct server_id_buf dst_buf; >+ >+ DBG_DEBUG("Received REQ_DEBUGLEVEL message (pid %s from pid %s)\n", >+ server_id_str_buf(dst, &dst_buf), >+ server_id_str_buf(src, &src_buf)); >+ >+ if (message == NULL) { >+ DBG_ERR("debug_list_class_names_and_levels returned NULL\n"); >+ return; >+ } >+ >+ blob = data_blob_string_const_null(message); >+ imessaging_send(msg_ctx, src, MSG_DEBUGLEVEL, &blob); >+ >+ TALLOC_FREE(message); >+} >+ > /* > return uptime of messaging server via irpc > */ >@@ -460,6 +522,16 @@ struct imessaging_context *imessaging_init(TALLOC_CTX *mem_ctx, > if (!NT_STATUS_IS_OK(status)) { > goto fail; > } >+ status = imessaging_register(msg, NULL, MSG_DEBUG, >+ debug_imessage); >+ if (!NT_STATUS_IS_OK(status)) { >+ goto fail; >+ } >+ status = imessaging_register(msg, NULL, MSG_REQ_DEBUGLEVEL, >+ debuglevel_imessage); >+ if (!NT_STATUS_IS_OK(status)) { >+ goto fail; >+ } > status = IRPC_REGISTER(msg, irpc, IRPC_UPTIME, irpc_uptime, msg); > if (!NT_STATUS_IS_OK(status)) { > goto fail; >-- >2.17.1 > > >From 1a4f650a109d1b613b5c44eeed8a0f5e50b37e3c Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Mon, 28 Jan 2019 16:29:51 +0100 >Subject: [PATCH 3/5] s4:server: avoid using pid=0 for the parent 'samba' > process >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >It confuses the 'samba-tool processes' output and log messages. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13752 > >Signed-off-by: Stefan Metzmacher <metze@samba.org> >Reviewed-by: Björn Baumbach <bbaumbach@samba.org> >(cherry picked from commit 5bd7a8e5685caa09067745b108ef7e53e3108e97) >--- > source4/smbd/server.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/source4/smbd/server.c b/source4/smbd/server.c >index 086fed99273c..0345c6ac7d3e 100644 >--- a/source4/smbd/server.c >+++ b/source4/smbd/server.c >@@ -316,7 +316,7 @@ static NTSTATUS setup_parent_messaging(struct server_state *state, > > msg = imessaging_init(state->event_ctx, > lp_ctx, >- cluster_id(0, SAMBA_PARENT_TASKID), >+ cluster_id(getpid(), SAMBA_PARENT_TASKID), > state->event_ctx); > NT_STATUS_HAVE_NO_MEMORY(msg); > >-- >2.17.1 > > >From db45151c24d5c6bca88b4a3c1b9593b938b737eb Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Thu, 17 Jan 2019 16:27:10 +0100 >Subject: [PATCH 4/5] s4:server: add support for 'smbcontrol samba shutdown' >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13752 > >Signed-off-by: Stefan Metzmacher <metze@samba.org> >Reviewed-by: Björn Baumbach <bbaumbach@samba.org> >(cherry picked from commit 832776c0fcf7cc658c128765514755c2d15b06a6) >--- > source4/smbd/server.c | 37 ++++++++++++++++++++++++++++++++++++- > 1 file changed, 36 insertions(+), 1 deletion(-) > >diff --git a/source4/smbd/server.c b/source4/smbd/server.c >index 0345c6ac7d3e..eeb46ffee6ab 100644 >--- a/source4/smbd/server.c >+++ b/source4/smbd/server.c >@@ -45,6 +45,7 @@ > #include "libds/common/roles.h" > #include "lib/util/tfork.h" > #include "dsdb/samdb/ldb_modules/util.h" >+#include "lib/util/server_id.h" > > #ifdef HAVE_PTHREAD > #include <pthread.h> >@@ -291,6 +292,31 @@ static int prime_ldb_databases(struct tevent_context *event_ctx, bool *am_backup > return LDB_SUCCESS; > } > >+/* >+ called from 'smbcontrol samba shutdown' >+ */ >+static void samba_parent_shutdown(struct imessaging_context *msg, >+ void *private_data, >+ uint32_t msg_type, >+ struct server_id src, >+ DATA_BLOB *data) >+{ >+ struct server_state *state = >+ talloc_get_type_abort(private_data, >+ struct server_state); >+ struct server_id_buf src_buf; >+ struct server_id dst = imessaging_get_server_id(msg); >+ struct server_id_buf dst_buf; >+ >+ DBG_ERR("samba_shutdown of %s %s: from %s\n", >+ state->binary_name, >+ server_id_str_buf(dst, &dst_buf), >+ server_id_str_buf(src, &src_buf)); >+ >+ TALLOC_FREE(state); >+ exit(0); >+} >+ > /* > called when a fatal condition occurs in a child task > */ >@@ -325,10 +351,19 @@ static NTSTATUS setup_parent_messaging(struct server_state *state, > return status; > } > >+ status = imessaging_register(msg, state, MSG_SHUTDOWN, >+ samba_parent_shutdown); >+ if (!NT_STATUS_IS_OK(status)) { >+ return status; >+ } >+ > status = IRPC_REGISTER(msg, irpc, SAMBA_TERMINATE, > samba_terminate, state); >+ if (!NT_STATUS_IS_OK(status)) { >+ return status; >+ } > >- return status; >+ return NT_STATUS_OK; > } > > >-- >2.17.1 > > >From de7a774591335bb18673c3ea7d8f4a4026a784d8 Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Thu, 17 Jan 2019 23:50:45 +0100 >Subject: [PATCH 5/5] selftest:Samba4: use 'smbcontrol samba shutdown' >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13752 > >Signed-off-by: Stefan Metzmacher <metze@samba.org> >Reviewed-by: Björn Baumbach <bbaumbach@samba.org> > >Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> >Autobuild-Date(master): Wed Jan 30 01:51:48 CET 2019 on sn-devel-144 > >(cherry picked from commit d03991f569b54ae0a11911b622107fbae701715d) >--- > selftest/target/Samba4.pm | 9 +++++++++ > 1 file changed, 9 insertions(+) > >diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm >index 5346cb172df7..c34760f6a194 100755 >--- a/selftest/target/Samba4.pm >+++ b/selftest/target/Samba4.pm >@@ -2221,6 +2221,15 @@ sub teardown_env_terminate($$) > my ($self, $envvars) = @_; > my $pid; > >+ # This should cause samba to terminate gracefully >+ my $smbcontrol = Samba::bindir_path($self, "smbcontrol"); >+ my $cmd = ""; >+ $cmd .= "$smbcontrol samba shutdown $envvars->{CONFIGURATION}"; >+ my $ret = system($cmd); >+ if ($ret != 0) { >+ warn "'$cmd' failed with '$ret'\n"; >+ } >+ > # This should cause samba to terminate gracefully > close($envvars->{STDIN_PIPE}); > >-- >2.17.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
bbaumbach
:
review+
Actions:
View
Attachments on
bug 13752
: 14805 |
14806
|
14807
|
14808