[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Thu May 16 23:49:01 UTC 2019
The branch, master has been updated
via ab648a4c635 smbd: Do oplock break messages in ndr
via 3d9a720f092 smbd: Use send_break_message() in send_break_to_none()
via c67694ee0ff smbd: Remove a pointless "continue" statement
via 8c6fd8bb07d smbd: Remove an obsolete comment from share_conflict()
via 1078b273f84 s3: smbd: Don't log at WARNING level when exiting the server on error.
from 749f1290ce6 lib:util: Fix tfork return value if sigprocmask fails
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit ab648a4c63524038c9626a77be243c79c51975ac
Author: Volker Lendecke <vl at samba.org>
Date: Thu May 16 15:38:26 2019 +0200
smbd: Do oplock break messages in ndr
The previous scheme was overloaded, a idl definition is easier to
print, and it clarifies what data is actually needed
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Thu May 16 23:48:18 UTC 2019 on sn-devel-184
commit 3d9a720f092b8c45184a0d53540fb490a3fdef9d
Author: Volker Lendecke <vl at samba.org>
Date: Thu May 16 15:34:37 2019 +0200
smbd: Use send_break_message() in send_break_to_none()
Centralize the marshalling code
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit c67694ee0fff6f444813a9a9f39a156ddff5019e
Author: Volker Lendecke <vl at samba.org>
Date: Thu May 16 12:53:13 2019 +0200
smbd: Remove a pointless "continue" statement
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 8c6fd8bb07d6a2f6ded43f584627faa8432eab67
Author: Volker Lendecke <vl at samba.org>
Date: Thu May 16 12:23:26 2019 +0200
smbd: Remove an obsolete comment from share_conflict()
delay_for_batch_oplocks() is no more. Also, open_mode_check (which
calls into this routine) is called before delay_for_oplock.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 1078b273f84cf216b50ddec18ee6a2b3c8c17bc6
Author: Richard Sharpe <realrichardsharpe at gmail.com>
Date: Thu May 16 13:51:06 2019 -0700
s3: smbd: Don't log at WARNING level when exiting the server on error.
Signed-off-by: Richard Sharpe <realrichardsharpe at gmail.com>
Reviewed-by: Jeremy Allison <jra at samba.org>
-----------------------------------------------------------------------
Summary of changes:
source3/librpc/idl/open_files.idl | 6 +++++
source3/smbd/open.c | 49 ++++++++++++++++++----------------
source3/smbd/oplock.c | 55 +++++++++++++++++++++------------------
source3/smbd/server.c | 2 +-
4 files changed, 64 insertions(+), 48 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/librpc/idl/open_files.idl b/source3/librpc/idl/open_files.idl
index 2f6f861b5e6..a823e3f9134 100644
--- a/source3/librpc/idl/open_files.idl
+++ b/source3/librpc/idl/open_files.idl
@@ -98,4 +98,10 @@ interface open_files
timespec close_write_time;
vfs_default_durable_stat stat_info;
} vfs_default_durable_cookie;
+
+ typedef [public] struct {
+ file_id id;
+ udlong share_file_id;
+ uint8 break_to;
+ } oplock_break_message;
}
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index e9112dcfcf2..2d5815069f2 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -29,7 +29,7 @@
#include "fake_file.h"
#include "../libcli/security/security.h"
#include "../librpc/gen_ndr/ndr_security.h"
-#include "../librpc/gen_ndr/open_files.h"
+#include "../librpc/gen_ndr/ndr_open_files.h"
#include "../librpc/gen_ndr/idmap.h"
#include "../librpc/gen_ndr/ioctl.h"
#include "passdb/lookup_sid.h"
@@ -1472,10 +1472,6 @@ static bool share_conflict(struct share_mode_entry *entry,
(unsigned int)entry->private_options));
if (server_id_is_disconnected(&entry->pid)) {
- /*
- * note: cleanup should have been done by
- * delay_for_batch_oplocks()
- */
return false;
}
@@ -1699,26 +1695,36 @@ NTSTATUS send_break_message(struct messaging_context *msg_ctx,
const struct share_mode_entry *exclusive,
uint16_t break_to)
{
+ struct oplock_break_message msg = {
+ .id = *id,
+ .share_file_id = exclusive->share_file_id,
+ .break_to = break_to,
+ };
+ enum ndr_err_code ndr_err;
+ DATA_BLOB blob;
NTSTATUS status;
- char msg[MSG_SMB_SHARE_MODE_ENTRY_SIZE];
- struct server_id_buf tmp;
-
- DEBUG(10, ("Sending break request to PID %s\n",
- server_id_str_buf(exclusive->pid, &tmp)));
- /* Create the message. */
- share_mode_entry_to_message(msg, id, exclusive);
+ if (DEBUGLVL(10)) {
+ struct server_id_buf buf;
+ DBG_DEBUG("Sending break message to %s\n",
+ server_id_str_buf(exclusive->pid, &buf));
+ NDR_PRINT_DEBUG(oplock_break_message, &msg);
+ }
- /* Overload entry->op_type */
- /*
- * This is a cut from uint32_t to uint16_t, but so far only the lower 3
- * bits (LEASE_WRITE/HANDLE/READ) are used anyway.
- */
- SSVAL(msg,OP_BREAK_MSG_OP_TYPE_OFFSET, break_to);
+ ndr_err = ndr_push_struct_blob(
+ &blob,
+ talloc_tos(),
+ &msg,
+ (ndr_push_flags_fn_t)ndr_push_oplock_break_message);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ DBG_WARNING("ndr_push_oplock_break_message failed: %s\n",
+ ndr_errstr(ndr_err));
+ return ndr_map_error2ntstatus(ndr_err);
+ }
- status = messaging_send_buf(msg_ctx, exclusive->pid,
- MSG_SMB_BREAK_REQUEST,
- (uint8_t *)msg, sizeof(msg));
+ status = messaging_send(
+ msg_ctx, exclusive->pid, MSG_SMB_BREAK_REQUEST, &blob);
+ TALLOC_FREE(blob.data);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(3, ("Could not send oplock break message: %s\n",
nt_errstr(status)));
@@ -1954,7 +1960,6 @@ static bool delay_for_oplock(files_struct *fsp,
if (lease_is_breaking && !first_open_attempt) {
delay = true;
}
- continue;
}
return delay;
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index 22277abab07..b99b9cb4f08 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -945,8 +945,8 @@ static void process_oplock_break_message(struct messaging_context *msg_ctx,
struct server_id src,
DATA_BLOB *data)
{
- struct file_id id;
- struct share_mode_entry msg;
+ struct oplock_break_message *msg = NULL;
+ enum ndr_err_code ndr_err;
files_struct *fsp;
bool use_kernel;
struct smbd_server_connection *sconn =
@@ -957,28 +957,35 @@ static void process_oplock_break_message(struct messaging_context *msg_ctx,
uint16_t break_from;
uint16_t break_to;
bool break_needed = true;
- struct server_id_buf tmp;
- if (data->data == NULL) {
- DEBUG(0, ("Got NULL buffer\n"));
+ msg = talloc(talloc_tos(), struct oplock_break_message);
+ if (msg == NULL) {
+ DBG_WARNING("talloc failed\n");
return;
}
- if (data->length != MSG_SMB_SHARE_MODE_ENTRY_SIZE) {
- DEBUG(0, ("Got invalid msg len %d\n", (int)data->length));
+ ndr_err = ndr_pull_struct_blob_all(
+ data,
+ msg,
+ msg,
+ (ndr_pull_flags_fn_t)ndr_pull_oplock_break_message);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ DBG_DEBUG("ndr_pull_oplock_break_message failed: %s\n",
+ ndr_errstr(ndr_err));
+ TALLOC_FREE(msg);
return;
}
+ if (DEBUGLEVEL >= 10) {
+ struct server_id_buf buf;
+ DBG_DEBUG("Got break message from %s\n",
+ server_id_str_buf(src, &buf));
+ NDR_PRINT_DEBUG(oplock_break_message, msg);
+ }
- /* De-linearize incoming message. */
- message_to_share_mode_entry(&id, &msg, (char *)data->data);
- break_to = msg.op_type;
-
- DEBUG(10, ("Got oplock break to %u message from pid %s: %s/%llu\n",
- (unsigned)break_to, server_id_str_buf(src, &tmp),
- file_id_string_tos(&id),
- (unsigned long long)msg.share_file_id));
+ break_to = msg->break_to;
+ fsp = initial_break_processing(sconn, msg->id, msg->share_file_id);
- fsp = initial_break_processing(sconn, id, msg.share_file_id);
+ TALLOC_FREE(msg);
if (fsp == NULL) {
/* We hit a race here. Break messages are sent, and before we
@@ -1040,7 +1047,7 @@ static void process_oplock_break_message(struct messaging_context *msg_ctx,
status = leases_db_get(client_guid,
&fsp->lease->lease.lease_key,
- &id,
+ &fsp->file_id,
¤t_state,
&breaking,
&breaking_to_requested,
@@ -1327,14 +1334,12 @@ static void send_break_to_none(struct messaging_context *msg_ctx,
const struct file_id *id,
const struct share_mode_entry *e)
{
- char msg[MSG_SMB_SHARE_MODE_ENTRY_SIZE];
-
- share_mode_entry_to_message(msg, id, e);
- /* Overload entry->op_type */
- SSVAL(msg, OP_BREAK_MSG_OP_TYPE_OFFSET, NO_OPLOCK);
-
- messaging_send_buf(msg_ctx, e->pid, MSG_SMB_BREAK_REQUEST,
- (uint8_t *)msg, sizeof(msg));
+ NTSTATUS status;
+ status = send_break_message(msg_ctx, id, e, OPLOCK_NONE);
+ if (!NT_STATUS_IS_OK(status)) {
+ DBG_DEBUG("send_break_message failed: %s\n",
+ nt_errstr(status));
+ }
}
static bool do_break_lease_to_none(struct share_mode_lock *lck,
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 3ef7befef3f..3ac9be90f7d 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -2101,7 +2101,7 @@ extern void build_options(bool screen);
if (lp_clustering() && !lp_allow_unsafe_cluster_upgrade()) {
status = smbd_claim_version(msg_ctx, samba_version_string());
if (!NT_STATUS_IS_OK(status)) {
- DBG_WARNING("Could not claim version: %s\n",
+ DBG_ERR("Could not claim version: %s\n",
nt_errstr(status));
return -1;
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list