Author: vlendec
Date: 2005-09-10 11:01:12 +0000 (Sat, 10 Sep 2005)
New Revision: 10147

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=10147

Log:
Fix two bugs with kernel oplocks.

We still have a problem that when a kernel oplock exists, a stat open does not
break it and the open call gets a EAGAIN. In that case we need to defer the
open and have the kernel oplock break request handler release the oplock.

This exists in current 3_0 as well.

Volker

Modified:
   branches/tmp/vl-cluster/source/smbd/open.c
   branches/tmp/vl-cluster/source/smbd/oplock.c
   trunk/source/smbd/open.c
   trunk/source/smbd/oplock.c


Changeset:
Modified: branches/tmp/vl-cluster/source/smbd/open.c
===================================================================
--- branches/tmp/vl-cluster/source/smbd/open.c  2005-09-10 10:59:49 UTC (rev 
10146)
+++ branches/tmp/vl-cluster/source/smbd/open.c  2005-09-10 11:01:12 UTC (rev 
10147)
@@ -1660,7 +1660,6 @@
         * file structs.
         */
 
-       set_share_mode(lck, fsp, 0, fsp->oplock_type);
        if ((fsp->oplock_type != NO_OPLOCK) &&
            (fsp->oplock_type != FAKE_LEVEL_II_OPLOCK)) {
                if (!set_file_oplock(fsp, fsp->oplock_type)) {
@@ -1668,6 +1667,7 @@
                        fsp->oplock_type = NO_OPLOCK;
                }
        }
+       set_share_mode(lck, fsp, 0, fsp->oplock_type);
 
        if (create_options & FILE_DELETE_ON_CLOSE) {
                uint32 dosattr= existing_dos_attributes;

Modified: branches/tmp/vl-cluster/source/smbd/oplock.c
===================================================================
--- branches/tmp/vl-cluster/source/smbd/oplock.c        2005-09-10 10:59:49 UTC 
(rev 10146)
+++ branches/tmp/vl-cluster/source/smbd/oplock.c        2005-09-10 11:01:12 UTC 
(rev 10147)
@@ -135,8 +135,11 @@
 
 void release_file_oplock(files_struct *fsp)
 {
-       if ((fsp->oplock_type != NO_OPLOCK) && koplocks)
+       if ((fsp->oplock_type != NO_OPLOCK) &&
+           (fsp->oplock_type != FAKE_LEVEL_II_OPLOCK) &&
+           koplocks) {
                koplocks->release_oplock(fsp);
+       }
 
        if (fsp->oplock_type == LEVEL_II_OPLOCK)
                level_II_oplocks_open--;

Modified: trunk/source/smbd/open.c
===================================================================
--- trunk/source/smbd/open.c    2005-09-10 10:59:49 UTC (rev 10146)
+++ trunk/source/smbd/open.c    2005-09-10 11:01:12 UTC (rev 10147)
@@ -1650,7 +1650,6 @@
         * file structs.
         */
 
-       set_share_mode(lck, fsp, 0, fsp->oplock_type);
        if ((fsp->oplock_type != NO_OPLOCK) &&
            (fsp->oplock_type != FAKE_LEVEL_II_OPLOCK)) {
                if (!set_file_oplock(fsp, fsp->oplock_type)) {
@@ -1658,6 +1657,7 @@
                        fsp->oplock_type = NO_OPLOCK;
                }
        }
+       set_share_mode(lck, fsp, 0, fsp->oplock_type);
 
        if (create_options & FILE_DELETE_ON_CLOSE) {
                uint32 dosattr= existing_dos_attributes;

Modified: trunk/source/smbd/oplock.c
===================================================================
--- trunk/source/smbd/oplock.c  2005-09-10 10:59:49 UTC (rev 10146)
+++ trunk/source/smbd/oplock.c  2005-09-10 11:01:12 UTC (rev 10147)
@@ -134,8 +134,11 @@
 
 void release_file_oplock(files_struct *fsp)
 {
-       if ((fsp->oplock_type != NO_OPLOCK) && koplocks)
+       if ((fsp->oplock_type != NO_OPLOCK) &&
+           (fsp->oplock_type != FAKE_LEVEL_II_OPLOCK) &&
+           koplocks) {
                koplocks->release_oplock(fsp);
+       }
 
        if (fsp->oplock_type == LEVEL_II_OPLOCK)
                level_II_oplocks_open--;

Reply via email to