From: Volker Lendecke Date: Sun, 16 Sep 2018 09:25:14 +0000 (+0200) Subject: smbd: Simplify downgrade_share_lease X-Git-Tag: tdb-1.3.17~1461 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cff1b31c2a82d7e07b7d413bed8a2843f1cd6508;p=thirdparty%2Fsamba.git smbd: Simplify downgrade_share_lease Coalesce the NT_STATUS_OPLOCK_BREAK_IN_PROGRESS case into just one if-condition Signed-off-by: Volker Lendecke Reviewed-by: Stefan Metzmacher Autobuild-User(master): Stefan Metzmacher Autobuild-Date(master): Tue Oct 2 22:22:37 CEST 2018 on sn-devel-144 --- diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index d2dc4077bbe..a7ac8464891 100644 --- a/source3/smbd/oplock.c +++ b/source3/smbd/oplock.c @@ -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,