at the interop Isaac (at least I _think_ it was Isaac) said that if a
authorAndrew Tridgell <tridge@samba.org>
Wed, 21 Oct 1998 00:31:14 +0000 (00:31 +0000)
committerAndrew Tridgell <tridge@samba.org>
Wed, 21 Oct 1998 00:31:14 +0000 (00:31 +0000)
MS client doesn't respond to a oplock break request then we might try
resending the request.

This morning Sues Win95 machine had this problem (thus forcing me to
do something about it!). When starting winword her box refused to
answer an oplock break request. I have added code to resend the oplock
break request up to 3 times at 10 second intervals before killing the
socket.

of course, as soon as I did this her box started to behave again so I
haven't been able to tell if this fix actually works, but it can't be
worse than dropping the socket immediately.
(This used to be commit a1c4d8351b9171416693e6d7a9045bdce9217edb)

source3/include/local.h
source3/smbd/oplock.c

index 7c63ab830b53f47433b67c59e2aba75c42fb56c3..85e61c63c4e66145575759d3643f51daa134bd60 100644 (file)
 
 #define OPLOCK_BREAK_TIMEOUT 30
 
+/* how many times do we try to resend the oplock break request - useful
+   for buggy MS clients */
+#define OPLOCK_BREAK_RESENDS 3
+
 /* Timout (in seconds) to add to the oplock break timeout
    to wait for the smbd to smbd message to return. */
 
index b1c6d9a9819c55d2147beec883bdd6c289332887..03feae3a987fc1c181bc152ddae56d1a8f2048da 100644 (file)
@@ -545,6 +545,7 @@ static BOOL oplock_break(SMB_DEV_T dev, SMB_INO_T inode, struct timeval *tval)
   connection_struct *saved_conn;
   int saved_vuid;
   pstring saved_dir; 
+  int break_counter = OPLOCK_BREAK_RESENDS;
 
   if( DEBUGLVL( 3 ) )
   {
@@ -671,8 +672,20 @@ static BOOL oplock_break(SMB_DEV_T dev, SMB_INO_T inode, struct timeval *tval)
 
   while(OPEN_FSP(fsp) && fsp->granted_oplock)
   {
-    if(receive_smb(Client,inbuf,OPLOCK_BREAK_TIMEOUT * 1000) == False)
+    if(receive_smb(Client,inbuf,
+                  (OPLOCK_BREAK_TIMEOUT/OPLOCK_BREAK_RESENDS) * 1000) == False)
     {
+
+           /* Isaac suggestd that if a MS client doesn't respond to a
+              oplock break request then we might try resending
+              it. Certainly it's no worse than just dropping the
+              socket! */
+           if (smb_read_error == READ_TIMEOUT && break_counter--) {
+                   DEBUG(2, ( "oplock_break resend\n" ) );
+                   send_smb(Client, outbuf);
+                   continue;
+           }
+
       /*
        * Die if we got an error.
        */