The Samba-Bugzilla – Attachment 6237 Details for
Bug 7928
Samba problems with kernel oplocks option set to "no"
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for 3.5.x - part #1
0001-Fix-bug-7928-Samba-problems-with-kernel-oplocks-opti.patch (text/plain), 2.52 KB, created by
Jeremy Allison
on 2011-01-31 17:26:50 UTC
(
hide
)
Description:
Patch for 3.5.x - part #1
Filename:
MIME Type:
Creator:
Jeremy Allison
Created:
2011-01-31 17:26:50 UTC
Size:
2.52 KB
patch
obsolete
>From 8237dea481502a298888b54b73aa0b67473d8c75 Mon Sep 17 00:00:00 2001 >From: Pavel Shilovsky <piastry@etersoft.ru> >Date: Mon, 31 Jan 2011 15:23:41 -0800 >Subject: [PATCH 1/2] Fix bug #7928 - Samba problems with kernel oplocks option set to "no" > >We should not grant levelII oplocks on a file with existing >byte range locks. >--- > source3/smbd/open.c | 5 ++++- > source3/smbd/oplock.c | 30 +++++++++++++++++++++++++----- > 2 files changed, 29 insertions(+), 6 deletions(-) > >diff --git a/source3/smbd/open.c b/source3/smbd/open.c >index f7ed495..abd9afb 100644 >--- a/source3/smbd/open.c >+++ b/source3/smbd/open.c >@@ -2169,7 +2169,10 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn, > */ > > if (!set_file_oplock(fsp, fsp->oplock_type)) { >- /* Could not get the kernel oplock */ >+ /* >+ * Could not get the kernel oplock or there are byte-range >+ * locks on the file. >+ */ > fsp->oplock_type = NO_OPLOCK; > } > >diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c >index ff5f6ad..55d0e19 100644 >--- a/source3/smbd/oplock.c >+++ b/source3/smbd/oplock.c >@@ -51,6 +51,17 @@ void break_kernel_oplock(struct messaging_context *msg_ctx, files_struct *fsp) > msg, MSG_SMB_KERNEL_BREAK_SIZE); > } > >+static bool file_has_brlocks(files_struct *fsp) >+{ >+ struct byte_range_lock *br_lck; >+ >+ br_lck = brl_get_locks_readonly(fsp); >+ if (!br_lck) >+ return false; >+ >+ return br_lck->num_locks > 0 ? true : false; >+} >+ > /**************************************************************************** > Attempt to set an oplock on a file. Always succeeds if kernel oplocks are > disabled (just sets flags). Returns True if oplock set. >@@ -58,12 +69,21 @@ void break_kernel_oplock(struct messaging_context *msg_ctx, files_struct *fsp) > > bool set_file_oplock(files_struct *fsp, int oplock_type) > { >- if ((fsp->oplock_type == LEVEL_II_OPLOCK) >- && koplocks && !(koplocks->flags & KOPLOCKS_LEVEL2_SUPPORTED)) { >- DEBUG(10, ("Refusing level2 oplock, kernel oplocks don't " >- "support them\n")); >- return false; >+ if (fsp->oplock_type == LEVEL_II_OPLOCK) { >+ if (lp_locking(fsp->conn->params) && file_has_brlocks(fsp)) { >+ DEBUG(10, ("Refusing level2 oplock because of " >+ "byte-range locks on the file\n")); >+ return false; >+ } >+ >+ if (koplocks && >+ !(koplocks->flags & KOPLOCKS_LEVEL2_SUPPORTED)) { >+ DEBUG(10, ("Refusing level2 oplock, kernel oplocks " >+ "don't support them\n")); >+ return false; >+ } > } >+ > if ((fsp->oplock_type != NO_OPLOCK) && > (fsp->oplock_type != FAKE_LEVEL_II_OPLOCK) && > koplocks && >-- >1.7.3.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
vl
:
review+
Actions:
View
Attachments on
bug 7928
:
6220
|
6221
|
6222
|
6223
|
6224
|
6237
|
6238