[PATCH] smbd: Enable leases by default

Jeremy Allison jra at samba.org
Thu Jul 21 21:06:29 UTC 2016


On Thu, Jul 21, 2016 at 03:45:37PM +0200, Ralph Böhme wrote:
> 
> those tests are run against ad_dc and nt4_dc environments. The latter
> is explicitly configured with leases enabled, the former uses the
> default.
> 
> To preserve the setting in the environments while flipping the default
> to enabled., simply adding "smb2 leases = no" to ad_dc seems like the
> way to do it.
> 
> Cheerio!

This one works for me - let me know if you're OK with it !

Cheers,

	Jeremy.
-------------- next part --------------
From fe8c7c3c8f88d42e2303d7b8778e1ff4f05e18aa Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Wed, 20 Jul 2016 12:32:58 +0200
Subject: [PATCH 1/2] smbd: Enable leases by default
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
---
 docs-xml/smbdotconf/locking/smb2leases.xml | 8 ++------
 lib/param/loadparm.c                       | 2 ++
 selftest/target/Samba3.pm                  | 1 -
 selftest/target/Samba4.pm                  | 1 +
 source3/param/loadparm.c                   | 2 +-
 5 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/docs-xml/smbdotconf/locking/smb2leases.xml b/docs-xml/smbdotconf/locking/smb2leases.xml
index 5ca13d2..6587300 100644
--- a/docs-xml/smbdotconf/locking/smb2leases.xml
+++ b/docs-xml/smbdotconf/locking/smb2leases.xml
@@ -7,8 +7,7 @@
 	This boolean option tells <command moreinfo="none">smbd</command> whether to
 	globally negotiate SMB2 leases on file open requests. Leasing is an SMB2-only
 	feature which allows clients to aggressively cache files locally above and
-	beyond the caching allowed by SMB1 oplocks. This (experimental) parameter is
-	set to off by default until the SMB2 leasing code is declared fully stable.
+	beyond the caching allowed by SMB1 oplocks.
 	</para>
 
 	<para>
@@ -18,14 +17,11 @@
 
 	<para>Note that the write cache won't be used for file handles with a smb2 write lease.</para>
 
-	<para>
-	The Samba implementation of leases is currently marked as experimental!
-	</para>
 </description>
 
 <related>oplocks</related>
 <related>kernel oplocks</related>
 <related>level2 oplocks</related>
 <related>write cache size</related>
-<value type="default">no</value>
+<value type="default">yes</value>
 </samba:parameter>
diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c
index 515ed05..548d105 100644
--- a/lib/param/loadparm.c
+++ b/lib/param/loadparm.c
@@ -2898,6 +2898,8 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx)
 
 	lpcfg_do_global_parameter(lp_ctx, "aio max threads", "100");
 
+	lpcfg_do_global_parameter(lp_ctx, "smb2 leases", "yes");
+
 	/* Allow modules to adjust defaults */
 	for (defaults_hook = defaults_hooks; defaults_hook;
 		 defaults_hook = defaults_hook->next) {
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index f5f4c0c..b5ea469 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -1411,7 +1411,6 @@ sub provision($$$$$$$$)
 
 	kernel oplocks = no
 	kernel change notify = no
-	smb2 leases = yes
 
 	logging = file
 	printing = bsd
diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm
index b09bb66..9d96c16 100755
--- a/selftest/target/Samba4.pm
+++ b/selftest/target/Samba4.pm
@@ -1652,6 +1652,7 @@ sub provision_ad_dc($$)
 
 	kernel oplocks = no
 	kernel change notify = no
+	smb2 leases = no
 
 	logging = file
 	printing = bsd
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index df700bc..71e9e2e 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -862,7 +862,7 @@ static void init_globals(struct loadparm_context *lp_ctx, bool reinit_globals)
 	Globals.smb2_max_write = DEFAULT_SMB2_MAX_WRITE;
 	Globals.smb2_max_trans = DEFAULT_SMB2_MAX_TRANSACT;
 	Globals.smb2_max_credits = DEFAULT_SMB2_MAX_CREDITS;
-	Globals.smb2_leases = false;
+	Globals.smb2_leases = true;
 
 	lpcfg_string_set(Globals.ctx, &Globals.ncalrpc_dir,
 			 get_dyn_NCALRPCDIR());
-- 
2.8.0.rc3.226.g39d4020


From aea52907cdae17217992f689a17bfc0c62a4de56 Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Thu, 21 Jul 2016 12:21:46 -0700
Subject: [PATCH 2/2] WHATSNEW: SMB 2.1 leases enabled by default

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
---
 WHATSNEW.txt | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 6c86795..2cda375 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -126,7 +126,14 @@ Samba-tool improvements
 Running samba-tool on the command line should now be a lot snappier. The tool
 now only loads the code specific to the subcommand that you wish to run.
 
+SMB 2.1 Leases enabled by default
+---------------------------------
 
+Leasing is an SMB 2.1 (and higher) feature which allows clients to
+aggressively cache files locally above and beyond the caching allowed
+by SMB 1 oplocks. This feature was disabled in previous releases, but
+the SMB2 leasing code is now considered mature and stable enough to be
+enabled by default.
 
 REMOVED FEATURES
 ================
@@ -144,6 +151,7 @@ smb.conf changes
   only user			Removed
   username			Removed
   kccsrv:samba_kcc		Changed default		true
+  smb2 leases			Changed default		yes
 
 KNOWN ISSUES
 ============
-- 
2.8.0.rc3.226.g39d4020



More information about the samba-technical mailing list