[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Wed Apr 11 14:46:03 MDT 2012
The branch, master has been updated
via 2927ca3 s3:smbd only care about missing level2 support if kernel oplocks are enabled
via fbfbc6a s3:smbd only initialize kernel oplocks if they are enabled for a share
via 1d9a3d4 s3:smbd add seperate function to initialize kernel oplocks
via 639a775 docs: update kernel oplocks documentation
via 2a36408 s3:param convert kernel oplocks to share parameter
from 30203bd build: Fix spelling of tevent
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 2927ca36706bf2e9b2b0458bbb1dfb493ea8e208
Author: Christian Ambach <ambi at samba.org>
Date: Fri Mar 30 16:11:08 2012 +0200
s3:smbd only care about missing level2 support if kernel oplocks are enabled
if kernel oplocks are not enabled for that share, we can grant level2 oplocks
Signed-off-by: Jeremy Allison <jra at samba.org>
Autobuild-User: Jeremy Allison <jra at samba.org>
Autobuild-Date: Wed Apr 11 22:45:21 CEST 2012 on sn-devel-104
commit fbfbc6a252d3ab4e61d85abb7bc25e08f7b519eb
Author: Christian Ambach <ambi at samba.org>
Date: Fri Mar 30 16:00:15 2012 +0200
s3:smbd only initialize kernel oplocks if they are enabled for a share
Signed-off-by: Jeremy Allison <jra at samba.org>
commit 1d9a3d488db2a9575ea1dc954c4d14b7d0a20204
Author: Christian Ambach <ambi at samba.org>
Date: Fri Mar 30 15:51:25 2012 +0200
s3:smbd add seperate function to initialize kernel oplocks
Signed-off-by: Jeremy Allison <jra at samba.org>
commit 639a775866230fd1fb1a44d0f4e27522d9ade93a
Author: Christian Ambach <ambi at samba.org>
Date: Fri Mar 30 16:11:37 2012 +0200
docs: update kernel oplocks documentation
Signed-off-by: Jeremy Allison <jra at samba.org>
commit 2a36408d4020b67d94f8750951bfead069ca1206
Author: Christian Ambach <ambi at samba.org>
Date: Fri Mar 30 15:31:19 2012 +0200
s3:param convert kernel oplocks to share parameter
Signed-off-by: Jeremy Allison <jra at samba.org>
-----------------------------------------------------------------------
Summary of changes:
docs-xml/smbdotconf/locking/kerneloplocks.xml | 9 +++++++--
lib/param/param_functions.c | 1 +
source3/include/proto.h | 2 +-
source3/param/loadparm.c | 11 ++++-------
source3/smbd/oplock.c | 24 +++++++++++++++++-------
source3/smbd/proto.h | 1 +
source3/smbd/service.c | 4 ++++
7 files changed, 35 insertions(+), 17 deletions(-)
Changeset truncated at 500 lines:
diff --git a/docs-xml/smbdotconf/locking/kerneloplocks.xml b/docs-xml/smbdotconf/locking/kerneloplocks.xml
index c4f12b9..9ac7256 100644
--- a/docs-xml/smbdotconf/locking/kerneloplocks.xml
+++ b/docs-xml/smbdotconf/locking/kerneloplocks.xml
@@ -1,11 +1,13 @@
<samba:parameter name="kernel oplocks"
type="boolean"
- context="G"
+ context="S"
xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
<description>
<para>For UNIXes that support kernel based <smbconfoption name="oplocks"/>
(currently only IRIX and the Linux 2.4 kernel), this parameter
- allows the use of them to be turned on or off.</para>
+ allows the use of them to be turned on or off. However, this disables
+ Level II oplocks for clients as the Linux and IRIX kernels do not
+ support them properly.</para>
<para>Kernel oplocks support allows Samba <parameter moreinfo="none">oplocks
</parameter> to be broken whenever a local UNIX process or NFS operation
@@ -13,6 +15,9 @@
<manvolnum>8</manvolnum></citerefentry> has oplocked. This allows complete
data consistency between SMB/CIFS, NFS and local file access (and is
a <emphasis>very</emphasis> cool feature :-).</para>
+ <para>If you do not need this interaction, you should disable the
+ parameter on Linux and IRIX to get Level II oplocks and the associated
+ performance benefit.</para>
<para>This parameter defaults to <constant>on</constant>, but is translated
to a no-op on systems that no not have the necessary kernel support.
diff --git a/lib/param/param_functions.c b/lib/param/param_functions.c
index ee865fd..cd85cb0 100644
--- a/lib/param/param_functions.c
+++ b/lib/param/param_functions.c
@@ -104,6 +104,7 @@ FN_LOCAL_PARM_BOOL(locking, bLocking)
FN_LOCAL_PARM_INTEGER(strict_locking, iStrictLocking)
FN_LOCAL_PARM_BOOL(posix_locking, bPosixLocking)
FN_LOCAL_BOOL(share_modes, bShareModes)
+FN_LOCAL_BOOL(kernel_oplocks, bKernelOplocks)
FN_LOCAL_BOOL(level2_oplocks, bLevel2OpLocks)
FN_LOCAL_BOOL(onlyuser, bOnlyUser)
FN_LOCAL_PARM_BOOL(manglednames, bMangledNames)
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 34c9fe8..d32d2e8 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1226,7 +1226,6 @@ bool lp_client_plaintext_auth(void);
bool lp_client_lanman_auth(void);
bool lp_client_ntlmv2_auth(void);
bool lp_host_msdfs(void);
-bool lp_kernel_oplocks(void);
bool lp_enhanced_browsing(void);
bool lp_use_mmap(void);
bool lp_unix_extensions(void);
@@ -1355,6 +1354,7 @@ int lp_strict_locking(const struct share_params *p );
bool lp_posix_locking(const struct share_params *p );
bool lp_share_modes(int );
bool lp_oplocks(int );
+bool lp_kernel_oplocks(int );
bool lp_level2_oplocks(int );
bool lp_onlyuser(int );
bool lp_manglednames(const struct share_params *p );
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 5d8c3a7..41c29cb 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -230,6 +230,7 @@ static struct loadparm_service sDefault =
.bPosixLocking = true,
.bShareModes = true,
.bOpLocks = true,
+ .bKernelOplocks = true,
.bLevel2OpLocks = true,
.bOnlyUser = false,
.bMangledNames = true,
@@ -3109,11 +3110,11 @@ static struct parm_struct parm_table[] = {
{
.label = "kernel oplocks",
.type = P_BOOL,
- .p_class = P_GLOBAL,
- .offset = GLOBAL_VAR(bKernelOplocks),
+ .p_class = P_LOCAL,
+ .offset = LOCAL_VAR(bKernelOplocks),
.special = NULL,
.enum_list = NULL,
- .flags = FLAG_ADVANCED | FLAG_GLOBAL,
+ .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
},
{
.label = "locking",
@@ -4892,9 +4893,6 @@ static void init_globals(bool reinit_globals)
Globals.bDNSproxy = true;
- /* this just means to use them if they exist */
- Globals.bKernelOplocks = true;
-
Globals.bAllowTrustedDomains = true;
string_set(&Globals.szIdmapBackend, "tdb");
@@ -5260,7 +5258,6 @@ FN_GLOBAL_BOOL(lp_client_plaintext_auth, bClientPlaintextAuth)
FN_GLOBAL_BOOL(lp_client_lanman_auth, bClientLanManAuth)
FN_GLOBAL_BOOL(lp_client_ntlmv2_auth, bClientNTLMv2Auth)
FN_GLOBAL_BOOL(lp_host_msdfs, bHostMSDfs)
-FN_GLOBAL_BOOL(lp_kernel_oplocks, bKernelOplocks)
FN_GLOBAL_BOOL(lp_enhanced_browsing, enhanced_browsing)
FN_GLOBAL_BOOL(lp_use_mmap, bUseMmap)
FN_GLOBAL_BOOL(lp_unix_extensions, bUnixExtensions)
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index f760171..b181fb7 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -62,8 +62,11 @@ void break_kernel_oplock(struct messaging_context *msg_ctx, files_struct *fsp)
bool set_file_oplock(files_struct *fsp, int oplock_type)
{
+
+ bool use_kernel = lp_kernel_oplocks(SNUM(fsp->conn)) && koplocks;
+
if (fsp->oplock_type == LEVEL_II_OPLOCK) {
- if (koplocks &&
+ if (use_kernel &&
!(koplocks->flags & KOPLOCKS_LEVEL2_SUPPORTED)) {
DEBUG(10, ("Refusing level2 oplock, kernel oplocks "
"don't support them\n"));
@@ -73,7 +76,7 @@ bool set_file_oplock(files_struct *fsp, int oplock_type)
if ((fsp->oplock_type != NO_OPLOCK) &&
(fsp->oplock_type != FAKE_LEVEL_II_OPLOCK) &&
- koplocks &&
+ use_kernel &&
!koplocks->ops->set_oplock(koplocks, fsp, oplock_type)) {
return False;
}
@@ -484,6 +487,7 @@ static void process_oplock_break_message(struct messaging_context *msg_ctx,
struct share_mode_entry msg;
files_struct *fsp;
bool break_to_level2 = False;
+ bool use_kernel;
struct smbd_server_connection *sconn =
talloc_get_type_abort(private_data,
struct smbd_server_connection);
@@ -543,9 +547,11 @@ static void process_oplock_break_message(struct messaging_context *msg_ctx,
return;
}
- if ((global_client_caps & CAP_LEVEL_II_OPLOCKS) &&
+ use_kernel = lp_kernel_oplocks(SNUM(fsp->conn)) && koplocks;
+
+ if ((global_client_caps & CAP_LEVEL_II_OPLOCKS) &&
!(msg.op_type & FORCE_OPLOCK_BREAK_TO_NONE) &&
- !(koplocks && !(koplocks->flags & KOPLOCKS_LEVEL2_SUPPORTED)) &&
+ !(use_kernel && !(koplocks->flags & KOPLOCKS_LEVEL2_SUPPORTED)) &&
lp_level2_oplocks(SNUM(fsp->conn))) {
break_to_level2 = True;
}
@@ -978,7 +984,13 @@ bool init_oplocks(struct smbd_server_connection *sconn)
messaging_register(sconn->msg_ctx, sconn, MSG_SMB_OPEN_RETRY,
process_open_retry_message);
- if (lp_kernel_oplocks()) {
+ return true;
+}
+
+void init_kernel_oplocks(struct smbd_server_connection *sconn)
+{
+ /* only initialize once */
+ if (koplocks == NULL) {
#if HAVE_KERNEL_OPLOCKS_IRIX
koplocks = irix_init_kernel_oplocks(sconn);
#elif HAVE_KERNEL_OPLOCKS_LINUX
@@ -988,6 +1000,4 @@ bool init_oplocks(struct smbd_server_connection *sconn)
koplocks = onefs_init_kernel_oplocks(sconn);
#endif
}
-
- return True;
}
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 5ab5185..f2040cd 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -673,6 +673,7 @@ void smbd_contend_level2_oplocks_end(files_struct *fsp,
void share_mode_entry_to_message(char *msg, const struct share_mode_entry *e);
void message_to_share_mode_entry(struct share_mode_entry *e, char *msg);
bool init_oplocks(struct smbd_server_connection *sconn);
+void init_kernel_oplocks(struct smbd_server_connection *sconn);
/* The following definitions come from smbd/oplock_irix.c */
diff --git a/source3/smbd/service.c b/source3/smbd/service.c
index c4d3486..914cec8 100644
--- a/source3/smbd/service.c
+++ b/source3/smbd/service.c
@@ -709,6 +709,10 @@ static NTSTATUS make_connection_snum(struct smbd_server_connection *sconn,
}
}
+ if (lp_kernel_oplocks(snum)) {
+ init_kernel_oplocks(conn->sconn);
+ }
+
/*
* Fix compatibility issue pointed out by Volker.
* We pass the conn->connectpath to the preexec
--
Samba Shared Repository
More information about the samba-cvs
mailing list