From: Christian Ambach Date: Fri, 30 Mar 2012 14:11:08 +0000 (+0200) Subject: s3:smbd only care about missing level2 support if kernel oplocks are enabled X-Git-Tag: ldb-1.1.6~129 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2927ca36706bf2e9b2b0458bbb1dfb493ea8e208;p=thirdparty%2Fsamba.git 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 Autobuild-User: Jeremy Allison Autobuild-Date: Wed Apr 11 22:45:21 CEST 2012 on sn-devel-104 --- diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index c619edc5b9d..b181fb79ba0 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; }