[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Tue Dec 18 01:01:04 UTC 2018
The branch, master has been updated
via b77fae3281a smbd: Don't try to release a kernel oplock for a leased file
from 1cff50febec dsdb: sort DSDB_EXTENDED defines by OID
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit b77fae3281a06a99a7e298378a68d273ee28355c
Author: Volker Lendecke <vl at samba.org>
Date: Fri Dec 14 13:05:50 2018 +0100
smbd: Don't try to release a kernel oplock for a leased file
If we have
[global]
smb2 leases = yes
kernel oplocks = no
[share]
kernel oplocks = yes
for clients requesting leases we don't even try to acquire kernel
oplocks, because the kernel API is not compatible. Kernel oplocks are
per fd, leases are roughly "per inode".
We don't however special-case the LEASE_OPLOCK case in
release_file_oplock, leading to nasty error messages like "bad file
descriptor" on the fcntl(fd,F_SETLEASE,F_UNLCK) call. They are
harmless, but they raise eyebrows.
To simplify the if-condition, I factored out the kernel call and
applied early returns.
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): Tue Dec 18 02:00:44 CET 2018 on sn-devel-144
-----------------------------------------------------------------------
Summary of changes:
source3/smbd/oplock.c | 34 +++++++++++++++++++++++++++-------
1 file changed, 27 insertions(+), 7 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index 426b9e7faea..d733bec2d26 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -87,6 +87,32 @@ NTSTATUS set_file_oplock(files_struct *fsp)
return NT_STATUS_OK;
}
+static void release_fsp_kernel_oplock(files_struct *fsp)
+{
+ struct smbd_server_connection *sconn = fsp->conn->sconn;
+ struct kernel_oplocks *koplocks = sconn->oplocks.kernel_ops;
+ bool use_kernel;
+
+ if (koplocks == NULL) {
+ return;
+ }
+ use_kernel = lp_kernel_oplocks(SNUM(fsp->conn));
+ if (!use_kernel) {
+ return;
+ }
+ if (fsp->oplock_type == NO_OPLOCK) {
+ return;
+ }
+ if (fsp->oplock_type == LEASE_OPLOCK) {
+ /*
+ * For leases we don't touch kernel oplocks at all
+ */
+ return;
+ }
+
+ koplocks->ops->release_oplock(koplocks, fsp, NO_OPLOCK);
+}
+
/****************************************************************************
Attempt to release an oplock on a file. Decrements oplock count.
****************************************************************************/
@@ -94,14 +120,8 @@ NTSTATUS set_file_oplock(files_struct *fsp)
static void release_file_oplock(files_struct *fsp)
{
struct smbd_server_connection *sconn = fsp->conn->sconn;
- struct kernel_oplocks *koplocks = sconn->oplocks.kernel_ops;
- bool use_kernel = lp_kernel_oplocks(SNUM(fsp->conn)) &&
- (koplocks != NULL);
- if ((fsp->oplock_type != NO_OPLOCK) &&
- use_kernel) {
- koplocks->ops->release_oplock(koplocks, fsp, NO_OPLOCK);
- }
+ release_fsp_kernel_oplock(fsp);
if (fsp->oplock_type == LEVEL_II_OPLOCK) {
sconn->oplocks.level_II_open--;
--
Samba Shared Repository
More information about the samba-cvs
mailing list