2 Unix SMB/CIFS implementation.
5 Copyright (C) Stefan Metzmacher 2009
6 Copyright (C) Jeremy Allison 2010
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #include "smbd/globals.h"
24 #include "../libcli/smb/smb_common.h"
25 #include "librpc/gen_ndr/messaging.h"
27 struct smbd_smb2_lock_element {
33 struct smbd_smb2_lock_state {
34 struct smbd_smb2_request *smb2req;
35 struct smb_request *smb1req;
36 struct blocking_lock_record *blr;
38 struct smbd_lock_element *locks;
41 static void remove_pending_lock(TALLOC_CTX *mem_ctx, struct blocking_lock_record *blr);
43 static struct tevent_req *smbd_smb2_lock_send(TALLOC_CTX *mem_ctx,
44 struct tevent_context *ev,
45 struct smbd_smb2_request *smb2req,
47 uint64_t in_file_id_volatile,
48 uint16_t in_lock_count,
49 struct smbd_smb2_lock_element *in_locks);
50 static NTSTATUS smbd_smb2_lock_recv(struct tevent_req *req);
52 static void smbd_smb2_request_lock_done(struct tevent_req *subreq);
53 NTSTATUS smbd_smb2_request_process_lock(struct smbd_smb2_request *req)
56 const uint8_t *inbody;
57 const int i = req->current_idx;
58 size_t expected_body_size = 0x30;
61 uint16_t in_lock_count;
62 uint64_t in_file_id_persistent;
63 uint64_t in_file_id_volatile;
64 struct smbd_smb2_lock_element *in_locks;
65 struct tevent_req *subreq;
66 const uint8_t *lock_buffer;
69 inhdr = (const uint8_t *)req->in.vector[i+0].iov_base;
70 if (req->in.vector[i+1].iov_len != (expected_body_size & 0xFFFFFFFE)) {
71 return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
74 inbody = (const uint8_t *)req->in.vector[i+1].iov_base;
76 body_size = SVAL(inbody, 0x00);
77 if (body_size != expected_body_size) {
78 return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
81 in_smbpid = IVAL(inhdr, SMB2_HDR_PID);
83 in_lock_count = CVAL(inbody, 0x02);
84 /* 0x04 - 4 bytes reserved */
85 in_file_id_persistent = BVAL(inbody, 0x08);
86 in_file_id_volatile = BVAL(inbody, 0x10);
88 if (in_lock_count < 1) {
89 return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
92 if (((in_lock_count - 1) * 0x18) > req->in.vector[i+2].iov_len) {
93 return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
96 if (req->compat_chain_fsp) {
98 } else if (in_file_id_persistent != 0) {
99 return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED);
102 in_locks = talloc_array(req, struct smbd_smb2_lock_element,
104 if (in_locks == NULL) {
105 return smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY);
109 lock_buffer = inbody + 0x18;
111 in_locks[l].offset = BVAL(lock_buffer, 0x00);
112 in_locks[l].length = BVAL(lock_buffer, 0x08);
113 in_locks[l].flags = IVAL(lock_buffer, 0x10);
114 /* 0x14 - 4 reserved bytes */
116 lock_buffer = (const uint8_t *)req->in.vector[i+2].iov_base;
118 for (l=1; l < in_lock_count; l++) {
119 in_locks[l].offset = BVAL(lock_buffer, 0x00);
120 in_locks[l].length = BVAL(lock_buffer, 0x08);
121 in_locks[l].flags = IVAL(lock_buffer, 0x10);
122 /* 0x14 - 4 reserved bytes */
127 subreq = smbd_smb2_lock_send(req,
128 req->sconn->smb2.event_ctx,
134 if (subreq == NULL) {
135 return smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY);
137 tevent_req_set_callback(subreq, smbd_smb2_request_lock_done, req);
139 return smbd_smb2_request_pending_queue(req, subreq);
142 static void smbd_smb2_request_lock_done(struct tevent_req *subreq)
144 struct smbd_smb2_request *smb2req = tevent_req_callback_data(subreq,
145 struct smbd_smb2_request);
148 NTSTATUS error; /* transport error */
150 if (smb2req->cancelled) {
151 const uint8_t *inhdr = (const uint8_t *)
152 smb2req->in.vector[smb2req->current_idx].iov_base;
153 uint64_t mid = BVAL(inhdr, SMB2_HDR_MESSAGE_ID);
154 struct smbd_smb2_lock_state *state;
156 DEBUG(10,("smbd_smb2_request_lock_done: cancelled mid %llu\n",
157 (unsigned long long)mid ));
159 state = tevent_req_data(smb2req->subreq,
160 struct smbd_smb2_lock_state);
163 SMB_ASSERT(state->blr);
165 remove_pending_lock(state, state->blr);
167 error = smbd_smb2_request_error(smb2req, NT_STATUS_CANCELLED);
168 if (!NT_STATUS_IS_OK(error)) {
169 smbd_server_connection_terminate(smb2req->sconn,
176 status = smbd_smb2_lock_recv(subreq);
178 if (!NT_STATUS_IS_OK(status)) {
179 error = smbd_smb2_request_error(smb2req, status);
180 if (!NT_STATUS_IS_OK(error)) {
181 smbd_server_connection_terminate(smb2req->sconn,
188 outbody = data_blob_talloc(smb2req->out.vector, NULL, 0x04);
189 if (outbody.data == NULL) {
190 error = smbd_smb2_request_error(smb2req, NT_STATUS_NO_MEMORY);
191 if (!NT_STATUS_IS_OK(error)) {
192 smbd_server_connection_terminate(smb2req->sconn,
199 SSVAL(outbody.data, 0x00, 0x04); /* struct size */
200 SSVAL(outbody.data, 0x02, 0); /* reserved */
202 error = smbd_smb2_request_done(smb2req, outbody, NULL);
203 if (!NT_STATUS_IS_OK(error)) {
204 smbd_server_connection_terminate(smb2req->sconn,
210 static struct tevent_req *smbd_smb2_lock_send(TALLOC_CTX *mem_ctx,
211 struct tevent_context *ev,
212 struct smbd_smb2_request *smb2req,
214 uint64_t in_file_id_volatile,
215 uint16_t in_lock_count,
216 struct smbd_smb2_lock_element *in_locks)
218 struct tevent_req *req;
219 struct smbd_smb2_lock_state *state;
220 struct smb_request *smb1req;
221 connection_struct *conn = smb2req->tcon->compat_conn;
223 int32_t timeout = -1;
224 bool isunlock = false;
226 struct smbd_lock_element *locks;
230 req = tevent_req_create(mem_ctx, &state,
231 struct smbd_smb2_lock_state);
235 state->smb2req = smb2req;
236 smb2req->subreq = req; /* So we can find this when going async. */
238 smb1req = smbd_smb2_fake_smb_request(smb2req);
239 if (tevent_req_nomem(smb1req, req)) {
240 return tevent_req_post(req, ev);
242 state->smb1req = smb1req;
244 DEBUG(10,("smbd_smb2_lock_send: file_id[0x%016llX]\n",
245 (unsigned long long)in_file_id_volatile));
247 fsp = file_fsp(smb1req, (uint16_t)in_file_id_volatile);
249 tevent_req_nterror(req, NT_STATUS_FILE_CLOSED);
250 return tevent_req_post(req, ev);
252 if (conn != fsp->conn) {
253 tevent_req_nterror(req, NT_STATUS_FILE_CLOSED);
254 return tevent_req_post(req, ev);
256 if (smb2req->session->vuid != fsp->vuid) {
257 tevent_req_nterror(req, NT_STATUS_FILE_CLOSED);
258 return tevent_req_post(req, ev);
261 locks = talloc_array(state, struct smbd_lock_element, in_lock_count);
263 tevent_req_nterror(req, NT_STATUS_NO_MEMORY);
264 return tevent_req_post(req, ev);
267 switch (in_locks[0].flags) {
268 case SMB2_LOCK_FLAG_SHARED:
269 case SMB2_LOCK_FLAG_EXCLUSIVE:
270 if (in_lock_count > 1) {
271 tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER);
272 return tevent_req_post(req, ev);
277 case SMB2_LOCK_FLAG_SHARED|SMB2_LOCK_FLAG_FAIL_IMMEDIATELY:
278 case SMB2_LOCK_FLAG_EXCLUSIVE|SMB2_LOCK_FLAG_FAIL_IMMEDIATELY:
282 case SMB2_LOCK_FLAG_UNLOCK:
283 /* only the first lock gives the UNLOCK bit - see
290 tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER);
291 return tevent_req_post(req, ev);
294 for (i=0; i<in_lock_count; i++) {
295 bool invalid = false;
297 switch (in_locks[i].flags) {
298 case SMB2_LOCK_FLAG_SHARED:
299 case SMB2_LOCK_FLAG_EXCLUSIVE:
301 tevent_req_nterror(req,
302 NT_STATUS_INVALID_PARAMETER);
303 return tevent_req_post(req, ev);
306 tevent_req_nterror(req,
307 NT_STATUS_INVALID_PARAMETER);
308 return tevent_req_post(req, ev);
312 case SMB2_LOCK_FLAG_SHARED|SMB2_LOCK_FLAG_FAIL_IMMEDIATELY:
313 case SMB2_LOCK_FLAG_EXCLUSIVE|SMB2_LOCK_FLAG_FAIL_IMMEDIATELY:
315 tevent_req_nterror(req,
316 NT_STATUS_INVALID_PARAMETER);
317 return tevent_req_post(req, ev);
321 case SMB2_LOCK_FLAG_UNLOCK:
323 tevent_req_nterror(req,
324 NT_STATUS_INVALID_PARAMETER);
325 return tevent_req_post(req, ev);
332 * is the first element was a UNLOCK
333 * we need to deferr the error response
334 * to the backend, because we need to process
335 * all unlock elements before
340 tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER);
341 return tevent_req_post(req, ev);
344 locks[i].smblctx = in_file_id_volatile;
345 locks[i].offset = in_locks[i].offset;
346 locks[i].count = in_locks[i].length;
348 if (in_locks[i].flags & SMB2_LOCK_FLAG_EXCLUSIVE) {
349 locks[i].brltype = WRITE_LOCK;
350 } else if (in_locks[i].flags & SMB2_LOCK_FLAG_SHARED) {
351 locks[i].brltype = READ_LOCK;
352 } else if (invalid) {
354 * this is an invalid UNLOCK element
355 * and the backend needs to test for
356 * brltype != UNLOCK_LOCK and return
357 * NT_STATUS_INVALID_PARAMER
359 locks[i].brltype = READ_LOCK;
361 locks[i].brltype = UNLOCK_LOCK;
364 DEBUG(10,("smbd_smb2_lock_send: index %d offset=%llu, count=%llu, "
365 "smblctx = %llu type %d\n",
367 (unsigned long long)locks[i].offset,
368 (unsigned long long)locks[i].count,
369 (unsigned long long)locks[i].smblctx,
370 (int)locks[i].brltype ));
374 state->locks = locks;
375 state->lock_count = in_lock_count;
378 status = smbd_do_locking(smb1req, fsp,
387 status = smbd_do_locking(smb1req, fsp,
396 if (!NT_STATUS_IS_OK(status)) {
397 if (NT_STATUS_EQUAL(status, NT_STATUS_FILE_LOCK_CONFLICT)) {
398 status = NT_STATUS_LOCK_NOT_GRANTED;
400 tevent_req_nterror(req, status);
401 return tevent_req_post(req, ev);
408 tevent_req_done(req);
409 return tevent_req_post(req, ev);
412 static NTSTATUS smbd_smb2_lock_recv(struct tevent_req *req)
416 if (tevent_req_is_nterror(req, &status)) {
417 tevent_req_received(req);
421 tevent_req_received(req);
425 /****************************************************************
426 Cancel an outstanding blocking lock request.
427 *****************************************************************/
429 static bool smbd_smb2_lock_cancel(struct tevent_req *req)
431 struct smbd_smb2_request *smb2req = NULL;
432 struct smbd_smb2_lock_state *state = tevent_req_data(req,
433 struct smbd_smb2_lock_state);
438 if (!state->smb2req) {
442 smb2req = state->smb2req;
443 smb2req->cancelled = true;
445 tevent_req_done(req);
449 /****************************************************************
450 Got a message saying someone unlocked a file. Re-schedule all
451 blocking lock requests as we don't know if anything overlapped.
452 *****************************************************************/
454 static void received_unlock_msg(struct messaging_context *msg,
457 struct server_id server_id,
460 DEBUG(10,("received_unlock_msg (SMB2)\n"));
461 process_blocking_lock_queue_smb2(timeval_current());
464 /****************************************************************
465 Function to get the blr on a pending record.
466 *****************************************************************/
468 struct blocking_lock_record *get_pending_smb2req_blr(struct smbd_smb2_request *smb2req)
470 struct smbd_smb2_lock_state *state = NULL;
471 const uint8_t *inhdr;
476 if (smb2req->subreq == NULL) {
479 if (!tevent_req_is_in_progress(smb2req->subreq)) {
482 inhdr = (const uint8_t *)smb2req->in.vector[smb2req->current_idx].iov_base;
483 if (SVAL(inhdr, SMB2_HDR_OPCODE) != SMB2_OP_LOCK) {
486 state = tevent_req_data(smb2req->subreq,
487 struct smbd_smb2_lock_state);
493 /****************************************************************
494 Set up the next brl timeout.
495 *****************************************************************/
497 static bool recalc_smb2_brl_timeout(struct smbd_server_connection *sconn)
499 struct smbd_smb2_request *smb2req;
500 struct timeval next_timeout = timeval_zero();
501 int max_brl_timeout = lp_parm_int(-1, "brl", "recalctime", 5);
503 TALLOC_FREE(sconn->smb2.locks.brl_timeout);
505 for (smb2req = sconn->smb2.requests; smb2req; smb2req = smb2req->next) {
506 struct blocking_lock_record *blr =
507 get_pending_smb2req_blr(smb2req);
511 if (timeval_is_zero(&blr->expire_time)) {
513 * If we're blocked on pid 0xFFFFFFFFFFFFFFFFLL this is
514 * a POSIX lock, so calculate a timeout of
515 * 10 seconds into the future.
517 if (blr->blocking_smblctx == 0xFFFFFFFFFFFFFFFFLL) {
518 struct timeval psx_to = timeval_current_ofs(10, 0);
519 next_timeout = timeval_brl_min(&next_timeout, &psx_to);
525 next_timeout = timeval_brl_min(&next_timeout, &blr->expire_time);
528 if (timeval_is_zero(&next_timeout)) {
529 DEBUG(10, ("recalc_smb2_brl_timeout:Next "
530 "timeout = Infinite.\n"));
535 * To account for unclean shutdowns by clients we need a
536 * maximum timeout that we use for checking pending locks. If
537 * we have any pending locks at all, then check if the pending
538 * lock can continue at least every brl:recalctime seconds
539 * (default 5 seconds).
541 * This saves us needing to do a message_send_all() in the
542 * SIGCHLD handler in the parent daemon. That
543 * message_send_all() caused O(n^2) work to be done when IP
544 * failovers happened in clustered Samba, which could make the
545 * entire system unusable for many minutes.
548 if (max_brl_timeout > 0) {
549 struct timeval min_to = timeval_current_ofs(max_brl_timeout, 0);
550 next_timeout = timeval_brl_min(&next_timeout, &min_to);
554 struct timeval cur, from_now;
556 cur = timeval_current();
557 from_now = timeval_until(&cur, &next_timeout);
558 DEBUG(10, ("recalc_smb2_brl_timeout: Next "
559 "timeout = %d.%d seconds from now.\n",
560 (int)from_now.tv_sec, (int)from_now.tv_usec));
563 sconn->smb2.locks.brl_timeout = event_add_timed(
564 smbd_event_context(),
569 if (!sconn->smb2.locks.brl_timeout) {
575 /****************************************************************
576 Get an SMB2 lock reqeust to go async. lock_timeout should
578 *****************************************************************/
580 bool push_blocking_lock_request_smb2( struct byte_range_lock *br_lck,
581 struct smb_request *smb1req,
586 enum brl_type lock_type,
587 enum brl_flavour lock_flav,
590 uint64_t blocking_smblctx)
592 struct smbd_server_connection *sconn = smbd_server_conn;
593 struct smbd_smb2_request *smb2req = smb1req->smb2req;
594 struct tevent_req *req = NULL;
595 struct smbd_smb2_lock_state *state = NULL;
596 struct blocking_lock_record *blr = NULL;
597 NTSTATUS status = NT_STATUS_OK;
602 req = smb2req->subreq;
606 if (!tevent_req_is_in_progress(smb2req->subreq)) {
609 state = tevent_req_data(req, struct smbd_smb2_lock_state);
614 blr = talloc_zero(state, struct blocking_lock_record);
620 if (lock_timeout == -1) {
621 blr->expire_time.tv_sec = 0;
622 blr->expire_time.tv_usec = 0; /* Never expire. */
624 blr->expire_time = timeval_current_ofs(
626 (lock_timeout % 1000) * 1000);
629 blr->lock_num = lock_num;
630 blr->smblctx = smblctx;
631 blr->blocking_smblctx = blocking_smblctx;
632 blr->lock_flav = lock_flav;
633 blr->lock_type = lock_type;
634 blr->offset = offset;
637 /* Specific brl_lock() implementations can fill this in. */
638 blr->blr_private = NULL;
640 /* Add a pending lock record for this. */
641 status = brl_lock(smbd_messaging_context(),
647 lock_type == READ_LOCK ? PENDING_READ_LOCK : PENDING_WRITE_LOCK,
653 if (!NT_STATUS_IS_OK(status)) {
654 DEBUG(0,("push_blocking_lock_request_smb2: "
655 "failed to add PENDING_LOCK record.\n"));
661 DEBUG(10,("push_blocking_lock_request_smb2: file %s timeout %d\n",
665 recalc_smb2_brl_timeout(sconn);
667 /* Ensure we'll receive messages when this is unlocked. */
668 if (!sconn->smb2.locks.blocking_lock_unlock_state) {
669 messaging_register(smbd_messaging_context(), NULL,
670 MSG_SMB_UNLOCK, received_unlock_msg);
671 sconn->smb2.locks.blocking_lock_unlock_state = true;
674 /* allow this request to be canceled */
675 tevent_req_set_cancel_fn(req, smbd_smb2_lock_cancel);
680 /****************************************************************
681 Remove a pending lock record under lock.
682 *****************************************************************/
684 static void remove_pending_lock(TALLOC_CTX *mem_ctx, struct blocking_lock_record *blr)
686 struct byte_range_lock *br_lck = brl_get_locks(
689 DEBUG(10, ("remove_pending_lock: BLR = %p\n", blr));
692 brl_lock_cancel(br_lck,
703 /****************************************************************
704 Re-proccess a blocking lock request.
705 This is equivalent to process_lockingX() inside smbd/blocking.c
706 *****************************************************************/
708 static void reprocess_blocked_smb2_lock(struct smbd_smb2_request *smb2req,
709 struct timeval tv_curr)
712 struct blocking_lock_record *blr = NULL;
713 struct smbd_smb2_lock_state *state = NULL;
714 files_struct *fsp = NULL;
716 if (!smb2req->subreq) {
719 state = tevent_req_data(smb2req->subreq, struct smbd_smb2_lock_state);
727 /* Try and finish off getting all the outstanding locks. */
729 for (; blr->lock_num < state->lock_count; blr->lock_num++) {
730 struct byte_range_lock *br_lck = NULL;
731 struct smbd_lock_element *e = &state->locks[blr->lock_num];
733 br_lck = do_lock(smbd_messaging_context(),
742 &blr->blocking_smblctx,
747 if (NT_STATUS_IS_ERR(status)) {
752 if(blr->lock_num == state->lock_count) {
754 * Success - we got all the locks.
757 DEBUG(3,("reprocess_blocked_smb2_lock SUCCESS file = %s, "
758 "fnum=%d num_locks=%d\n",
761 (int)state->lock_count));
763 tevent_req_done(smb2req->subreq);
767 if (!NT_STATUS_EQUAL(status,NT_STATUS_LOCK_NOT_GRANTED) &&
768 !NT_STATUS_EQUAL(status,NT_STATUS_FILE_LOCK_CONFLICT)) {
770 * We have other than a "can't get lock"
771 * error. Return an error.
773 remove_pending_lock(state, blr);
774 tevent_req_nterror(smb2req->subreq, status);
779 * We couldn't get the locks for this record on the list.
780 * If the time has expired, return a lock error.
783 if (!timeval_is_zero(&blr->expire_time) &&
784 timeval_compare(&blr->expire_time, &tv_curr) <= 0) {
785 remove_pending_lock(state, blr);
786 tevent_req_nterror(smb2req->subreq, NT_STATUS_LOCK_NOT_GRANTED);
791 * Still can't get all the locks - keep waiting.
794 DEBUG(10,("reprocess_blocked_smb2_lock: only got %d locks of %d needed "
795 "for file %s, fnum = %d. Still waiting....\n",
797 (int)state->lock_count,
805 /****************************************************************
806 Attempt to proccess all outstanding blocking locks pending on
808 *****************************************************************/
810 void process_blocking_lock_queue_smb2(struct timeval tv_curr)
812 struct smbd_server_connection *sconn = smbd_server_conn;
813 struct smbd_smb2_request *smb2req, *nextreq;
815 for (smb2req = sconn->smb2.requests; smb2req; smb2req = nextreq) {
816 const uint8_t *inhdr;
818 nextreq = smb2req->next;
820 if (smb2req->subreq == NULL) {
821 /* This message has been processed. */
824 if (!tevent_req_is_in_progress(smb2req->subreq)) {
825 /* This message has been processed. */
829 inhdr = (const uint8_t *)smb2req->in.vector[smb2req->current_idx].iov_base;
830 if (SVAL(inhdr, SMB2_HDR_OPCODE) == SMB2_OP_LOCK) {
831 reprocess_blocked_smb2_lock(smb2req, tv_curr);
835 recalc_smb2_brl_timeout(sconn);
838 /****************************************************************************
839 Remove any locks on this fd. Called from file_close().
840 ****************************************************************************/
842 void cancel_pending_lock_requests_by_fid_smb2(files_struct *fsp,
843 struct byte_range_lock *br_lck,
844 enum file_close_type close_type)
846 struct smbd_server_connection *sconn = smbd_server_conn;
847 struct smbd_smb2_request *smb2req, *nextreq;
849 for (smb2req = sconn->smb2.requests; smb2req; smb2req = nextreq) {
850 struct smbd_smb2_lock_state *state = NULL;
851 files_struct *fsp_curr = NULL;
852 int i = smb2req->current_idx;
853 uint64_t in_file_id_volatile;
854 struct blocking_lock_record *blr = NULL;
855 const uint8_t *inhdr;
856 const uint8_t *inbody;
858 nextreq = smb2req->next;
860 if (smb2req->subreq == NULL) {
861 /* This message has been processed. */
864 if (!tevent_req_is_in_progress(smb2req->subreq)) {
865 /* This message has been processed. */
869 inhdr = (const uint8_t *)smb2req->in.vector[i].iov_base;
870 if (SVAL(inhdr, SMB2_HDR_OPCODE) != SMB2_OP_LOCK) {
871 /* Not a lock call. */
875 inbody = (const uint8_t *)smb2req->in.vector[i+1].iov_base;
876 in_file_id_volatile = BVAL(inbody, 0x10);
878 state = tevent_req_data(smb2req->subreq,
879 struct smbd_smb2_lock_state);
881 /* Strange - is this even possible ? */
885 fsp_curr = file_fsp(state->smb1req, (uint16_t)in_file_id_volatile);
886 if (fsp_curr == NULL) {
887 /* Strange - is this even possible ? */
891 if (fsp_curr != fsp) {
892 /* It's not our fid */
898 /* Remove the entries from the lock db. */
899 brl_lock_cancel(br_lck,
907 /* Finally end the request. */
908 if (close_type == SHUTDOWN_CLOSE) {
909 tevent_req_done(smb2req->subreq);
911 tevent_req_nterror(smb2req->subreq,
912 NT_STATUS_RANGE_NOT_LOCKED);