From e5e66191f214b521f67a19401a72171d9952616a Mon Sep 17 00:00:00 2001 From: Christof Schmitt Date: Thu, 23 Aug 2018 22:12:23 -0700 Subject: [PATCH] smbd: Remove unused KOPLOCK flags This effectively reverts commit 17eba16b. It looks like these flags have been introduced as part of the onefs support which has been removed again. As there is no other use for the flags, remove them. Signed-off-by: Christof Schmitt Reviewed-by: Ralph Boehme Autobuild-User(master): Christof Schmitt Autobuild-Date(master): Sat Aug 25 03:23:05 CEST 2018 on sn-devel-144 --- source3/include/smb.h | 17 ----------------- source3/smbd/oplock.c | 27 +++++---------------------- 2 files changed, 5 insertions(+), 39 deletions(-) diff --git a/source3/include/smb.h b/source3/include/smb.h index 5b3846f8715..89469fc1433 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -660,26 +660,9 @@ enum smbd_capability { DAC_OVERRIDE_CAPABILITY }; -/* - * Kernel oplocks capability flags. - */ - -/* Level 2 oplocks are supported natively by kernel oplocks. */ -#define KOPLOCKS_LEVEL2_SUPPORTED 0x1 - -/* The kernel notifies deferred openers when they can retry the open. */ -#define KOPLOCKS_DEFERRED_OPEN_NOTIFICATION 0x2 - -/* The kernel notifies smbds when an oplock break times out. */ -#define KOPLOCKS_TIMEOUT_NOTIFICATION 0x4 - -/* The kernel notifies smbds when an oplock is broken. */ -#define KOPLOCKS_OPLOCK_BROKEN_NOTIFICATION 0x8 - struct kernel_oplocks_ops; struct kernel_oplocks { const struct kernel_oplocks_ops *ops; - uint32_t flags; void *private_data; }; diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index 3e6d1d421be..1495269efb4 100644 --- a/source3/smbd/oplock.c +++ b/source3/smbd/oplock.c @@ -59,13 +59,10 @@ NTSTATUS set_file_oplock(files_struct *fsp) bool use_kernel = lp_kernel_oplocks(SNUM(fsp->conn)) && (koplocks != NULL); - if (fsp->oplock_type == LEVEL_II_OPLOCK) { - if (use_kernel && - !(koplocks->flags & KOPLOCKS_LEVEL2_SUPPORTED)) { - DEBUG(10, ("Refusing level2 oplock, kernel oplocks " - "don't support them\n")); - return NT_STATUS_NOT_SUPPORTED; - } + if (fsp->oplock_type == LEVEL_II_OPLOCK && use_kernel) { + DEBUG(10, ("Refusing level2 oplock, kernel oplocks " + "don't support them\n")); + return NT_STATUS_NOT_SUPPORTED; } if ((fsp->oplock_type != NO_OPLOCK) && @@ -747,20 +744,6 @@ static void oplock_timeout_handler(struct tevent_context *ctx, static void add_oplock_timeout_handler(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 kernel oplocks already notifies smbds when an oplock break times - * out, just return. - */ - if (use_kernel && - (koplocks->flags & KOPLOCKS_TIMEOUT_NOTIFICATION)) { - return; - } - if (fsp->oplock_timeout != NULL) { DEBUG(0, ("Logic problem -- have an oplock event hanging " "around\n")); @@ -877,7 +860,7 @@ static void process_oplock_break_message(struct messaging_context *msg_ctx, use_kernel = lp_kernel_oplocks(SNUM(fsp->conn)) && (koplocks != NULL); - if (use_kernel && !(koplocks->flags & KOPLOCKS_LEVEL2_SUPPORTED)) { + if (use_kernel) { DEBUG(10, ("Kernel oplocks don't allow level2\n")); break_to &= ~SMB2_LEASE_READ; }