[PATCH] Simplify downgrade_lease()
Volker Lendecke
Volker.Lendecke at SerNet.DE
Mon Sep 17 10:28:21 UTC 2018
Hi!
Attached find a patchset that (to me) simplifies the logic in
downgrade_lease(). Some of the patches are personal preference, but to
me the resulting code flow (~20 lines less overall) is much easier to
grasp. I'm also happy to squash this patchset into one if that makes
it easier.
Review appreciated!
Thanks, Volker
--
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
Meet us at Storage Developer Conference (SDC)
Santa Clara, CA USA, September 24th-27th 2018
-------------- next part --------------
From 4156fa781ed07f640a9242bf48e0a1283a207267 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Fri, 14 Sep 2018 13:18:50 +0200
Subject: [PATCH 1/7] smbd: Move downgrade_share_lease() to smbd/oplock.c
This function is pretty closely entangled with its only caller. In
particular the NT_STATUS_OPLOCK_BREAK_IN_PROGRESS triggers acitivity
in the caller, and that's the only case where "*_l" is being set to
non-NULL. Prepare for cleanup
Signed-off-by: Volker Lendecke <vl at samba.org>
---
source3/locking/locking.c | 85 -----------------------------------------------
source3/locking/proto.h | 6 ----
source3/smbd/oplock.c | 85 +++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 85 insertions(+), 91 deletions(-)
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index 8ee92370aed..ae5f0bbcf33 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -969,91 +969,6 @@ bool downgrade_share_oplock(struct share_mode_lock *lck, files_struct *fsp)
return True;
}
-NTSTATUS downgrade_share_lease(struct smbd_server_connection *sconn,
- struct share_mode_lock *lck,
- const struct smb2_lease_key *key,
- uint32_t new_lease_state,
- struct share_mode_lease **_l)
-{
- struct share_mode_data *d = lck->data;
- struct share_mode_lease *l;
- uint32_t i;
-
- *_l = NULL;
-
- for (i=0; i<d->num_leases; i++) {
- if (smb2_lease_equal(&sconn->client->connections->smb2.client.guid,
- key,
- &d->leases[i].client_guid,
- &d->leases[i].lease_key)) {
- break;
- }
- }
- if (i == d->num_leases) {
- DEBUG(10, ("lease not found\n"));
- return NT_STATUS_INVALID_PARAMETER;
- }
-
- l = &d->leases[i];
-
- if (!l->breaking) {
- DBG_WARNING("Attempt to break from %"PRIu32" to %"PRIu32" - "
- "but we're not in breaking state\n",
- l->current_state, new_lease_state);
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- /*
- * Can't upgrade anything: l->breaking_to_requested (and l->current_state)
- * must be a strict bitwise superset of new_lease_state
- */
- if ((new_lease_state & l->breaking_to_requested) != new_lease_state) {
- DBG_WARNING("Attempt to upgrade from %"PRIu32" to %"PRIu32" "
- "- expected %"PRIu32"\n",
- l->current_state, new_lease_state,
- l->breaking_to_requested);
- return NT_STATUS_REQUEST_NOT_ACCEPTED;
- }
-
- if (l->current_state != new_lease_state) {
- l->current_state = new_lease_state;
- d->modified = true;
- }
-
- if ((new_lease_state & ~l->breaking_to_required) != 0) {
- DBG_INFO("lease state %"PRIu32" not fully broken from "
- "%"PRIu32" to %"PRIu32"\n",
- new_lease_state,
- l->current_state,
- l->breaking_to_required);
- l->breaking_to_requested = l->breaking_to_required;
- if (l->current_state & (~SMB2_LEASE_READ)) {
- /*
- * Here we break in steps, as windows does
- * see the breaking3 and v2_breaking3 tests.
- */
- l->breaking_to_requested |= SMB2_LEASE_READ;
- }
- d->modified = true;
- *_l = l;
- return NT_STATUS_OPLOCK_BREAK_IN_PROGRESS;
- }
-
- DBG_DEBUG("breaking from %"PRIu32" to %"PRIu32" - "
- "expected %"PRIu32"\n",
- l->current_state,
- new_lease_state,
- l->breaking_to_requested);
-
- l->breaking_to_requested = 0;
- l->breaking_to_required = 0;
- l->breaking = false;
-
- d->modified = true;
-
- return NT_STATUS_OK;
-}
-
/****************************************************************************
Adds a delete on close token.
****************************************************************************/
diff --git a/source3/locking/proto.h b/source3/locking/proto.h
index b615a4ae6d0..22b79669ff0 100644
--- a/source3/locking/proto.h
+++ b/source3/locking/proto.h
@@ -184,12 +184,6 @@ bool mark_share_mode_disconnected(struct share_mode_lock *lck,
struct files_struct *fsp);
bool remove_share_oplock(struct share_mode_lock *lck, files_struct *fsp);
bool downgrade_share_oplock(struct share_mode_lock *lck, files_struct *fsp);
-struct share_mode_lease;
-NTSTATUS downgrade_share_lease(struct smbd_server_connection *sconn,
- struct share_mode_lock *lck,
- const struct smb2_lease_key *key,
- uint32_t new_lease_state,
- struct share_mode_lease **_l);
bool get_delete_on_close_token(struct share_mode_lock *lck,
uint32_t name_hash,
const struct security_token **pp_nt_tok,
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index 827dbeb4ef2..57e4e699c4a 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -517,6 +517,91 @@ static struct files_struct *downgrade_lease_fsps(struct files_struct *fsp,
return NULL;
}
+static NTSTATUS downgrade_share_lease(struct smbd_server_connection *sconn,
+ struct share_mode_lock *lck,
+ const struct smb2_lease_key *key,
+ uint32_t new_lease_state,
+ struct share_mode_lease **_l)
+{
+ struct share_mode_data *d = lck->data;
+ struct share_mode_lease *l;
+ uint32_t i;
+
+ *_l = NULL;
+
+ for (i=0; i<d->num_leases; i++) {
+ if (smb2_lease_equal(&sconn->client->connections->smb2.client.guid,
+ key,
+ &d->leases[i].client_guid,
+ &d->leases[i].lease_key)) {
+ break;
+ }
+ }
+ if (i == d->num_leases) {
+ DEBUG(10, ("lease not found\n"));
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+
+ l = &d->leases[i];
+
+ if (!l->breaking) {
+ DBG_WARNING("Attempt to break from %"PRIu32" to %"PRIu32" - "
+ "but we're not in breaking state\n",
+ l->current_state, new_lease_state);
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ /*
+ * Can't upgrade anything: l->breaking_to_requested (and l->current_state)
+ * must be a strict bitwise superset of new_lease_state
+ */
+ if ((new_lease_state & l->breaking_to_requested) != new_lease_state) {
+ DBG_WARNING("Attempt to upgrade from %"PRIu32" to %"PRIu32" "
+ "- expected %"PRIu32"\n",
+ l->current_state, new_lease_state,
+ l->breaking_to_requested);
+ return NT_STATUS_REQUEST_NOT_ACCEPTED;
+ }
+
+ if (l->current_state != new_lease_state) {
+ l->current_state = new_lease_state;
+ d->modified = true;
+ }
+
+ if ((new_lease_state & ~l->breaking_to_required) != 0) {
+ DBG_INFO("lease state %"PRIu32" not fully broken from "
+ "%"PRIu32" to %"PRIu32"\n",
+ new_lease_state,
+ l->current_state,
+ l->breaking_to_required);
+ l->breaking_to_requested = l->breaking_to_required;
+ if (l->current_state & (~SMB2_LEASE_READ)) {
+ /*
+ * Here we break in steps, as windows does
+ * see the breaking3 and v2_breaking3 tests.
+ */
+ l->breaking_to_requested |= SMB2_LEASE_READ;
+ }
+ d->modified = true;
+ *_l = l;
+ return NT_STATUS_OPLOCK_BREAK_IN_PROGRESS;
+ }
+
+ DBG_DEBUG("breaking from %"PRIu32" to %"PRIu32" - "
+ "expected %"PRIu32"\n",
+ l->current_state,
+ new_lease_state,
+ l->breaking_to_requested);
+
+ l->breaking_to_requested = 0;
+ l->breaking_to_required = 0;
+ l->breaking = false;
+
+ d->modified = true;
+
+ return NT_STATUS_OK;
+}
+
NTSTATUS downgrade_lease(struct smbXsrv_connection *xconn,
uint32_t num_file_ids,
const struct file_id *ids,
--
2.11.0
From d13124bd5c2e6233c65db55cf10813342175ec56 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Fri, 14 Sep 2018 13:30:43 +0200
Subject: [PATCH 2/7] smbd: Use find_share_mode_lease() in
downgrade_share_lease
Simple simplification: In locking/ we did not have the direct
reference to find_share_mode_lock.
Signed-off-by: Volker Lendecke <vl at samba.org>
---
source3/smbd/oplock.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index 57e4e699c4a..fdb87314d72 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -525,24 +525,18 @@ static NTSTATUS downgrade_share_lease(struct smbd_server_connection *sconn,
{
struct share_mode_data *d = lck->data;
struct share_mode_lease *l;
- uint32_t i;
+ int idx;
*_l = NULL;
- for (i=0; i<d->num_leases; i++) {
- if (smb2_lease_equal(&sconn->client->connections->smb2.client.guid,
- key,
- &d->leases[i].client_guid,
- &d->leases[i].lease_key)) {
- break;
- }
- }
- if (i == d->num_leases) {
+ idx = find_share_mode_lease(
+ d, &sconn->client->connections->smb2.client.guid, key);
+ if (idx == -1) {
DEBUG(10, ("lease not found\n"));
return NT_STATUS_INVALID_PARAMETER;
}
- l = &d->leases[i];
+ l = &d->leases[idx];
if (!l->breaking) {
DBG_WARNING("Attempt to break from %"PRIu32" to %"PRIu32" - "
--
2.11.0
From d01fb5c3f6660efd52f5f61e00dce2e04c559756 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Fri, 14 Sep 2018 16:03:57 +0200
Subject: [PATCH 3/7] smbd: Slightly simplify downgrade_lease()
As much as I dislike }else{ and prefer early returns, I even more
dislike asking for the same condition in two different ways.
Signed-off-by: Volker Lendecke <vl at samba.org>
---
source3/smbd/oplock.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index fdb87314d72..ded47b2f525 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -639,9 +639,6 @@ NTSTATUS downgrade_lease(struct smbXsrv_connection *xconn,
}
state->xconn = xconn;
- if (l->current_state & (~SMB2_LEASE_READ)) {
- state->break_flags = SMB2_NOTIFY_BREAK_LEASE_FLAG_ACK_REQUIRED;
- }
state->lease_key = l->lease_key;
state->break_from = l->current_state;
state->break_to = l->breaking_to_requested;
@@ -649,7 +646,10 @@ NTSTATUS downgrade_lease(struct smbXsrv_connection *xconn,
state->new_epoch = l->epoch;
}
- if (state->break_flags == 0) {
+ if (l->current_state & (~SMB2_LEASE_READ)) {
+ state->break_flags =
+ SMB2_NOTIFY_BREAK_LEASE_FLAG_ACK_REQUIRED;
+ } else {
/*
* This is an async break without
* SMB2_NOTIFY_BREAK_LEASE_FLAG_ACK_REQUIRED
--
2.11.0
From 5f7598fcae83ef543548023e65755626db4db450 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Fri, 14 Sep 2018 16:10:58 +0200
Subject: [PATCH 4/7] smbd: Simplify downgrade_lease
To me, the "additive" SMB2_LEASE_WRITE|SMB2_LEASE_HANDLE is easier to
read than the negated ~SMB2_LEASE_READ.
Signed-off-by: Volker Lendecke <vl at samba.org>
---
source3/smbd/oplock.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index ded47b2f525..7ed223ddcfe 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -569,7 +569,7 @@ static NTSTATUS downgrade_share_lease(struct smbd_server_connection *sconn,
l->current_state,
l->breaking_to_required);
l->breaking_to_requested = l->breaking_to_required;
- if (l->current_state & (~SMB2_LEASE_READ)) {
+ if (l->current_state & (SMB2_LEASE_WRITE|SMB2_LEASE_HANDLE)) {
/*
* Here we break in steps, as windows does
* see the breaking3 and v2_breaking3 tests.
@@ -646,7 +646,7 @@ NTSTATUS downgrade_lease(struct smbXsrv_connection *xconn,
state->new_epoch = l->epoch;
}
- if (l->current_state & (~SMB2_LEASE_READ)) {
+ if (l->current_state & (SMB2_LEASE_WRITE|SMB2_LEASE_HANDLE)) {
state->break_flags =
SMB2_NOTIFY_BREAK_LEASE_FLAG_ACK_REQUIRED;
} else {
--
2.11.0
From 03677deff02b856480b849b52db3c375a874fbfe Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Fri, 14 Sep 2018 16:19:19 +0200
Subject: [PATCH 5/7] smbd: Clarify downgrade_lease() a bit
"status" at this point is the return value of
downgrade_share_lease(). For any error but
NT_STATUS_OPLOCK_BREAK_IN_PROGRESS, which is handled before, we don't
need to call fsp_lease_update on all the fsps, because the lease
status in the database has not changed.
Signed-off-by: Volker Lendecke <vl at samba.org>
---
source3/smbd/oplock.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index 7ed223ddcfe..a529ffa3662 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -669,6 +669,15 @@ NTSTATUS downgrade_lease(struct smbXsrv_connection *xconn,
xconn->client->raw_ev_ctx,
downgrade_lease_additional_trigger,
state);
+
+ status = NT_STATUS_OK;
+ }
+
+ if (!NT_STATUS_IS_OK(status)) {
+ DBG_DEBUG("downgrade_share_lease failed: %s\n",
+ nt_errstr(status));
+ TALLOC_FREE(lck);
+ return status;
}
{
--
2.11.0
From c5656fcea8cdc80c2039d9cca5c9b9aff38cf7c9 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Fri, 14 Sep 2018 16:41:25 +0200
Subject: [PATCH 6/7] smbd: Move downgrade_share_lease into downgrade_lease
The next step will simplify the logic of the code.
Signed-off-by: Volker Lendecke <vl at samba.org>
---
source3/smbd/oplock.c | 109 ++++++++++++++++++++++----------------------------
1 file changed, 47 insertions(+), 62 deletions(-)
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index a529ffa3662..d2dc4077bbe 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -517,17 +517,29 @@ static struct files_struct *downgrade_lease_fsps(struct files_struct *fsp,
return NULL;
}
-static NTSTATUS downgrade_share_lease(struct smbd_server_connection *sconn,
- struct share_mode_lock *lck,
- const struct smb2_lease_key *key,
- uint32_t new_lease_state,
- struct share_mode_lease **_l)
+NTSTATUS downgrade_lease(struct smbXsrv_connection *xconn,
+ uint32_t num_file_ids,
+ const struct file_id *ids,
+ const struct smb2_lease_key *key,
+ uint32_t lease_state)
{
- struct share_mode_data *d = lck->data;
- struct share_mode_lease *l;
+ struct smbd_server_connection *sconn = xconn->client->sconn;
+ struct share_mode_lock *lck;
+ struct share_mode_data *d = NULL;
+ struct share_mode_lease *l = NULL;
+ const struct file_id id = ids[0];
int idx;
+ uint32_t i;
+ NTSTATUS status;
- *_l = NULL;
+ DEBUG(10, ("%s: Downgrading %s to %x\n", __func__,
+ file_id_string_tos(&id), (unsigned)lease_state));
+
+ lck = get_existing_share_mode_lock(talloc_tos(), id);
+ if (lck == NULL) {
+ return NT_STATUS_OBJECT_NAME_NOT_FOUND;
+ }
+ d = lck->data;
idx = find_share_mode_lease(
d, &sconn->client->connections->smb2.client.guid, key);
@@ -535,13 +547,13 @@ static NTSTATUS downgrade_share_lease(struct smbd_server_connection *sconn,
DEBUG(10, ("lease not found\n"));
return NT_STATUS_INVALID_PARAMETER;
}
-
l = &d->leases[idx];
if (!l->breaking) {
DBG_WARNING("Attempt to break from %"PRIu32" to %"PRIu32" - "
"but we're not in breaking state\n",
- l->current_state, new_lease_state);
+ l->current_state, lease_state);
+ TALLOC_FREE(lck);
return NT_STATUS_UNSUCCESSFUL;
}
@@ -549,26 +561,34 @@ static NTSTATUS downgrade_share_lease(struct smbd_server_connection *sconn,
* Can't upgrade anything: l->breaking_to_requested (and l->current_state)
* must be a strict bitwise superset of new_lease_state
*/
- if ((new_lease_state & l->breaking_to_requested) != new_lease_state) {
+ if ((lease_state & l->breaking_to_requested) != lease_state) {
DBG_WARNING("Attempt to upgrade from %"PRIu32" to %"PRIu32" "
"- expected %"PRIu32"\n",
- l->current_state, new_lease_state,
+ l->current_state, lease_state,
l->breaking_to_requested);
+ TALLOC_FREE(lck);
return NT_STATUS_REQUEST_NOT_ACCEPTED;
}
- if (l->current_state != new_lease_state) {
- l->current_state = new_lease_state;
+ if (l->current_state != lease_state) {
+ l->current_state = lease_state;
d->modified = true;
}
- if ((new_lease_state & ~l->breaking_to_required) != 0) {
+ status = NT_STATUS_OK;
+
+ d->modified = true;
+
+ if ((lease_state & ~l->breaking_to_required) != 0) {
+
DBG_INFO("lease state %"PRIu32" not fully broken from "
"%"PRIu32" to %"PRIu32"\n",
- new_lease_state,
+ lease_state,
l->current_state,
l->breaking_to_required);
+
l->breaking_to_requested = l->breaking_to_required;
+
if (l->current_state & (SMB2_LEASE_WRITE|SMB2_LEASE_HANDLE)) {
/*
* Here we break in steps, as windows does
@@ -576,47 +596,9 @@ static NTSTATUS downgrade_share_lease(struct smbd_server_connection *sconn,
*/
l->breaking_to_requested |= SMB2_LEASE_READ;
}
- d->modified = true;
- *_l = l;
- return NT_STATUS_OPLOCK_BREAK_IN_PROGRESS;
- }
- DBG_DEBUG("breaking from %"PRIu32" to %"PRIu32" - "
- "expected %"PRIu32"\n",
- l->current_state,
- new_lease_state,
- l->breaking_to_requested);
-
- l->breaking_to_requested = 0;
- l->breaking_to_required = 0;
- l->breaking = false;
-
- d->modified = true;
-
- return NT_STATUS_OK;
-}
-
-NTSTATUS downgrade_lease(struct smbXsrv_connection *xconn,
- uint32_t num_file_ids,
- const struct file_id *ids,
- const struct smb2_lease_key *key,
- uint32_t lease_state)
-{
- struct smbd_server_connection *sconn = xconn->client->sconn;
- struct share_mode_lock *lck;
- struct share_mode_lease *l = NULL;
- const struct file_id id = ids[0];
- uint32_t i;
- NTSTATUS status;
-
- DEBUG(10, ("%s: Downgrading %s to %x\n", __func__,
- file_id_string_tos(&id), (unsigned)lease_state));
-
- lck = get_existing_share_mode_lock(talloc_tos(), id);
- if (lck == NULL) {
- return NT_STATUS_OBJECT_NAME_NOT_FOUND;
+ status = NT_STATUS_OPLOCK_BREAK_IN_PROGRESS;
}
- status = downgrade_share_lease(sconn, lck, key, lease_state, &l);
DEBUG(10, ("%s: Downgrading %s to %x => %s\n", __func__,
file_id_string_tos(&id), (unsigned)lease_state, nt_errstr(status)));
@@ -669,15 +651,18 @@ NTSTATUS downgrade_lease(struct smbXsrv_connection *xconn,
xconn->client->raw_ev_ctx,
downgrade_lease_additional_trigger,
state);
+ } else {
+ DBG_DEBUG("breaking from %"PRIu32" to %"PRIu32" - "
+ "expected %"PRIu32"\n",
+ l->current_state,
+ lease_state,
+ l->breaking_to_requested);
- status = NT_STATUS_OK;
- }
+ l->breaking_to_requested = 0;
+ l->breaking_to_required = 0;
+ l->breaking = false;
- if (!NT_STATUS_IS_OK(status)) {
- DBG_DEBUG("downgrade_share_lease failed: %s\n",
- nt_errstr(status));
- TALLOC_FREE(lck);
- return status;
+ d->modified = true;
}
{
--
2.11.0
From be0f731772b8f1170426d1560237574046f2ef16 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Sun, 16 Sep 2018 11:25:14 +0200
Subject: [PATCH 7/7] smbd: Simplify downgrade_share_lease
Coalesce the NT_STATUS_OPLOCK_BREAK_IN_PROGRESS case into just one
if-condition
Signed-off-by: Volker Lendecke <vl at samba.org>
---
source3/smbd/oplock.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
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,
--
2.11.0
More information about the samba-technical
mailing list