summaryrefslogtreecommitdiff
path: root/source3/smbd/reply.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2019-06-20 11:07:17 +0200
committerJeremy Allison <jra@samba.org>2019-06-20 17:18:19 +0000
commit871bb7562cad1d4a9dccab602880d2ef3fffd75c (patch)
treec69eb8ae367007bdb84d54124230e226250ea667 /source3/smbd/reply.c
parentb3284bef3536328ff4ae965b5f34cec8ee9b8a3a (diff)
downloadsamba-871bb7562cad1d4a9dccab602880d2ef3fffd75c.tar.gz
smbd: Remove unused brlock code
No PENDING locks in brlock.tdb anymore. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/smbd/reply.c')
-rw-r--r--source3/smbd/reply.c140
1 files changed, 0 insertions, 140 deletions
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 727b619e299..6c32671deb7 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -8174,146 +8174,6 @@ uint64_t get_lock_offset(const uint8_t *data, int data_offset,
return offset;
}
-NTSTATUS smbd_do_locking(struct smb_request *req,
- files_struct *fsp,
- int32_t timeout,
- uint16_t num_locks,
- struct smbd_lock_element *locks,
- bool *async)
-{
- connection_struct *conn = req->conn;
- int i;
- NTSTATUS status = NT_STATUS_OK;
-
- *async = false;
-
- /* Setup the timeout in seconds. */
-
- if (!lp_blocking_locks(SNUM(conn))) {
- timeout = 0;
- }
-
- for(i = 0; i < (int)num_locks; i++) {
- struct smbd_lock_element *e = &locks[i];
-
- DBG_DEBUG("lock start=%"PRIu64", len=%"PRIu64" for smblctx "
- "%"PRIu64", file %s timeout = %"PRIi32"\n",
- e->offset,
- e->count,
- e->smblctx,
- fsp_str_dbg(fsp),
- timeout);
-
- {
- bool blocking_lock = (timeout != 0);
- bool defer_lock = false;
- struct byte_range_lock *br_lck;
- struct server_id blocker_pid;
- uint64_t block_smblctx;
-
- br_lck = do_lock(req->sconn->msg_ctx,
- fsp,
- e->smblctx,
- e->count,
- e->offset,
- e->brltype,
- WINDOWS_LOCK,
- blocking_lock,
- &status,
- &blocker_pid,
- &block_smblctx);
-
- if (br_lck && blocking_lock && ERROR_WAS_LOCK_DENIED(status)) {
- /* Windows internal resolution for blocking locks seems
- to be about 200ms... Don't wait for less than that. JRA. */
- if (timeout != -1) {
- timeout = MAX(timeout, lp_lock_spin_time());
- }
- defer_lock = true;
- }
-
- /* If a lock sent with timeout of zero would fail, and
- * this lock has been requested multiple times,
- * according to brl_lock_failed() we convert this
- * request to a blocking lock with a timeout of between
- * 150 - 300 milliseconds.
- *
- * If lp_lock_spin_time() has been set to 0, we skip
- * this blocking retry and fail immediately.
- *
- * Replacement for do_lock_spin(). JRA. */
-
- if (!req->sconn->using_smb2 &&
- br_lck && lp_blocking_locks(SNUM(conn)) &&
- lp_lock_spin_time() && !blocking_lock &&
- NT_STATUS_EQUAL((status),
- NT_STATUS_FILE_LOCK_CONFLICT))
- {
- defer_lock = true;
- timeout = lp_lock_spin_time();
- }
-
- if (br_lck && defer_lock) {
- /*
- * A blocking lock was requested. Package up
- * this smb into a queued request and push it
- * onto the blocking lock queue.
- */
- if(push_blocking_lock_request(br_lck,
- req,
- fsp,
- timeout,
- i,
- e->smblctx,
- e->brltype,
- WINDOWS_LOCK,
- e->offset,
- e->count,
- block_smblctx)) {
- TALLOC_FREE(br_lck);
- *async = true;
- return NT_STATUS_OK;
- }
- }
-
- TALLOC_FREE(br_lck);
- }
-
- if (!NT_STATUS_IS_OK(status)) {
- break;
- }
- }
-
- /* If any of the above locks failed, then we must unlock
- all of the previous locks (X/Open spec). */
-
- if (num_locks != 0 && !NT_STATUS_IS_OK(status)) {
-
- /*
- * Ensure we don't do a remove on the lock that just failed,
- * as under POSIX rules, if we have a lock already there, we
- * will delete it (and we shouldn't) .....
- */
- for(i--; i >= 0; i--) {
- struct smbd_lock_element *e = &locks[i];
-
- do_unlock(req->sconn->msg_ctx,
- fsp,
- e->smblctx,
- e->count,
- e->offset,
- WINDOWS_LOCK);
- }
- return status;
- }
-
- DBG_NOTICE("%s num_locks=%"PRIu16"\n",
- fsp_fnum_dbg(fsp),
- num_locks);
-
- return NT_STATUS_OK;
-}
-
NTSTATUS smbd_do_unlocking(struct smb_request *req,
files_struct *fsp,
uint16_t num_ulocks,