summaryrefslogtreecommitdiffstats
path: root/source3/smbd/oplock.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbd/oplock.c')
-rw-r--r--source3/smbd/oplock.c70
1 files changed, 32 insertions, 38 deletions
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index b0ab1b58cb..e2880c5de9 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -409,43 +409,6 @@ static void send_break_message_smb1(files_struct *fsp, int level)
}
}
-static void break_level2_to_none_async(struct server_id src, files_struct *fsp)
-{
- struct smbd_server_connection *sconn = fsp->conn->sconn;
- struct server_id self = messaging_server_id(sconn->msg_ctx);
-
- if (fsp->oplock_type == NO_OPLOCK) {
- /* We already got a "break to none" message and we've handled
- * it. just ignore. */
- DEBUG(3, ("process_oplock_async_level2_break_message: already "
- "broken to none, ignoring.\n"));
- return;
- }
-
- /* Ensure we're really at level2 state. */
- SMB_ASSERT(fsp->oplock_type == LEVEL_II_OPLOCK);
-
- DEBUG(10,("process_oplock_async_level2_break_message: sending break "
- "to none message for %s, file %s\n", fsp_fnum_dbg(fsp),
- fsp_str_dbg(fsp)));
-
- /* Need to wait before sending a break
- message if we sent ourselves this message. */
- if (serverid_equal(&self, &src)) {
- wait_before_sending_break();
- }
-
- /* Now send a break to none message to our client. */
- if (sconn->using_smb2) {
- send_break_message_smb2(fsp, OPLOCKLEVEL_NONE);
- } else {
- send_break_message_smb1(fsp, OPLOCKLEVEL_NONE);
- }
-
- /* Async level2 request, don't send a reply, just remove the oplock. */
- remove_oplock(fsp);
-}
-
/*******************************************************************
This handles the case of a write triggering a break to none
message on a level2 oplock.
@@ -465,6 +428,7 @@ static void process_oplock_async_level2_break_message(struct messaging_context *
struct smbd_server_connection *sconn =
talloc_get_type_abort(private_data,
struct smbd_server_connection);
+ struct server_id self = messaging_server_id(sconn->msg_ctx);
if (data->data == NULL) {
DEBUG(0, ("Got NULL buffer\n"));
@@ -494,7 +458,37 @@ static void process_oplock_async_level2_break_message(struct messaging_context *
return;
}
- break_level2_to_none_async(src, fsp);
+
+ if (fsp->oplock_type == NO_OPLOCK) {
+ /* We already got a "break to none" message and we've handled
+ * it. just ignore. */
+ DEBUG(3, ("process_oplock_async_level2_break_message: already "
+ "broken to none, ignoring.\n"));
+ return;
+ }
+
+ /* Ensure we're really at level2 state. */
+ SMB_ASSERT(fsp->oplock_type == LEVEL_II_OPLOCK);
+
+ DEBUG(10,("process_oplock_async_level2_break_message: sending break "
+ "to none message for %s, file %s\n", fsp_fnum_dbg(fsp),
+ fsp_str_dbg(fsp)));
+
+ /* Need to wait before sending a break
+ message if we sent ourselves this message. */
+ if (serverid_equal(&self, &src)) {
+ wait_before_sending_break();
+ }
+
+ /* Now send a break to none message to our client. */
+ if (sconn->using_smb2) {
+ send_break_message_smb2(fsp, OPLOCKLEVEL_NONE);
+ } else {
+ send_break_message_smb1(fsp, OPLOCKLEVEL_NONE);
+ }
+
+ /* Async level2 request, don't send a reply, just remove the oplock. */
+ remove_oplock(fsp);
}
/*******************************************************************