diff options
author | Stefan Metzmacher <metze@samba.org> | 2019-08-13 16:39:41 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2019-09-09 16:04:29 +0000 |
commit | c4ab0c8502284ee0a4e4336f42c352b5a19dda43 (patch) | |
tree | 521c339685bf6bf1df1c34de55c30da090229875 | |
parent | 5e156be97a37b9bd42b18a78cf6ab541271971e7 (diff) | |
download | samba-c4ab0c8502284ee0a4e4336f42c352b5a19dda43.tar.gz |
s3:smb2_lock: error out early in smbd_smb2_lock_send()
We no longer expect NT_STATUS_FILE_LOCK_CONFLICT from
the VFS layer and assert that in a future version.
This makes it easier to port the same logic to smbd_smb2_lock_try().
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 39d514cdc358f175d0968f4a78f8f2f05a6c1707)
-rw-r--r-- | source3/smbd/smb2_lock.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/source3/smbd/smb2_lock.c b/source3/smbd/smb2_lock.c index c2b4603f3e1..c049c33ebbc 100644 --- a/source3/smbd/smb2_lock.c +++ b/source3/smbd/smb2_lock.c @@ -383,10 +383,26 @@ static struct tevent_req *smbd_smb2_lock_send(TALLOC_CTX *mem_ctx, tevent_req_done(req); return tevent_req_post(req, ev); } + if (NT_STATUS_EQUAL(status, NT_STATUS_FILE_LOCK_CONFLICT)) { + /* + * This is a bug and will be changed into an assert + * in a future version. We should only + * ever get NT_STATUS_LOCK_NOT_GRANTED here! + */ + static uint64_t _bug_count; + int _level = (_bug_count++ == 0) ? DBGLVL_ERR: DBGLVL_DEBUG; + DBG_PREFIX(_level, ("BUG: Got %s mapping to " + "NT_STATUS_LOCK_NOT_GRANTED\n", + nt_errstr(status))); + status = NT_STATUS_LOCK_NOT_GRANTED; + } + if (!NT_STATUS_EQUAL(status, NT_STATUS_LOCK_NOT_GRANTED)) { + TALLOC_FREE(lck); + tevent_req_nterror(req, status); + return tevent_req_post(req, ev); + } - if (state->blocking && - (NT_STATUS_EQUAL(status, NT_STATUS_LOCK_NOT_GRANTED) || - NT_STATUS_EQUAL(status, NT_STATUS_FILE_LOCK_CONFLICT))) { + if (state->blocking) { struct tevent_req *subreq; DBG_DEBUG("Watching share mode lock\n"); |