locking issues

Jeremy Allison jeremy at valinux.com
Mon Jan 29 22:44:46 GMT 2001


"Romeril, Alan" wrote:
> 
> Hello All,
>         We've been struggling with slow logons of Win2K clients to Samba
> servers (2.0.7 and 2.2.0) and looking at Ethereal dumps of the session
> between the Client and Samba server there seemed to be big delays in
> responding to SMBntcreateX requests with SMBlockingX packets.  Looking
> through the oplock code there's a couple of these in smbd/oplock.c
> 
>     /*
>      * If we are sending an oplock break due to an SMB sent
>      * by our own client we ensure that we wait at leat
>      * lp_oplock_break_wait_time() milliseconds before sending
>      * the packet. Sending the packet sooner can break Win9x
>      * and has reported to cause problems on NT. JRA.
>      */
> 
>     wait_before_sending_break(local_request);
>     /* Prepare the SMBlockingX message. */
> 
>     prepare_break_message( outbuf, fsp, False);
>     send_smb(Client, outbuf);
> 
> Jeremy or anyone else what are the things that break in 95 and what are the
> problems caused in NT4?

This was when we were trying various things to fix oplock break problem
reports. One of the MS server developers claimed that this was a problem for win9x
clients - we coded it up based on their assurance that this was the correct
fix. However, we were not able to reliably reproduce the problem - but
the code got left in there.... (sorry).

> Looking at a Win2K to Win2K logon these packets are sent very quickly after
> the SMBntcreateX request, and there are many more SMBntcreateX packets that
> result in a SMBlockingX response than for an NT4 logon.  Where is this
> going?  I added this if statement to not wait before sending in both
> occurrences when dealing with Win2K clients.
> 
>     /*
>      * If we are sending an oplock break due to an SMB sent
>      * by our own client we ensure that we wait at leat
>      * lp_oplock_break_wait_time() milliseconds before sending
>      * the packet. Sending the packet sooner can break Win9x
>      * and has reported to cause problems on NT. JRA.
>      */
>     /*
>      * WIN2K seems happy to bang out these breaks quickly, so are we. AR12.
>      */
>     if (get_remote_arch() != RA_WIN2K) {
>         wait_before_sending_break(local_request);
>     }
> 
>     /* Prepare the SMBlockingX message. */
> 
> The result of this is about a 50% speed up of domain logons from Win2K
> clients, some users get less, some (with bigger profiles) get more.  So it
> goes back to my question what happens to NT4 when these packets are sent too
> fast?  I don't want to put code live that has a chance of destroying data /
> crashing clients, but as Win2K seems to send them quickly, the code runs
> fine on a test server and the speed up is really needed I'd like others to
> take a look at this as well.

*VERY* interesting ! The default is 10ms. I could drop the
default to 0, and allow people having problems to up the
time....

Try this patch (I will commit this for 2.2 and HEAD).

----------------cut here-------------------------------
Index: param/loadparm.c
===================================================================
RCS file: /data/cvs/samba/source/param/loadparm.c,v
retrieving revision 1.251.2.19
diff -u -r1.251.2.19 loadparm.c
--- param/loadparm.c	2001/01/23 19:20:50	1.251.2.19
+++ param/loadparm.c	2001/01/30 00:30:18
@@ -1256,7 +1256,7 @@
 	Globals.bRestrictAnonymous = False;
 	Globals.map_to_guest = 0;	/* By Default, "Never" */
 	Globals.min_passwd_length = MINPASSWDLENGTH;	/* By Default, 5. */
-	Globals.oplock_break_wait_time = 10;	/* By Default, 10 msecs. */
+	Globals.oplock_break_wait_time = 0;	/* By Default, 0 msecs. */
 
 #ifdef WITH_LDAP
 	/* default values for ldap */
Index: smbd/oplock.c
===================================================================
RCS file: /data/cvs/samba/source/smbd/oplock.c,v
retrieving revision 1.43.4.2
diff -u -r1.43.4.2 oplock.c
--- smbd/oplock.c	2000/11/16 01:19:05	1.43.4.2
+++ smbd/oplock.c	2001/01/30 00:30:25
@@ -470,6 +470,9 @@
     struct timeval cur_tv;
     long wait_left = (long)lp_oplock_break_wait_time();
 
+	if (wait_left == 0)
+		return;
+
     GetTimeOfDay(&cur_tv);
 
     wait_left -= ((cur_tv.tv_sec - smb_last_time.tv_sec)*1000) +
----------------cut here-------------------------------

*EXCELLENT* detective work !

Jeremy.

-- 
--------------------------------------------------------
Buying an operating system without source is like buying
a self-assembly Space Shuttle with no instructions.
--------------------------------------------------------




More information about the samba-technical mailing list