[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Thu Jun 20 18:35:02 UTC 2019
The branch, master has been updated
via 4bbe291efcb vfs: Remove SMB_VFS_BRL_CANCEL_WINDOWS
via 871bb7562ca smbd: Remove unused brlock code
via b3284bef353 smbd: Cancel smbd_smb1_do_locks requests in reply_ntcancel
via f37c14dd632 smbd: Add a clarifying comment on triggering waiters
via d60a35bd75a smbd: Don't call cancel_pending_lock_requests_by_fid on close
via b091c19cb20 smbd: Base smb2_lock.c on tevent_req
via 6f204de7784 smbd: Use smbd_smb1_do_locks_send() in smb_set_posix_lock()
via 4c1d574ebea smbd: Use smbd_smb1_do_locks_send() in reply_lockingX()
via c4649b3ad6e smbd: Use smbd_smb1_do_locks_send() in reply_lock()
via 1967bb8538f smbd: Use smbd_smb1_do_locks_send() in reply_lockread()
via ab149a611f2 smbd: Remove SMB1 special case handling from brlock.c
via 2d746d1364e smbd: Ping dbwrap_watch on locking.tdb for in smbd_do_unlocking()
via fbbf684338d smbd: Add smbd_smb1_do_locks_send/recv()
via f0a9459e66b smbd: Slightly simplify smbd_smb2_lock_send()
via 67f89bb3300 smbd: Return "blocker_pid" from do_lock()
via ca73ba859ed smbd: Add some paranoia against NULL dereference
via 4adbeb9714b smbd: Add "blocker_pid" to brl_lock()
via b752e242a6a torture3: Test cancelling locking&x with ntcancel
via 56521c5fbf0 libsmb: Make cli_lockingx cancellable
via 3f6ed6e3523 torture3: Run a blocking lock&x call with a subsequent read
via b20231a1abb torture3: Test blocking posix locks
via 2f1a459b742 torture3: Test LOCKINGX_CANCEL without locks
via 7dec53ed0c1 torture3: Add a test to block a locking&read
via ff992d1c6c3 smbd: Use smbd_do_unlocking() in reply_unlock()
via 00b11867253 smbd: Use smbd_do_unlocking() in reply_writeunlock()
via 865c86bd327 smbd: Use smbd_do_unlocking() in smb_set_posix_lock()
via b3d533aa585 smbd: Add "lock_flav" to smbd_do_unlocking()
via 4d6152b1bfa smbd: Simplify smb_set_posix_lock()
via 10ba4aa6d5c smbd: Avoid casts in smb_set_posix_lock()
via 1736f7c5c5e smbd: Use NT_STATUS_IS_OK() in reply_unlock()
via 041608cb899 smbd: Avoid casts in reply_unlock()
via 7fe67a47826 lib: Fix a typo
via a371d22feb2 smbd: Fix a typo
via 7fa0be8f63c tevent: Fix a typo
via c00c7bfb7e2 smbd: Only remove locks by mid if necessary
from 7f70e216fcd docs: fix typo in "ntlm auth" doc in smb.conf man page
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 4bbe291efcb389715651b2eb94330b6c36f83030
Author: Volker Lendecke <vl at samba.org>
Date: Thu Jun 20 13:42:12 2019 +0200
vfs: Remove SMB_VFS_BRL_CANCEL_WINDOWS
This is not called anymore, bump the VFS version number in a separate
commit
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Thu Jun 20 18:34:20 UTC 2019 on sn-devel-184
commit 871bb7562cad1d4a9dccab602880d2ef3fffd75c
Author: Volker Lendecke <vl at samba.org>
Date: Thu Jun 20 11:07:17 2019 +0200
smbd: Remove unused brlock code
No PENDING locks in brlock.tdb anymore.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit b3284bef3536328ff4ae965b5f34cec8ee9b8a3a
Author: Volker Lendecke <vl at samba.org>
Date: Wed Jun 19 22:00:25 2019 +0200
smbd: Cancel smbd_smb1_do_locks requests in reply_ntcancel
Last link to the specialized brlock queue
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit f37c14dd63285e108a9fc1050de9b14a288097cb
Author: Volker Lendecke <vl at samba.org>
Date: Wed Jun 19 16:08:49 2019 +0200
smbd: Add a clarifying comment on triggering waiters
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit d60a35bd75a0c427a593defe8fd3a7850f45ee5f
Author: Volker Lendecke <vl at samba.org>
Date: Wed Jun 19 15:49:46 2019 +0200
smbd: Don't call cancel_pending_lock_requests_by_fid on close
We don't use that queue anymore
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit b091c19cb2045e72b3a9a0b364f110ad88debe53
Author: Volker Lendecke <vl at samba.org>
Date: Sat Jun 15 15:23:50 2019 -0700
smbd: Base smb2_lock.c on tevent_req
smb2 locking is a lot more regular than reply_lockingX. So this is a
much smaller change.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 6f204de778490c7bffdc367de21d80fb410b227f
Author: Volker Lendecke <vl at samba.org>
Date: Fri Jun 14 15:17:12 2019 -0700
smbd: Use smbd_smb1_do_locks_send() in smb_set_posix_lock()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 4c1d574ebea5138eda1cfbdcab90d25618e0a4f3
Author: Volker Lendecke <vl at samba.org>
Date: Thu Jun 13 03:59:54 2019 -0700
smbd: Use smbd_smb1_do_locks_send() in reply_lockingX()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit c4649b3ad6e6c41731b21da0c75632c38209d69c
Author: Volker Lendecke <vl at samba.org>
Date: Thu Jun 13 03:56:13 2019 -0700
smbd: Use smbd_smb1_do_locks_send() in reply_lock()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 1967bb8538fdf36ea646b6036b1c539bde1e48f1
Author: Volker Lendecke <vl at samba.org>
Date: Thu Jun 13 03:48:31 2019 -0700
smbd: Use smbd_smb1_do_locks_send() in reply_lockread()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit ab149a611f23dc8f4b274bf1e8c73b3e5cd976c8
Author: Volker Lendecke <vl at samba.org>
Date: Thu Jun 13 03:46:01 2019 -0700
smbd: Remove SMB1 special case handling from brlock.c
This is now handled in smbd_smb1_do_locks_send/recv.
From here on for a few commits we won't survive make test.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 2d746d1364e24ca2936601508d4f06af28e9de5a
Author: Volker Lendecke <vl at samba.org>
Date: Thu Jun 13 03:58:02 2019 -0700
smbd: Ping dbwrap_watch on locking.tdb for in smbd_do_unlocking()
smbd_smb1_do_locks_send() watches the file's locking.tdb record for
changes, like the oplock code does. Unlocking a byte range thus must
trigger a retry.
With the share mode cache get_existing_share_mode_lock() is pretty
cheap. We have to write out the share mode record with the current
code, but an obvious optimization will be a share_mode_do_locked doing
all this without actually unmarshalling the locking.tdb entry. And --
there's precedence for this pattern in downgrade_lease()...
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit fbbf684338d7059e9dced229c3b0925fe154bd98
Author: Volker Lendecke <vl at samba.org>
Date: Thu Jun 13 03:38:57 2019 -0700
smbd: Add smbd_smb1_do_locks_send/recv()
This contains the SMB1-specific brlock logic. Right now our core
brlock code has specialized code to deal with pending locks. For
dealing with pending requests waiting for something nowadays we
recommend to use tevent_req. This code also provides the basis to
remove the SMB1 special case handling from the core logic, isolating
protocol features specific to SMB1 and not exposed in SMB2 in
SMB1-specific code.
The core brlock code will not see blocking locks anymore. Instead, the
code in this patch will always immediately fail and take care of the
retries and timeouts.
Retries are implemented by a dbwrap_watch_record_send on the
corresponding locking.tdb entry. A later commit will make unlocks
trigger wakeups there. I chose locking.tdb and not brlock itself to
simplify the implementation. We already have oplock break watchers on
locking.tdb, this will only add one more. This might lead to spurious
wakeups, but they are taken care of by careful retries. An advantage
of doing that is the implicit handling of a killed blocker PID through
dbwrap_watch, obsoleting brl_revalidate.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit f0a9459e66b93ba7b231aa6c0edc5270e0c13f55
Author: Volker Lendecke <vl at samba.org>
Date: Mon May 27 17:03:38 2019 +0200
smbd: Slightly simplify smbd_smb2_lock_send()
For unlocking we don't need the error mapping, do an early return
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 67f89bb3300a4cedd2bb01f81a6ede21b05377e0
Author: Volker Lendecke <vl at samba.org>
Date: Thu Jun 20 12:20:39 2019 +0200
smbd: Return "blocker_pid" from do_lock()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit ca73ba859ed91f272504c31d1f56f9315b7ef5c0
Author: Volker Lendecke <vl at samba.org>
Date: Thu Jun 20 12:42:23 2019 +0200
smbd: Add some paranoia against NULL dereference
Quite a few callers set "psmblctx" to NULL, and I could not really
follow 100% that brl_lock only assigns that in the blocking lock
case. Too many layers :-)
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 4adbeb9714beb9194a6f350fdf89dfcb7dd04226
Author: Volker Lendecke <vl at samba.org>
Date: Thu Jun 20 12:05:30 2019 +0200
smbd: Add "blocker_pid" to brl_lock()
Soon we will wait on a conflicting lock to become free via
dbwrap_watched_watch_send. That routine can take a server_id that
blocks us, watching it to go away. To use that, we need to know which
PID it is that blocks us.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit b752e242a6a963253d54a16b2a071f2cfa9797ce
Author: Volker Lendecke <vl at samba.org>
Date: Thu Jun 20 10:46:21 2019 +0200
torture3: Test cancelling locking&x with ntcancel
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 56521c5fbf0bea3dcf0d58a686879485a939b7af
Author: Volker Lendecke <vl at samba.org>
Date: Wed Jun 19 20:47:24 2019 +0200
libsmb: Make cli_lockingx cancellable
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 3f6ed6e35239507ebe78091b9e1b4af7b644e3fd
Author: Volker Lendecke <vl at samba.org>
Date: Wed Jun 19 17:50:54 2019 +0200
torture3: Run a blocking lock&x call with a subsequent read
Samba aborts the read&x after a blocked, but eventually successful
locking&x call. Both Windows and source4/ntvfs do the read properly,
source3/smbd does not. With later code, this will become possible much
easier. Lets see if it's worth it given that we've got away with this
forever.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit b20231a1abb6d790dcb667f7010ec3b0b1ecb00b
Author: Volker Lendecke <vl at samba.org>
Date: Fri Jun 14 21:55:09 2019 -0700
torture3: Test blocking posix locks
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 2f1a459b7425db316d6c066115889134e67fa2cd
Author: Volker Lendecke <vl at samba.org>
Date: Mon Jun 3 11:00:25 2019 +0200
torture3: Test LOCKINGX_CANCEL without locks
Tested against W2012R2
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 7dec53ed0c1c58b4ab7b7483b2da3e4cd58750fa
Author: Volker Lendecke <vl at samba.org>
Date: Thu May 30 10:38:41 2019 +0200
torture3: Add a test to block a locking&read
Right now we fail this with smbd, we return LOCK_NOT_GRANTED instead
of FILE_LOCK_CONFLICT. This will change with later commits.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit ff992d1c6c3c6327893f0505a5d03087777087ee
Author: Volker Lendecke <vl at samba.org>
Date: Fri Jun 14 05:34:08 2019 -0700
smbd: Use smbd_do_unlocking() in reply_unlock()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 00b11867253e837d1c369470c83224d130c73304
Author: Volker Lendecke <vl at samba.org>
Date: Fri Jun 14 04:48:58 2019 -0700
smbd: Use smbd_do_unlocking() in reply_writeunlock()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 865c86bd327703be36db64a1b96e7ba96551928e
Author: Volker Lendecke <vl at samba.org>
Date: Fri Jun 14 04:45:05 2019 -0700
smbd: Use smbd_do_unlocking() in smb_set_posix_lock()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit b3d533aa585a6d69855f10fafbf6d68e98597996
Author: Volker Lendecke <vl at samba.org>
Date: Fri Jun 14 04:39:04 2019 -0700
smbd: Add "lock_flav" to smbd_do_unlocking()
The next commits will pass all direct "do_unlock" calls through
smbd_do_unlocking(). Why? Unlocking will later on require that we take
the share mode lock for the file in question while the unlock is
happening, and this should be in one central place.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 4d6152b1bfa7b5c624a26bcf1e662d77faffb4f2
Author: Volker Lendecke <vl at samba.org>
Date: Thu Jun 13 12:19:35 2019 -0700
smbd: Simplify smb_set_posix_lock()
Instead of reading twice from pdata, use a switch statement
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 10ba4aa6d5cf68cad35e7fab92b2f494f1b2d85c
Author: Volker Lendecke <vl at samba.org>
Date: Thu Jun 13 12:12:59 2019 -0700
smbd: Avoid casts in smb_set_posix_lock()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 1736f7c5c5e27d8b50a969da0be74ecb3a17e47b
Author: Volker Lendecke <vl at samba.org>
Date: Fri Jun 14 05:33:03 2019 -0700
smbd: Use NT_STATUS_IS_OK() in reply_unlock()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 041608cb89958bb85e7c57040abdd0c6851651af
Author: Volker Lendecke <vl at samba.org>
Date: Fri Jun 14 05:00:35 2019 -0700
smbd: Avoid casts in reply_unlock()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 7fe67a47826f7e2609088f02716e91b91c33f7c4
Author: Volker Lendecke <vl at samba.org>
Date: Wed Jun 19 11:45:30 2019 +0200
lib: Fix a typo
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit a371d22feb2ae4afbc19f306cf25f1d7ba1b131f
Author: Volker Lendecke <vl at samba.org>
Date: Fri Jun 14 10:08:57 2019 -0700
smbd: Fix a typo
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 7fa0be8f63c13d2f1957551e298a154332cf9d04
Author: Volker Lendecke <vl at samba.org>
Date: Wed Jun 12 02:19:32 2019 -0700
tevent: Fix a typo
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit c00c7bfb7e275cce89ec95b7e282dda1dee97d48
Author: Volker Lendecke <vl at samba.org>
Date: Wed Jun 19 21:15:38 2019 +0200
smbd: Only remove locks by mid if necessary
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
-----------------------------------------------------------------------
Summary of changes:
examples/VFS/skel_opaque.c | 9 -
examples/VFS/skel_transparent.c | 8 -
lib/tevent/tevent.h | 2 +-
librpc/idl/messaging.idl | 4 +-
selftest/knownfail | 3 +
selftest/skip | 1 +
source3/include/locking.h | 4 +-
source3/include/proto.h | 3 -
source3/include/vfs.h | 30 +-
source3/include/vfs_macros.h | 5 -
source3/lib/smbd_shim.c | 10 -
source3/lib/smbd_shim.h | 3 -
source3/libsmb/clifile.c | 16 +
source3/libsmb/trusts_util.c | 2 +-
source3/locking/brlock.c | 350 +---------
source3/locking/locking.c | 73 +-
source3/locking/proto.h | 20 +-
source3/modules/vfs_default.c | 11 -
source3/modules/vfs_fruit.c | 60 +-
source3/modules/vfs_full_audit.c | 20 -
source3/modules/vfs_glusterfs.c | 1 -
source3/modules/vfs_not_implemented.c | 9 -
source3/modules/vfs_time_audit.c | 22 -
source3/selftest/tests.py | 8 +-
source3/smbd/blocking.c | 1224 +++++++++++----------------------
source3/smbd/close.c | 6 +
source3/smbd/globals.h | 46 +-
source3/smbd/notify.c | 5 +-
source3/smbd/nttrans.c | 7 +-
source3/smbd/open.c | 2 +-
source3/smbd/proto.h | 67 +-
source3/smbd/reply.c | 614 +++++++++--------
source3/smbd/server.c | 82 ---
source3/smbd/smb2_close.c | 12 +
source3/smbd/smb2_lock.c | 650 ++++-------------
source3/smbd/smbd_cleanupd.c | 21 -
source3/smbd/trans2.c | 147 ++--
source3/torture/torture.c | 1102 +++++++++++++++++++++++++++++
source3/utils/smbcontrol.c | 40 --
source3/utils/status.c | 2 -
40 files changed, 2212 insertions(+), 2489 deletions(-)
Changeset truncated at 500 lines:
diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c
index 6510ef30d6f..6628bffe3eb 100644
--- a/examples/VFS/skel_opaque.c
+++ b/examples/VFS/skel_opaque.c
@@ -655,14 +655,6 @@ static bool skel_brl_unlock_windows(struct vfs_handle_struct *handle,
return false;
}
-static bool skel_brl_cancel_windows(struct vfs_handle_struct *handle,
- struct byte_range_lock *br_lck,
- struct lock_struct *plock)
-{
- errno = ENOSYS;
- return false;
-}
-
static bool skel_strict_lock_check(struct vfs_handle_struct *handle,
struct files_struct *fsp,
struct lock_struct *plock)
@@ -1104,7 +1096,6 @@ static struct vfs_fn_pointers skel_opaque_fns = {
.connectpath_fn = skel_connectpath,
.brl_lock_windows_fn = skel_brl_lock_windows,
.brl_unlock_windows_fn = skel_brl_unlock_windows,
- .brl_cancel_windows_fn = skel_brl_cancel_windows,
.strict_lock_check_fn = skel_strict_lock_check,
.translate_name_fn = skel_translate_name,
.fsctl_fn = skel_fsctl,
diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c
index fc892a23208..9b5f336042e 100644
--- a/examples/VFS/skel_transparent.c
+++ b/examples/VFS/skel_transparent.c
@@ -827,13 +827,6 @@ static bool skel_brl_unlock_windows(struct vfs_handle_struct *handle,
return SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle, msg_ctx, br_lck, plock);
}
-static bool skel_brl_cancel_windows(struct vfs_handle_struct *handle,
- struct byte_range_lock *br_lck,
- struct lock_struct *plock)
-{
- return SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle, br_lck, plock);
-}
-
static bool skel_strict_lock_check(struct vfs_handle_struct *handle,
struct files_struct *fsp,
struct lock_struct *plock)
@@ -1367,7 +1360,6 @@ static struct vfs_fn_pointers skel_transparent_fns = {
.connectpath_fn = skel_connectpath,
.brl_lock_windows_fn = skel_brl_lock_windows,
.brl_unlock_windows_fn = skel_brl_unlock_windows,
- .brl_cancel_windows_fn = skel_brl_cancel_windows,
.strict_lock_check_fn = skel_strict_lock_check,
.translate_name_fn = skel_translate_name,
.fsctl_fn = skel_fsctl,
diff --git a/lib/tevent/tevent.h b/lib/tevent/tevent.h
index 2ec7330e249..3c3e3cc2cef 100644
--- a/lib/tevent/tevent.h
+++ b/lib/tevent/tevent.h
@@ -1685,7 +1685,7 @@ struct timeval tevent_timeval_add(const struct timeval *tv, uint32_t secs,
*
* @param[in] usecs The microseconds of the offset from now.
*
- * @return A timval with the given offset in the future.
+ * @return A timeval with the given offset in the future.
*/
struct timeval tevent_timeval_current_ofs(uint32_t secs, uint32_t usecs);
diff --git a/librpc/idl/messaging.idl b/librpc/idl/messaging.idl
index c2f62f673b2..f355c7503d9 100644
--- a/librpc/idl/messaging.idl
+++ b/librpc/idl/messaging.idl
@@ -67,7 +67,7 @@ interface messaging
MSG_SMB_FORCE_TDIS = 0x0302,
/* MSG_SMB_SAM_SYNC = 0x0303, Obsoleted */
/* MSG_SMB_SAM_REPL = 0x0304, Obsoleted */
- MSG_SMB_UNLOCK = 0x0305,
+ /* MSG_SMB_UNLOCK = 0x0305, Obsoleted */
MSG_SMB_BREAK_REQUEST = 0x0306,
/* MSG_SMB_BREAK_RESPONSE = 0x0307, Obsoleted */
/* MSG_SMB_ASYNC_LEVEL2_BREAK = 0x0308, Obsoleted */
@@ -83,7 +83,7 @@ interface messaging
MSG_PVFS_NOTIFY = 0x0310,
/* cluster reconfigure events */
- MSG_SMB_BRL_VALIDATE = 0x0311,
+ /* MSG_SMB_BRL_VALIDATE = 0x0311, Oboleted */
/*Close a specific file given a share entry. */
MSG_SMB_CLOSE_FILE = 0x0313,
diff --git a/selftest/knownfail b/selftest/knownfail
index 2c31bf91619..ded80b12259 100644
--- a/selftest/knownfail
+++ b/selftest/knownfail
@@ -9,9 +9,12 @@
^samba3.smbtorture_s3.crypt_server\(nt4_dc\).SMB2-SESSION-REAUTH # expected to give ACCESS_DENIED SMB2.1 doesn't have encryption
^samba3.smbtorture_s3.crypt_server\(nt4_dc\).SMB2-SESSION-RECONNECT # expected to give CONNECTION_DISCONNECTED, we need to fix the test
^samba3.smbtorture_s3.plain.*SMB2-DIR-FSYNC.*\(ad_dc_ntvfs\)
+^samba3.smbtorture_s3.plain.LOCK11.*\(ad_dc_ntvfs\)
^samba3.smb2.session enc.reconnect # expected to give CONNECTION_DISCONNECTED, we need to fix the test
^samba3.raw.session enc # expected to give ACCESS_DENIED as SMB1 encryption isn't used
^samba3.smbtorture_s3.crypt_server # expected to give ACCESS_DENIED as SMB1 encryption isn't used
+^samba3.smbtorture_s3.*.LOCK12.*\(fileserver\)
+^samba3.smbtorture_s3.*.LOCK12.*\(nt4_dc\)
^samba3.nbt.dgram.*netlogon2\(nt4_dc\)
^samba3.*rap.sam.*.useradd # Not provided by Samba 3
^samba3.*rap.sam.*.userdelete # Not provided by Samba 3
diff --git a/selftest/skip b/selftest/skip
index e628d7ccc85..bdf3c71893d 100644
--- a/selftest/skip
+++ b/selftest/skip
@@ -49,6 +49,7 @@
^samba3.smbtorture_s3.plain.POSIX-OFD-LOCK\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server
^samba3.smbtorture_s3.plain.POSIX-STREAM-DELETE\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server
^samba3.smbtorture_s3.plain.POSIX-MKDIR\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server
+^samba3.smbtorture_s3.plain.POSIX-BLOCKING-LOCK\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server
^samba3.smbtorture_s3.plain.WINDOWS-BAD-SYMLINK\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server
^samba3.smbtorture_s3.plain.RENAME-ACCESS\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server
^samba3.smbtorture_s3.plain.OWNER-RIGHTS\(ad_dc_ntvfs\) # Don't test against the s4 ntvfs server anymore
diff --git a/source3/include/locking.h b/source3/include/locking.h
index 97c138aead9..4cb75202d1a 100644
--- a/source3/include/locking.h
+++ b/source3/include/locking.h
@@ -26,11 +26,9 @@
PENDING read and write locks to allow posix lock downgrades to trigger a lock
re-evaluation. */
-enum brl_type {READ_LOCK, WRITE_LOCK, PENDING_READ_LOCK, PENDING_WRITE_LOCK, UNLOCK_LOCK};
+enum brl_type {READ_LOCK, WRITE_LOCK, UNLOCK_LOCK};
enum brl_flavour {WINDOWS_LOCK = 0, POSIX_LOCK = 1};
-#define IS_PENDING_LOCK(type) ((type) == PENDING_READ_LOCK || (type) == PENDING_WRITE_LOCK)
-
#include "librpc/gen_ndr/server_id.h"
/* This contains elements that differentiate locks. The smbpid is a
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 93d01a06be0..484afc959b9 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -996,9 +996,6 @@ void unbecome_root(void);
/* The following definitions come from lib/smbd_shim.c */
int find_service(TALLOC_CTX *ctx, const char *service_in, char **p_service_out);
-void cancel_pending_lock_requests_by_fid(files_struct *fsp,
- struct byte_range_lock *br_lck,
- enum file_close_type close_type);
void send_stat_cache_delete_message(struct messaging_context *msg_ctx,
const char *name);
NTSTATUS can_delete_directory_fsp(files_struct *fsp);
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index 10d7fb0621a..4727fc029da 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -259,8 +259,10 @@
/* Bump to version 40, Samba 4.10 will ship with that */
/* Version 40 - Add SMB_VFS_GETXATTRAT_SEND/RECV */
/* Version 40 - Add SMB_VFS_GET_DOS_ATTRIBUTES_SEND/RECV */
+/* Bump to version 41, Samba 4.11 will ship with that */
+/* Version 41 - Remove SMB_VFS_BRL_CANCEL_WINDOWS */
-#define SMB_VFS_INTERFACE_VERSION 40
+#define SMB_VFS_INTERFACE_VERSION 41
/*
All intercepted VFS operations must be declared as static functions inside module source
@@ -384,6 +386,22 @@ typedef struct files_struct {
*/
unsigned num_aio_requests;
struct tevent_req **aio_requests;
+ bool closing;
+
+ /*
+ * Requests waiting for smb1 byte range locks. They are
+ * generated by smbd_smb1_do_locks_send and are required here,
+ * because lock cancel operations index through reply_lockingX
+ * not based on mid but on the lock type and range.
+ */
+ struct tevent_req **blocked_smb1_lock_reqs;
+
+ /*
+ * SMB1 remembers lock failures and delays repeated blocking
+ * lock attempts on the same offset.
+ */
+ bool lock_failure_seen;
+ uint64_t lock_failure_offset;
/*
* If a close request comes in while we still have aio_requests
@@ -854,10 +872,6 @@ struct vfs_fn_pointers {
struct byte_range_lock *br_lck,
const struct lock_struct *plock);
- bool (*brl_cancel_windows_fn)(struct vfs_handle_struct *handle,
- struct byte_range_lock *br_lck,
- struct lock_struct *plock);
-
bool (*strict_lock_check_fn)(struct vfs_handle_struct *handle,
struct files_struct *fsp,
struct lock_struct *plock);
@@ -1329,9 +1343,6 @@ bool smb_vfs_call_brl_unlock_windows(struct vfs_handle_struct *handle,
struct messaging_context *msg_ctx,
struct byte_range_lock *br_lck,
const struct lock_struct *plock);
-bool smb_vfs_call_brl_cancel_windows(struct vfs_handle_struct *handle,
- struct byte_range_lock *br_lck,
- struct lock_struct *plock);
bool smb_vfs_call_strict_lock_check(struct vfs_handle_struct *handle,
struct files_struct *fsp,
struct lock_struct *plock);
@@ -1793,9 +1804,6 @@ bool vfs_not_implemented_brl_unlock_windows(struct vfs_handle_struct *handle,
struct messaging_context *msg_ctx,
struct byte_range_lock *br_lck,
const struct lock_struct *plock);
-bool vfs_not_implemented_brl_cancel_windows(struct vfs_handle_struct *handle,
- struct byte_range_lock *br_lck,
- struct lock_struct *plock);
bool vfs_not_implemented_strict_lock_check(struct vfs_handle_struct *handle,
struct files_struct *fsp,
struct lock_struct *plock);
diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h
index 7a0f14ef08d..e867810f30f 100644
--- a/source3/include/vfs_macros.h
+++ b/source3/include/vfs_macros.h
@@ -356,11 +356,6 @@
#define SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle, msg_ctx, br_lck, plock) \
smb_vfs_call_brl_unlock_windows((handle)->next, (msg_ctx), (br_lck), (plock))
-#define SMB_VFS_BRL_CANCEL_WINDOWS(conn, br_lck, plock) \
- smb_vfs_call_brl_cancel_windows((conn)->vfs_handles, (br_lck), (plock))
-#define SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle, br_lck, plock) \
- smb_vfs_call_brl_cancel_windows((handle)->next, (br_lck), (plock))
-
#define SMB_VFS_STRICT_LOCK_CHECK(conn, fsp, plock) \
smb_vfs_call_strict_lock_check((conn)->vfs_handles, (fsp), (plock))
#define SMB_VFS_NEXT_STRICT_LOCK_CHECK(handle, fsp, plock) \
diff --git a/source3/lib/smbd_shim.c b/source3/lib/smbd_shim.c
index 1b5b4e6ca52..a6e3695096d 100644
--- a/source3/lib/smbd_shim.c
+++ b/source3/lib/smbd_shim.c
@@ -32,16 +32,6 @@ void set_smbd_shim(const struct smbd_shim *shim_functions)
shim = *shim_functions;
}
-void cancel_pending_lock_requests_by_fid(files_struct *fsp,
- struct byte_range_lock *br_lck,
- enum file_close_type close_type)
-{
- if (shim.cancel_pending_lock_requests_by_fid) {
-
- shim.cancel_pending_lock_requests_by_fid(fsp, br_lck, close_type);
- }
-}
-
void send_stat_cache_delete_message(struct messaging_context *msg_ctx,
const char *name)
{
diff --git a/source3/lib/smbd_shim.h b/source3/lib/smbd_shim.h
index f3da5859027..19ce7acd50e 100644
--- a/source3/lib/smbd_shim.h
+++ b/source3/lib/smbd_shim.h
@@ -29,9 +29,6 @@
struct smbd_shim
{
- void (*cancel_pending_lock_requests_by_fid)(files_struct *fsp,
- struct byte_range_lock *br_lck,
- enum file_close_type close_type);
void (*send_stat_cache_delete_message)(struct messaging_context *msg_ctx,
const char *name);
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c
index 3738904f894..e696b536093 100644
--- a/source3/libsmb/clifile.c
+++ b/source3/libsmb/clifile.c
@@ -3434,9 +3434,11 @@ static uint8_t *cli_lockingx_put_locks(
struct cli_lockingx_state {
uint16_t vwv[8];
struct iovec bytes;
+ struct tevent_req *subreq;
};
static void cli_lockingx_done(struct tevent_req *subreq);
+static bool cli_lockingx_cancel(struct tevent_req *req);
struct tevent_req *cli_lockingx_create(
TALLOC_CTX *mem_ctx,
@@ -3515,6 +3517,7 @@ struct tevent_req *cli_lockingx_send(
const struct smb1_lock_element *locks)
{
struct tevent_req *req = NULL, *subreq = NULL;
+ struct cli_lockingx_state *state = NULL;
NTSTATUS status;
req = cli_lockingx_create(
@@ -3533,11 +3536,14 @@ struct tevent_req *cli_lockingx_send(
if (req == NULL) {
return NULL;
}
+ state = tevent_req_data(req, struct cli_lockingx_state);
+ state->subreq = subreq;
status = smb1cli_req_chain_submit(&subreq, 1);
if (tevent_req_nterror(req, status)) {
return tevent_req_post(req, ev);
}
+ tevent_req_set_cancel_fn(req, cli_lockingx_cancel);
return req;
}
@@ -3548,6 +3554,16 @@ static void cli_lockingx_done(struct tevent_req *subreq)
tevent_req_simple_finish_ntstatus(subreq, status);
}
+static bool cli_lockingx_cancel(struct tevent_req *req)
+{
+ struct cli_lockingx_state *state = tevent_req_data(
+ req, struct cli_lockingx_state);
+ if (state->subreq == NULL) {
+ return false;
+ }
+ return tevent_req_cancel(state->subreq);
+}
+
NTSTATUS cli_lockingx_recv(struct tevent_req *req)
{
return tevent_req_simple_recv_ntstatus(req);
diff --git a/source3/libsmb/trusts_util.c b/source3/libsmb/trusts_util.c
index 3ebf67f231e..0f0541a26b9 100644
--- a/source3/libsmb/trusts_util.c
+++ b/source3/libsmb/trusts_util.c
@@ -354,7 +354,7 @@ NTSTATUS trust_pw_change(struct netlogon_creds_cli_context *context,
}
/*
- * We use the password that's already persitent in
+ * We use the password that's already persistent in
* our database in order to handle failures.
*/
data_blob_clear_free(&new_trust_pw_blob);
diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c
index 5a4bd0d5c06..00462a31c78 100644
--- a/source3/locking/brlock.c
+++ b/source3/locking/brlock.c
@@ -142,10 +142,6 @@ static bool brl_overlap(const struct lock_struct *lck1,
static bool brl_conflict(const struct lock_struct *lck1,
const struct lock_struct *lck2)
{
- /* Ignore PENDING locks. */
- if (IS_PENDING_LOCK(lck1->lock_type) || IS_PENDING_LOCK(lck2->lock_type))
- return False;
-
/* Read locks never conflict. */
if (lck1->lock_type == READ_LOCK && lck2->lock_type == READ_LOCK) {
return False;
@@ -176,10 +172,6 @@ static bool brl_conflict_posix(const struct lock_struct *lck1,
SMB_ASSERT(lck2->lock_flav == POSIX_LOCK);
#endif
- /* Ignore PENDING locks. */
- if (IS_PENDING_LOCK(lck1->lock_type) || IS_PENDING_LOCK(lck2->lock_type))
- return False;
-
/* Read locks never conflict. */
if (lck1->lock_type == READ_LOCK && lck2->lock_type == READ_LOCK) {
return False;
@@ -199,9 +191,6 @@ static bool brl_conflict_posix(const struct lock_struct *lck1,
static bool brl_conflict1(const struct lock_struct *lck1,
const struct lock_struct *lck2)
{
- if (IS_PENDING_LOCK(lck1->lock_type) || IS_PENDING_LOCK(lck2->lock_type))
- return False;
-
if (lck1->lock_type == READ_LOCK && lck2->lock_type == READ_LOCK) {
return False;
}
@@ -233,11 +222,6 @@ static bool brl_conflict1(const struct lock_struct *lck1,
static bool brl_conflict_other(const struct lock_struct *lock,
const struct lock_struct *rw_probe)
{
- if (IS_PENDING_LOCK(lock->lock_type) ||
- IS_PENDING_LOCK(rw_probe->lock_type)) {
- return False;
- }
-
if (lock->lock_type == READ_LOCK && rw_probe->lock_type == READ_LOCK) {
return False;
}
@@ -291,58 +275,6 @@ static bool brl_conflict_other(const struct lock_struct *lock,
return false;
}
-/****************************************************************************
- Check if an unlock overlaps a pending lock.
-****************************************************************************/
-
-static bool brl_pending_overlap(const struct lock_struct *lock,
- const struct lock_struct *pend_lock)
-{
- if ((lock->start <= pend_lock->start) &&
- (lock->start + lock->size > pend_lock->start)) {
- return true;
- }
- if ((lock->start >= pend_lock->start) &&
- (lock->start < pend_lock->start + pend_lock->size)) {
- return true;
- }
- return false;
-}
-
-/****************************************************************************
- Amazingly enough, w2k3 "remembers" whether the last lock failure on a fnum
- is the same as this one and changes its error code. I wonder if any
- app depends on this ?
-****************************************************************************/
-
-static NTSTATUS brl_lock_failed(files_struct *fsp,
- const struct lock_struct *lock,
- bool blocking_lock)
-{
- if (lock->start >= 0xEF000000 && (lock->start >> 63) == 0) {
- /* amazing the little things you learn with a test
- suite. Locks beyond this offset (as a 64 bit
- number!) always generate the conflict error code,
- unless the top bit is set */
- if (!blocking_lock) {
- fsp->last_lock_failure = *lock;
- }
- return NT_STATUS_FILE_LOCK_CONFLICT;
- }
-
- if (serverid_equal(&lock->context.pid, &fsp->last_lock_failure.context.pid) &&
- lock->context.tid == fsp->last_lock_failure.context.tid &&
- lock->fnum == fsp->last_lock_failure.fnum &&
- lock->start == fsp->last_lock_failure.start) {
- return NT_STATUS_FILE_LOCK_CONFLICT;
- }
-
- if (!blocking_lock) {
- fsp->last_lock_failure = *lock;
- }
- return NT_STATUS_LOCK_NOT_GRANTED;
-}
-
/****************************************************************************
Open up the brlock.tdb database.
****************************************************************************/
@@ -442,7 +374,7 @@ NTSTATUS brl_lock_windows_default(struct byte_range_lock *br_lck,
}
/* Remember who blocked us. */
plock->context.smblctx = locks[i].context.smblctx;
- return brl_lock_failed(fsp,plock,blocking_lock);
+ return NT_STATUS_LOCK_NOT_GRANTED;
}
#if ZERO_ZERO
if (plock->start == 0 && plock->size == 0 &&
@@ -452,15 +384,13 @@ NTSTATUS brl_lock_windows_default(struct byte_range_lock *br_lck,
#endif
}
- if (!IS_PENDING_LOCK(plock->lock_type)) {
- contend_level2_oplocks_begin(fsp, LEVEL2_CONTEND_WINDOWS_BRL);
- }
+ contend_level2_oplocks_begin(fsp, LEVEL2_CONTEND_WINDOWS_BRL);
/* We can get the Windows lock, now see if it needs to
be mapped into a lower level POSIX one, and if so can
we get it ? */
- if (!IS_PENDING_LOCK(plock->lock_type) && lp_posix_locking(fsp->conn->params)) {
+ if (lp_posix_locking(fsp->conn->params)) {
int errno_ret;
if (!set_posix_lock_windows_flavour(fsp,
plock->start,
@@ -499,9 +429,7 @@ NTSTATUS brl_lock_windows_default(struct byte_range_lock *br_lck,
return NT_STATUS_OK;
fail:
- if (!IS_PENDING_LOCK(plock->lock_type)) {
- contend_level2_oplocks_end(fsp, LEVEL2_CONTEND_WINDOWS_BRL);
- }
+ contend_level2_oplocks_end(fsp, LEVEL2_CONTEND_WINDOWS_BRL);
return status;
}
@@ -806,7 +734,6 @@ static NTSTATUS brl_lock_posix(struct messaging_context *msg_ctx,
unsigned int i, count, posix_count;
struct lock_struct *locks = br_lck->lock_data;
struct lock_struct *tp;
- bool signal_pending_read = False;
bool break_oplocks = false;
NTSTATUS status;
@@ -834,13 +761,6 @@ static NTSTATUS brl_lock_posix(struct messaging_context *msg_ctx,
for (i=0; i < br_lck->num_locks; i++) {
struct lock_struct *curr_lock = &locks[i];
- /* If we have a pending read lock, a lock downgrade should
- trigger a lock re-evaluation. */
- if (curr_lock->lock_type == PENDING_READ_LOCK &&
- brl_pending_overlap(plock, curr_lock)) {
- signal_pending_read = True;
--
Samba Shared Repository
More information about the samba-cvs
mailing list