summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-04-08 08:29:23 +0200
committerVolker Lendecke <vl@samba.org>2009-04-12 14:56:23 +0200
commit3c10d065247c94ceb721b102402bc6c4aeefe33d (patch)
tree44252a43c1f753f6b53d66ea172aa0d59e55d2b2 /source3/smbd
parent602059a6ab8c4939dd453566415321b2b85706f4 (diff)
downloadsamba-3c10d065247c94ceb721b102402bc6c4aeefe33d.tar.gz
samba-3c10d065247c94ceb721b102402bc6c4aeefe33d.tar.bz2
samba-3c10d065247c94ceb721b102402bc6c4aeefe33d.zip
We have to deny a level 2 oplock if kernel oplocks are enabled
The second r/o opener of a file is supposed to get a level2 oplock. The first opener due to the protection in process_oplock_break_message() has been forced to break to no oplock. The second opener according to locking.tdb gets a level2 oplock. Further down in open_file_ntcreate we try to set this level2 oplock in the kernel, and the non-clustered Linux kernel disallows this. The rules for the kernel leases are a bit baroque, but the attempt to do the SETLEASE correctly fails and we end up with no oplock for any client. In the clustered case however the linux kernel on the second opening node has not seen the open fd of the first node, it is only the cluster fs that has this information. If the cluster fs does not have the very same notion of leases as the local kernel has, we can end up with a WRLCK style kernel lease for the second opener where locking.tdb only indicates a level2 oplock. Getting a kernel oplock break signal with just a level2 oplock in locking.tdb is something smbd is not prepared for. For example after sending out the break in response to the kernel signal we set a timeout, waiting for a reply. More work needs to be done to make level2 kernel oplocks real for us. This patch addresses a real problem we have right now without them.
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/oplock.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index b937e8e07d..e9b2a6cf95 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -58,6 +58,12 @@ void break_kernel_oplock(struct messaging_context *msg_ctx, files_struct *fsp)
bool set_file_oplock(files_struct *fsp, int oplock_type)
{
+ if ((fsp->oplock_type == LEVEL_II_OPLOCK)
+ && koplocks && !(koplocks->flags & KOPLOCKS_LEVEL2_SUPPORTED)) {
+ DEBUG(10, ("Refusing level2 oplock, kernel oplocks don't "
+ "support them\n"));
+ return false;
+ }
if ((fsp->oplock_type != NO_OPLOCK) &&
(fsp->oplock_type != FAKE_LEVEL_II_OPLOCK) &&
koplocks &&