Print this page
NEX-1643 dtrace provider for smbsrv
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Matt Barden <matt.barden@nexenta.com>
NEX-6041 Should pass the smbtorture lock tests
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>

*** 19,28 **** --- 19,30 ---- * CDDL HEADER END */ /* * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * + * Copyright 2017 Nexenta Systems, Inc. All rights reserved. */ /* * SMB: lock_byte_range * * The lock record message is sent to lock the given byte range. More than
*** 60,84 **** #include <smbsrv/smb_kproto.h> smb_sdrc_t smb_pre_lock_byte_range(smb_request_t *sr) { ! DTRACE_SMB_1(op__LockByteRange__start, smb_request_t *, sr); return (SDRC_SUCCESS); } void smb_post_lock_byte_range(smb_request_t *sr) { ! DTRACE_SMB_1(op__LockByteRange__done, smb_request_t *, sr); } smb_sdrc_t smb_com_lock_byte_range(struct smb_request *sr) { uint32_t count; uint32_t off; DWORD result; int rc; if (smbsr_decode_vwv(sr, "wll", &sr->smb_fid, &count, &off) != 0) return (SDRC_ERROR); --- 62,90 ---- #include <smbsrv/smb_kproto.h> smb_sdrc_t smb_pre_lock_byte_range(smb_request_t *sr) { ! DTRACE_SMB_START(op__LockByteRange, smb_request_t *, sr); return (SDRC_SUCCESS); } void smb_post_lock_byte_range(smb_request_t *sr) { ! DTRACE_SMB_DONE(op__LockByteRange, smb_request_t *, sr); } + /* + * Legacy SMB command; takes an exclusive byte-range lock + */ smb_sdrc_t smb_com_lock_byte_range(struct smb_request *sr) { uint32_t count; uint32_t off; + uint32_t lk_pid; DWORD result; int rc; if (smbsr_decode_vwv(sr, "wll", &sr->smb_fid, &count, &off) != 0) return (SDRC_ERROR);
*** 88,105 **** smbsr_error(sr, NT_STATUS_INVALID_HANDLE, ERRDOS, ERRbadfid); return (SDRC_ERROR); } ! /* ! * The last parameter is lock type. This is dependent on ! * lock flag (3rd parameter). Since the lock flag is ! * set to be exclusive, lock type is passed as ! * normal lock (write lock). ! */ ! result = smb_lock_range(sr, (u_offset_t)off, (uint64_t)count, 0, ! SMB_LOCK_TYPE_READWRITE); if (result != NT_STATUS_SUCCESS) { smb_lock_range_error(sr, result); return (SDRC_ERROR); } --- 94,108 ---- smbsr_error(sr, NT_STATUS_INVALID_HANDLE, ERRDOS, ERRbadfid); return (SDRC_ERROR); } ! /* Note: SMB1 locking uses 16-bit PIDs. */ ! lk_pid = sr->smb_pid & 0xFFFF; ! ! result = smb_lock_range(sr, (u_offset_t)off, (uint64_t)count, ! lk_pid, SMB_LOCK_TYPE_READWRITE, 0); if (result != NT_STATUS_SUCCESS) { smb_lock_range_error(sr, result); return (SDRC_ERROR); }