smbd: Introduce a helper variable in delay_for_oplock()
authorVolker Lendecke <vl@samba.org>
Wed, 10 Apr 2019 13:14:38 +0000 (15:14 +0200)
committerChristof Schmitt <cs@samba.org>
Sun, 14 Apr 2019 04:01:30 +0000 (04:01 +0000)
This removes a few explicit share_mode_lease dereferences

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
source3/smbd/open.c

index c7056a3..38aaa7d 100644 (file)
@@ -1867,9 +1867,11 @@ static bool delay_for_oplock(files_struct *fsp,
                uint32_t e_lease_type = get_lease_type(d, e);
                uint32_t break_to;
                uint32_t delay_mask = 0;
+               bool lease_is_breaking = false;
 
                if (e_is_lease) {
                        l = &d->leases[e->lease_idx];
+                       lease_is_breaking = l->breaking;
                }
 
                if (have_sharing_violation) {
@@ -1906,7 +1908,7 @@ static bool delay_for_oplock(files_struct *fsp,
                }
 
                if ((e_lease_type & ~break_to) == 0) {
-                       if (e_is_lease && l->breaking) {
+                       if (lease_is_breaking) {
                                delay = true;
                        }
                        continue;
@@ -1939,7 +1941,7 @@ static bool delay_for_oplock(files_struct *fsp,
                if (e_lease_type & delay_mask) {
                        delay = true;
                }
-               if (e_is_lease && l->breaking && !first_open_attempt) {
+               if (lease_is_breaking && !first_open_attempt) {
                        delay = true;
                }
                continue;