smbd: Remove FORCE_OPLOCK_BREAK_TO_NONE
authorVolker Lendecke <vl@samba.org>
Wed, 4 Sep 2013 15:26:30 +0000 (17:26 +0200)
committerJeremy Allison <jra@samba.org>
Thu, 5 Sep 2013 22:47:07 +0000 (00:47 +0200)
This flag existed to break an exclusive or batch oplock in just one
instead of two steps down to "no oplock" when we did an allocation or file
size change.  Running raw.oplock against W2k12 differs in this respect
from W2k3: W2k12 takes two steps (via level2) to break to none. This
removes the special flag that we only had for compatibility with systems
older than W2k12...

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): Fri Sep  6 00:47:07 CEST 2013 on sn-devel-104

source3/include/smb.h
source3/smbd/open.c
source3/smbd/oplock.c
source3/smbd/trans2.c
source4/torture/raw/oplock.c

index 9dd8c58d80df4331e417639f031e1fcd4e77714f..8dd6555b5412e96d0bd2112d9af0f5cd1a1ca071 100644 (file)
@@ -675,10 +675,10 @@ enum remote_arch_types {RA_UNKNOWN, RA_WFWG, RA_OS2, RA_WIN95, RA_WINNT,
                                 * write. */
 /* #define DEFERRED_OPEN_ENTRY                 0x20 */   /* Not used anymore */
 /* #define UNUSED_SHARE_MODE_ENTRY     0x40 */   /* Not used anymore */
-#define FORCE_OPLOCK_BREAK_TO_NONE     0x80
+/* #define FORCE_OPLOCK_BREAK_TO_NONE  0x80 */   /* Not used anymore */
 
 /* None of the following should ever appear in fsp->oplock_request. */
-#define SAMBA_PRIVATE_OPLOCK_MASK (INTERNAL_OPEN_ONLY|FORCE_OPLOCK_BREAK_TO_NONE)
+#define SAMBA_PRIVATE_OPLOCK_MASK (INTERNAL_OPEN_ONLY)
 
 #define EXCLUSIVE_OPLOCK_TYPE(lck) ((lck) & ((unsigned int)EXCLUSIVE_OPLOCK|(unsigned int)BATCH_OPLOCK))
 #define BATCH_OPLOCK_TYPE(lck) ((lck) & (unsigned int)BATCH_OPLOCK)
index c28d2a39fa6f9111edafb661eb12c0e0950a74a0..f4210d7417417db07e9dacb352e3f4a81d7d1fe3 100644 (file)
@@ -1184,14 +1184,6 @@ static NTSTATUS send_break_message(files_struct *fsp,
        /* Create the message. */
        share_mode_entry_to_message(msg, exclusive);
 
-       /* Add in the FORCE_OPLOCK_BREAK_TO_NONE bit in the message if set. We
-          don't want this set in the share mode struct pointed to by lck. */
-
-       if (oplock_request & FORCE_OPLOCK_BREAK_TO_NONE) {
-               SSVAL(msg,OP_BREAK_MSG_OP_TYPE_OFFSET,
-                       exclusive->op_type | FORCE_OPLOCK_BREAK_TO_NONE);
-       }
-
        status = messaging_send_buf(fsp->conn->sconn->msg_ctx, exclusive->pid,
                                    MSG_SMB_BREAK_REQUEST,
                                    (uint8 *)msg,
@@ -1914,10 +1906,7 @@ static int calculate_open_access_flags(uint32_t access_mask,
         * mean the same thing under DOS and Unix.
         */
 
-       need_write =
-               ((access_mask & (FILE_WRITE_DATA | FILE_APPEND_DATA)) ||
-                (oplock_request & FORCE_OPLOCK_BREAK_TO_NONE));
-
+       need_write = (access_mask & (FILE_WRITE_DATA | FILE_APPEND_DATA));
        if (!need_write) {
                return O_RDONLY;
        }
@@ -2181,7 +2170,7 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
 
        open_access_mask = access_mask;
 
-       if ((flags2 & O_TRUNC) || (oplock_request & FORCE_OPLOCK_BREAK_TO_NONE)) {
+       if (flags2 & O_TRUNC) {
                open_access_mask |= FILE_WRITE_DATA; /* This will cause oplock breaks. */
        }
 
index 434bafa3ca0535d3c4ca665a2708a06b98a6c018..4cdf68bc65d2b9f130c36f3e5e88b4443ab30334 100644 (file)
@@ -535,7 +535,6 @@ static void process_oplock_break_message(struct messaging_context *msg_ctx,
        use_kernel = lp_kernel_oplocks(SNUM(fsp->conn)) && koplocks;
 
        if ((global_client_caps & CAP_LEVEL_II_OPLOCKS) &&
-           !(msg.op_type & FORCE_OPLOCK_BREAK_TO_NONE) &&
            !(use_kernel && !(koplocks->flags & KOPLOCKS_LEVEL2_SUPPORTED)) &&
            lp_level2_oplocks(SNUM(fsp->conn))) {
                break_to_level2 = True;
index aaf0e6228968aea5c1287f130bee2cce1d5010c3..e6bb12c42fd5935df1194cc28e44edf7fec75d89 100644 (file)
@@ -5900,7 +5900,7 @@ static NTSTATUS smb_set_file_size(connection_struct *conn,
                FILE_OPEN,                              /* create_disposition*/
                0,                                      /* create_options */
                FILE_ATTRIBUTE_NORMAL,                  /* file_attributes */
-               FORCE_OPLOCK_BREAK_TO_NONE,             /* oplock_request */
+               0,                                      /* oplock_request */
                0,                                      /* allocation_size */
                0,                                      /* private_flags */
                NULL,                                   /* sd */
@@ -6891,7 +6891,7 @@ static NTSTATUS smb_set_file_allocation_info(connection_struct *conn,
                FILE_OPEN,                              /* create_disposition*/
                0,                                      /* create_options */
                FILE_ATTRIBUTE_NORMAL,                  /* file_attributes */
-               FORCE_OPLOCK_BREAK_TO_NONE,             /* oplock_request */
+               0,                                      /* oplock_request */
                0,                                      /* allocation_size */
                0,                                      /* private_flags */
                NULL,                                   /* sd */
@@ -6919,7 +6919,6 @@ static NTSTATUS smb_set_file_allocation_info(connection_struct *conn,
         * if there are no pending writes.
         */
        trigger_write_time_update_immediate(new_fsp);
-
        close_file(req, new_fsp, NORMAL_CLOSE);
        return NT_STATUS_OK;
 }
index ad21623fc9a865a03cafb6bebffa2e8da07db248..c2e086aa95af5942078c841667e1511d8c8dc474 100644 (file)
@@ -264,6 +264,9 @@ static uint8_t get_setinfo_break_count(struct torture_context *tctx)
        if (TARGET_IS_W2K12(tctx)) {
                return 2;
        }
+       if (TARGET_IS_SAMBA3(tctx)) {
+               return 2;
+       }
        return 1;
 }