s3 oplocks: Differentiate between releasing an oplock vs. downgrading to Level 2...
authorTim Prouty <tprouty@samba.org>
Fri, 9 Jan 2009 21:07:58 +0000 (13:07 -0800)
committerTim Prouty <tprouty@samba.org>
Tue, 10 Feb 2009 07:47:44 +0000 (23:47 -0800)
Pass in an extra argument when releasing an oplock so kernel oplock
implementations can support downgrading from Level 1 to Level 2.

source3/include/smb.h
source3/smbd/oplock.c
source3/smbd/oplock_irix.c
source3/smbd/oplock_linux.c

index 100ec210318b348e2da5ffcc8e16cf4e7f48b019..96cd3b7d853ce63a2e03ee5b7002c514b2ec243a 100644 (file)
@@ -1701,7 +1701,7 @@ struct kernel_oplocks_ops {
        bool (*set_oplock)(struct kernel_oplocks *ctx,
                           files_struct *fsp, int oplock_type);
        void (*release_oplock)(struct kernel_oplocks *ctx,
-                              files_struct *fsp);
+                              files_struct *fsp, int oplock_type);
 };
 
 #include "smb_macros.h"
index 3dac674c17a1d4b22727464161f6ea7f616943e3..0945ac66776a295218bb3ad7096665040c01381b 100644 (file)
@@ -91,7 +91,7 @@ void release_file_oplock(files_struct *fsp)
        if ((fsp->oplock_type != NO_OPLOCK) &&
            (fsp->oplock_type != FAKE_LEVEL_II_OPLOCK) &&
            koplocks) {
-               koplocks->ops->release_oplock(koplocks, fsp);
+               koplocks->ops->release_oplock(koplocks, fsp, NO_OPLOCK);
        }
 
        if (fsp->oplock_type == LEVEL_II_OPLOCK) {
@@ -123,7 +123,7 @@ void release_file_oplock(files_struct *fsp)
 static void downgrade_file_oplock(files_struct *fsp)
 {
        if (koplocks) {
-               koplocks->ops->release_oplock(koplocks, fsp);
+               koplocks->ops->release_oplock(koplocks, fsp, LEVEL_II_OPLOCK);
        }
        fsp->oplock_type = LEVEL_II_OPLOCK;
        exclusive_oplocks_open--;
index d7f45e67de492f0744f518c2173226097a8c4240..23b2fa908133e59bb5d55b58d678c9467545efd5 100644 (file)
@@ -222,7 +222,7 @@ static bool irix_set_kernel_oplock(struct kernel_oplocks *_ctx,
 ****************************************************************************/
 
 static void irix_release_kernel_oplock(struct kernel_oplocks *_ctx,
-                                      files_struct *fsp)
+                                      files_struct *fsp, int oplock_type)
 {
        if (DEBUGLVL(10)) {
                /*
index 51cce0ed48aa60600eaeed7751368519e4ba88b7..5840ff0851c7c678cc71d0d905bf55cd8ac15c5f 100644 (file)
@@ -130,7 +130,7 @@ static bool linux_set_kernel_oplock(struct kernel_oplocks *ctx,
 ****************************************************************************/
 
 static void linux_release_kernel_oplock(struct kernel_oplocks *ctx,
-                                       files_struct *fsp)
+                                       files_struct *fsp, int oplock_type)
 {
        if (DEBUGLVL(10)) {
                /*