smbd: Inline break_level2_to_none_async
authorVolker Lendecke <vl@samba.org>
Fri, 4 Oct 2013 10:11:38 +0000 (10:11 +0000)
committerJeremy Allison <jra@samba.org>
Tue, 15 Oct 2013 01:42:53 +0000 (03:42 +0200)
With the special case for bug 5980 in do_break_to_none we only have
one caller: process_oplock_async_level2_break_message. The further
goal is to merge process_oplock_async_level2_break_message with
process_oplock_break_message.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Oct 15 03:42:53 CEST 2013 on sn-devel-104

source3/smbd/oplock.c

index b0ab1b58cb78e59d6f73493ea4a646b8495624de..e2880c5de97342ef3619e3b7a86f29e64cbec9e3 100644 (file)
@@ -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);
 }
 
 /*******************************************************************