smbd: Remove separate oplock_type parameter from set_file_oplock
authorVolker Lendecke <vl@samba.org>
Tue, 3 Sep 2013 13:57:11 +0000 (13:57 +0000)
committerDavid Disseldorp <ddiss@samba.org>
Thu, 24 Oct 2013 12:22:03 +0000 (14:22 +0200)
This avoids the question where it could happen that something else but
fsp->oplock_type might be useful as an argument here.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
source3/smbd/durable.c
source3/smbd/open.c
source3/smbd/oplock.c
source3/smbd/proto.h

index 15d70058c6e2ea11a02f513af26b63b9d54282cc..c5281a88561a40fc4df2e6ce9af8ea8709d1ecf0 100644 (file)
@@ -864,7 +864,7 @@ NTSTATUS vfs_default_durable_reconnect(struct connection_struct *conn,
                return NT_STATUS_OBJECT_NAME_NOT_FOUND;
        }
 
-       status = set_file_oplock(fsp, fsp->oplock_type);
+       status = set_file_oplock(fsp);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(1, ("vfs_default_durable_reconnect failed to set oplock "
                          "after opening file: %s\n", nt_errstr(status)));
index c33a4cf357d90e66ddabe4b6477a775ed9296084..4db673acd33f42d86fa38fe38db6c71ac5d36482 100644 (file)
@@ -2703,7 +2703,7 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
         * file structs.
         */
 
-       status = set_file_oplock(fsp, fsp->oplock_type);
+       status = set_file_oplock(fsp);
        if (!NT_STATUS_IS_OK(status)) {
                /*
                 * Could not get the kernel oplock
index 36a4b5ba1d8d183740b00c60e0750b86c9184216..b5d6b54b1489ae8f20bf84eb3cd70908c1227853 100644 (file)
@@ -50,7 +50,7 @@ void break_kernel_oplock(struct messaging_context *msg_ctx, files_struct *fsp)
  disabled (just sets flags).
 ****************************************************************************/
 
-NTSTATUS set_file_oplock(files_struct *fsp, int oplock_type)
+NTSTATUS set_file_oplock(files_struct *fsp)
 {
        struct smbd_server_connection *sconn = fsp->conn->sconn;
        struct kernel_oplocks *koplocks = sconn->oplocks.kernel_ops;
@@ -67,14 +67,13 @@ NTSTATUS set_file_oplock(files_struct *fsp, int oplock_type)
 
        if ((fsp->oplock_type != NO_OPLOCK) &&
            use_kernel &&
-           !koplocks->ops->set_oplock(koplocks, fsp, oplock_type))
+           !koplocks->ops->set_oplock(koplocks, fsp, fsp->oplock_type))
        {
                return map_nt_error_from_unix(errno);
        }
 
-       fsp->oplock_type = oplock_type;
        fsp->sent_oplock_break = NO_BREAK_SENT;
-       if (oplock_type == LEVEL_II_OPLOCK) {
+       if (fsp->oplock_type == LEVEL_II_OPLOCK) {
                sconn->oplocks.level_II_open++;
        } else if (EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type)) {
                sconn->oplocks.exclusive_open++;
index bead710065dc3b76568e98f59b699c3bc35395a3..d365545fe92b07820971543b794d4fd5a7a4501b 100644 (file)
@@ -659,7 +659,7 @@ NTSTATUS get_relative_fid_filename(connection_struct *conn,
 /* The following definitions come from smbd/oplock.c  */
 
 void break_kernel_oplock(struct messaging_context *msg_ctx, files_struct *fsp);
-NTSTATUS set_file_oplock(files_struct *fsp, int oplock_type);
+NTSTATUS set_file_oplock(files_struct *fsp);
 bool remove_oplock(files_struct *fsp);
 bool downgrade_oplock(files_struct *fsp);
 void contend_level2_oplocks_begin(files_struct *fsp,