[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Wed Sep 15 00:05:02 UTC 2021
The branch, master has been updated
via d40f57321a1 WHATSNEW: Document changes for "kernel share modes"
via 079e706e171 docs-xml: Update manpage for "kernel share modes" option
via 54fe40836ba loadparm: Set default of "kernel share modes" to "no"
via c2d6284a033 wscript: Remove config check for LOCK_MAND
via b2b7f9e658d system: Remove kernel_flock
via e1398c34b2c vfs_default: Return ENOTSUP for sharemodes flock call
via 5488a242fbd vfs_gpfs: Remove call to kernel_flock
via facd6e01bd3 vfs_gpfs: Update comment in vfs_gpfs_kernel_flock
via 0fa4766e43a smbd: Update comment explaining streams and file-system sharemodes
from ce2bc74dce4 bootstrap: Remove last references to Ubuntu 16.04
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit d40f57321a12c28840cdd2efd3e0e8f21855b6d4
Author: Christof Schmitt <cs at samba.org>
Date: Tue Sep 14 10:32:58 2021 -0700
WHATSNEW: Document changes for "kernel share modes"
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Wed Sep 15 00:04:47 UTC 2021 on sn-devel-184
commit 079e706e1711cae82db913fa46fa9efe7afafc97
Author: Christof Schmitt <cs at samba.org>
Date: Mon Sep 13 13:25:09 2021 -0700
docs-xml: Update manpage for "kernel share modes" option
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 54fe40836ba1813166ab9f060255139dd37d697a
Author: Christof Schmitt <cs at samba.org>
Date: Tue Sep 14 09:54:22 2021 -0700
loadparm: Set default of "kernel share modes" to "no"
selftest: Remove knownfail for smb2.lock.replay_smb3_specification_durable
With the changed default for "kernel share modes", this test can now
acquire durable handles and succeed.
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit c2d6284a033da3984cc13a85c862489c78fb7739
Author: Christof Schmitt <cs at samba.org>
Date: Mon Sep 13 13:14:49 2021 -0700
wscript: Remove config check for LOCK_MAND
The define set from this check is no longer needed.
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit b2b7f9e658d80f8e193c4d1e266783b1f02a6012
Author: Christof Schmitt <cs at samba.org>
Date: Mon Sep 13 13:13:44 2021 -0700
system: Remove kernel_flock
LOCK_MAND will be deprecated in the Linux kernel, so stop using this
feature and remove the kernel_flock function.
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit e1398c34b2c24b76b30fdde8417b871d53825a36
Author: Christof Schmitt <cs at samba.org>
Date: Tue Sep 14 09:49:16 2021 -0700
vfs_default: Return ENOTSUP for sharemodes flock call
Remove the call to kernel_flock, as this function will be deleted.
Have the function return ENOTSUP to indicate that this is not supported
by default (without a file-system specific VFS module).
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 5488a242fbd6d7123a9cb3297c0cf71acbb9d523
Author: Christof Schmitt <cs at samba.org>
Date: Mon Sep 13 13:00:03 2021 -0700
vfs_gpfs: Remove call to kernel_flock
The function kernel_flock will be deleted.
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit facd6e01bd3b932a6bf33c71bbb590a8be51aa30
Author: Christof Schmitt <cs at samba.org>
Date: Mon Sep 13 12:16:20 2021 -0700
vfs_gpfs: Update comment in vfs_gpfs_kernel_flock
The function kernel_flock will be deleted, drop the reference to it.
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 0fa4766e43a5e302a4152f370315ce2f73293cac
Author: Christof Schmitt <cs at samba.org>
Date: Mon Sep 13 12:01:01 2021 -0700
smbd: Update comment explaining streams and file-system sharemodes
The function kernel_flock will be deleted, drop the reference to it.
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
-----------------------------------------------------------------------
Summary of changes:
WHATSNEW.txt | 11 ++++++++
docs-xml/smbdotconf/locking/kernelsharemodes.xml | 15 ++++++-----
lib/param/loadparm.c | 2 +-
selftest/knownfail | 1 -
source3/lib/system.c | 33 ------------------------
source3/modules/vfs_default.c | 6 ++---
source3/modules/vfs_gpfs.c | 4 +--
source3/param/loadparm.c | 2 +-
source3/smbd/open.c | 8 +++---
source3/wscript | 15 -----------
10 files changed, 28 insertions(+), 69 deletions(-)
Changeset truncated at 500 lines:
diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index fe9eff8ba59..b585e2e20a1 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -33,12 +33,23 @@ installed in /var/lib/samba/private/certs.
REMOVED FEATURES
================
+No longer using Linux mandatory locks for sharemodes
+====================================================
+
+smbd mapped sharemodes to Linux mandatory locks. This code in the Linux kernel
+was broken for a long time, and is planned to be removed with Linux 5.15. This
+Samba release removes the usage of mandatory locks for sharemodes and the
+"kernel share modes" config parameter is changed to default to "no". The Samba
+VFS interface is kept, so that file-system specific VFS modules can still use
+private calls for enforcing sharemodes.
+
smb.conf changes
================
Parameter Name Description Default
-------------- ----------- -------
+ kernel share modes New default No
KNOWN ISSUES
diff --git a/docs-xml/smbdotconf/locking/kernelsharemodes.xml b/docs-xml/smbdotconf/locking/kernelsharemodes.xml
index 134fffc2714..d06f7924aad 100644
--- a/docs-xml/smbdotconf/locking/kernelsharemodes.xml
+++ b/docs-xml/smbdotconf/locking/kernelsharemodes.xml
@@ -5,14 +5,14 @@
<description>
<para>
This parameter controls whether SMB share modes are
- translated into UNIX flocks.
+ translated into file system specific sharemode calls.
</para>
<para>
Kernel share modes provide a minimal level of interoperability
with local UNIX processes and NFS operations by preventing
- access with flocks corresponding to the SMB share modes.
- Generally, it is very desirable to leave this enabled.
+ access corresponding to the SMB share modes. This requires
+ a file system specific VFS module with proper support.
</para>
<para>
@@ -21,11 +21,12 @@
</para>
<para>
- This parameter defaults to <constant>yes</constant> and
- is translated to a no-op on systems that do not have the
- necessary kernel flock support.
+ This parameter defaults to <constant>no</constant>. Setting
+ it to <constant>yes</constant> requires a file system module
+ that supports file system sharemodes, otherwise attempts to
+ access files will fail with a sharing violation.
</para>
</description>
-<value type="default">yes</value>
+<value type="default">no</value>
</samba:parameter>
diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c
index 59e749d9d46..2eac1ba7c38 100644
--- a/lib/param/loadparm.c
+++ b/lib/param/loadparm.c
@@ -2808,7 +2808,7 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx)
lpcfg_do_global_parameter(lp_ctx, "ldap page size", "1000");
- lpcfg_do_global_parameter(lp_ctx, "kernel share modes", "yes");
+ lpcfg_do_global_parameter(lp_ctx, "kernel share modes", "no");
lpcfg_do_global_parameter(lp_ctx, "strict locking", "Auto");
diff --git a/selftest/knownfail b/selftest/knownfail
index 9f362c02b47..73ae7142563 100644
--- a/selftest/knownfail
+++ b/selftest/knownfail
@@ -215,7 +215,6 @@
^samba3.smb2.session.*reauth5 # some special anonymous checks?
^samba3.smb2.compound.interim2 # wrong return code (STATUS_CANCELLED)
^samba3.smb2.compound.aio.interim2 # wrong return code (STATUS_CANCELLED)
-^samba3.smb2.lock.replay_smb3_specification_durable\(nt4_dc\) # Requires durable handles
^samba3.smb2.lock.*replay_broken_windows # This tests the windows behaviour
^samba3.smb2.lease.statopen3
^samba3.smb2.lease.unlink # we currently do not downgrade RH lease to R after unlink
diff --git a/source3/lib/system.c b/source3/lib/system.c
index a14fc51ca63..671fc2760a0 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -471,39 +471,6 @@ int sys_fallocate(int fd, uint32_t mode, off_t offset, off_t len)
#endif /* HAVE_LINUX_FALLOCATE */
}
-#ifdef HAVE_KERNEL_SHARE_MODES
-#ifndef LOCK_MAND
-#define LOCK_MAND 32 /* This is a mandatory flock */
-#define LOCK_READ 64 /* ... Which allows concurrent read operations */
-#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */
-#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */
-#endif
-#endif
-
-/*******************************************************************
- A flock() wrapper that will perform the kernel flock.
-********************************************************************/
-
-void kernel_flock(int fd, uint32_t share_access, uint32_t access_mask)
-{
-#ifdef HAVE_KERNEL_SHARE_MODES
- int kernel_mode = 0;
- if (share_access == FILE_SHARE_WRITE) {
- kernel_mode = LOCK_MAND|LOCK_WRITE;
- } else if (share_access == FILE_SHARE_READ) {
- kernel_mode = LOCK_MAND|LOCK_READ;
- } else if (share_access == FILE_SHARE_NONE) {
- kernel_mode = LOCK_MAND;
- }
- if (kernel_mode) {
- flock(fd, kernel_mode);
- }
-#endif
- ;
-}
-
-
-
/*******************************************************************
An fdopendir wrapper.
********************************************************************/
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 5701e37d5ec..2687d175880 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -3018,10 +3018,8 @@ static bool vfswrap_lock(vfs_handle_struct *handle, files_struct *fsp, int op, o
static int vfswrap_kernel_flock(vfs_handle_struct *handle, files_struct *fsp,
uint32_t share_access, uint32_t access_mask)
{
- START_PROFILE(syscall_kernel_flock);
- kernel_flock(fsp_get_io_fd(fsp), share_access, access_mask);
- END_PROFILE(syscall_kernel_flock);
- return 0;
+ errno = ENOTSUP;
+ return -1;
}
static int vfswrap_fcntl(vfs_handle_struct *handle, files_struct *fsp, int cmd,
diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
index 4d1cfa6075a..0225cdc6e0f 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -176,7 +176,7 @@ static int vfs_gpfs_kernel_flock(vfs_handle_struct *handle, files_struct *fsp,
/*
* A named stream fsp will have the basefile open in the fsp
* fd, so lacking a distinct fd for the stream we have to skip
- * kernel_flock and set_gpfs_sharemode for stream.
+ * set_gpfs_sharemode for stream.
*/
if (is_named_stream(fsp->fsp_name)) {
DBG_NOTICE("Not requesting GPFS sharemode on stream: %s/%s\n",
@@ -185,8 +185,6 @@ static int vfs_gpfs_kernel_flock(vfs_handle_struct *handle, files_struct *fsp,
return 0;
}
- kernel_flock(fsp_get_io_fd(fsp), share_access, access_mask);
-
ret = set_gpfs_sharemode(fsp, access_mask, share_access);
END_PROFILE(syscall_kernel_flock);
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index b003e54c038..6c9830563c3 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -246,7 +246,7 @@ static const struct loadparm_service _sDefault =
.map_readonly = MAP_READONLY_NO,
.directory_name_cache_size = 100,
.server_smb_encrypt = SMB_ENCRYPTION_DEFAULT,
- .kernel_share_modes = true,
+ .kernel_share_modes = false,
.durable_handles = true,
.check_parent_directory_delete_on_close = false,
.param_opt = NULL,
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 968dd8ecb00..9c146177897 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -4054,10 +4054,10 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
* Beware: streams implementing VFS modules may
* implement streams in a way that fsp will have the
* basefile open in the fsp fd, so lacking a distinct
- * fd for the stream kernel_flock will apply on the
- * basefile which is wrong. The actual check is
- * deferred to the VFS module implementing the
- * kernel_flock call.
+ * fd for the stream the file-system sharemode will
+ * apply on the basefile which is wrong. The actual
+ * check is deferred to the VFS module implementing
+ * the file-system sharemode call.
*/
ret_flock = SMB_VFS_KERNEL_FLOCK(fsp, share_access, access_mask);
if(ret_flock == -1 ){
diff --git a/source3/wscript b/source3/wscript
index 87dbc00f191..5662c588776 100644
--- a/source3/wscript
+++ b/source3/wscript
@@ -165,21 +165,6 @@ long ret = splice(0,0,1,0,400,SPLICE_F_MOVE);
if conf.CHECK_DECLS('F_SETLEASE', headers='linux/fcntl.h', reverse=True):
conf.DEFINE('HAVE_KERNEL_OPLOCKS_LINUX', 1)
- # Check for kernel share modes
- conf.CHECK_CODE('''
-#include <sys/types.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <sys/file.h>
-#ifndef LOCK_MAND
-#define LOCK_MAND 32
-#define LOCK_READ 64
-#endif
-main() {
- exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
-}''', 'HAVE_KERNEL_SHARE_MODES', addmain=False, execute=True,
- msg="Checking for kernel share modes")
-
# check for fam libs
samba_fam_libs=None
check_for_fam=False
--
Samba Shared Repository
More information about the samba-cvs
mailing list