summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/local.h4
-rw-r--r--source3/smbd/oplock.c15
2 files changed, 18 insertions, 1 deletions
diff --git a/source3/include/local.h b/source3/include/local.h
index 7c63ab830b..85e61c63c4 100644
--- a/source3/include/local.h
+++ b/source3/include/local.h
@@ -184,6 +184,10 @@
#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. */
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index b1c6d9a981..03feae3a98 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -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.
*/