smbd: Simplify downgrade_share_lease
authorVolker Lendecke <vl@samba.org>
Sun, 16 Sep 2018 09:25:14 +0000 (11:25 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 2 Oct 2018 20:22:37 +0000 (22:22 +0200)
Coalesce the NT_STATUS_OPLOCK_BREAK_IN_PROGRESS case into just one
if-condition

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Oct  2 22:22:37 CEST 2018 on sn-devel-144

source3/smbd/oplock.c

index d2dc4077bbe84bc2e1109106a3596a60861772e6..a7ac8464891023189f706b1dd6ac8bbc24886833 100644 (file)
@@ -580,6 +580,7 @@ NTSTATUS downgrade_lease(struct smbXsrv_connection *xconn,
        d->modified = true;
 
        if ((lease_state & ~l->breaking_to_required) != 0) {
+               struct downgrade_lease_additional_state *state;
 
                DBG_INFO("lease state %"PRIu32" not fully broken from "
                         "%"PRIu32" to %"PRIu32"\n",
@@ -597,15 +598,6 @@ NTSTATUS downgrade_lease(struct smbXsrv_connection *xconn,
                        l->breaking_to_requested |= SMB2_LEASE_READ;
                }
 
-               status = NT_STATUS_OPLOCK_BREAK_IN_PROGRESS;
-       }
-
-       DEBUG(10, ("%s: Downgrading %s to %x => %s\n", __func__,
-                  file_id_string_tos(&id), (unsigned)lease_state, nt_errstr(status)));
-
-       if (NT_STATUS_EQUAL(status, NT_STATUS_OPLOCK_BREAK_IN_PROGRESS)) {
-               struct downgrade_lease_additional_state *state;
-
                state = talloc_zero(xconn,
                                    struct downgrade_lease_additional_state);
                if (state == NULL) {
@@ -651,6 +643,8 @@ NTSTATUS downgrade_lease(struct smbXsrv_connection *xconn,
                                          xconn->client->raw_ev_ctx,
                                          downgrade_lease_additional_trigger,
                                          state);
+
+               status = NT_STATUS_OPLOCK_BREAK_IN_PROGRESS;
        } else {
                DBG_DEBUG("breaking from %"PRIu32" to %"PRIu32" - "
                          "expected %"PRIu32"\n",
@@ -665,6 +659,9 @@ NTSTATUS downgrade_lease(struct smbXsrv_connection *xconn,
                d->modified = true;
        }
 
+       DEBUG(10, ("%s: Downgrading %s to %x => %s\n", __func__,
+                  file_id_string_tos(&id), (unsigned)lease_state, nt_errstr(status)));
+
        {
                struct downgrade_lease_fsps_state state = {
                        .id = id, .lck = lck, .key = key,