s3: Slightly simplify delay_for_exclusive_oplocks
authorVolker Lendecke <vl@samba.org>
Thu, 15 Dec 2011 13:35:07 +0000 (14:35 +0100)
committerVolker Lendecke <vl@samba.org>
Fri, 16 Dec 2011 06:34:48 +0000 (07:34 +0100)
source3/smbd/open.c

index fefed85d0c4639fa36236911b64244990bbca989..82a71c7030fb0a6ba2acfd95eadc90a54ef3acfc 100644 (file)
@@ -1172,20 +1172,26 @@ static bool delay_for_exclusive_oplocks(files_struct *fsp,
                                        int oplock_request,
                                        struct share_mode_entry *ex_entry)
 {
+       bool delay_it;
+
        if ((oplock_request & INTERNAL_OPEN_ONLY) || is_stat_open(fsp->access_mask)) {
                return false;
        }
+       if (ex_entry == NULL) {
+               return false;
+       }
 
-       if (ex_entry != NULL) {
-               /* Found an exclusive or batch oplock */
-               bool delay_it = is_delete_request(fsp) ?
-                               BATCH_OPLOCK_TYPE(ex_entry->op_type) : true;
-               if (delay_it) {
-                       send_break_message(fsp, ex_entry, mid, oplock_request);
-                       return true;
-               }
+       /* Found an exclusive or batch oplock */
+
+       delay_it = is_delete_request(fsp) ?
+               BATCH_OPLOCK_TYPE(ex_entry->op_type) : true;
+
+       if (!delay_it) {
+               return false;
        }
-       return false;
+
+       send_break_message(fsp, ex_entry, mid, oplock_request);
+       return true;
 }
 
 static void grant_fsp_oplock_type(files_struct *fsp,