2.2.1a on Solaris; runaway fcntl bugfix !

Jeremy Allison jeremy at valinux.com
Wed Sep 5 18:59:45 GMT 2001


Ok, due to some *amazingly* helpful debugging work by
Gerry, I'm pretty sure I've found the fcntl spinning
problem and I've fixed it in CVS.

I'm also including the patch that applies cleanly to
2.2.1a to this message.

The problem was in the code that was added to abstract
the kernel oplock interface between IRIX and Linux.

What it did was it changed the logic of the oplock
break processing so that incoming SMB messages from
the client were being given precedence over incoming
oplock break message from other smbds. The original
2.0.x code gave precedence to oplock break messages
over client smb messages.

This would cause the messages to get lost when the receiving
smbd was under heavy client load - just the kind of hard
to reproduce bug that we were seeing.

Please try the attached patch against 2.2.1a installations
and let me know if it fixes the problem (it should :-).
Fingers crossed......

Jeremy.


Index: include/proto.h
===================================================================
RCS file: /data/cvs/samba/source/include/Attic/proto.h,v
retrieving revision 1.900.2.229
diff -u -r1.900.2.229 proto.h
--- include/proto.h	5 Sep 2001 20:01:05 -0000	1.900.2.229
+++ include/proto.h	5 Sep 2001 21:40:22 -0000
@@ -4166,6 +4166,7 @@
 /*The following definitions come from  smbd/oplock.c  */
 
 int32 get_number_of_exclusive_open_oplocks(void);
+BOOL oplock_message_waiting(fd_set *fds);
 BOOL receive_local_message(fd_set *fds, char *buffer, int buffer_len, int timeout);
 BOOL set_file_oplock(files_struct *fsp, int oplock_type);
 void release_file_oplock(files_struct *fsp);
Index: smbd/oplock.c
===================================================================
RCS file: /data/cvs/samba/source/smbd/oplock.c,v
retrieving revision 1.43.4.11
diff -u -r1.43.4.11 oplock.c
--- smbd/oplock.c	4 Sep 2001 19:58:05 -0000	1.43.4.11
+++ smbd/oplock.c	5 Sep 2001 21:40:23 -0000
@@ -48,6 +48,20 @@
   return exclusive_oplocks_open;
 }
 
+/****************************************************************************
+ Return True if an oplock message is pending.
+****************************************************************************/
+
+BOOL oplock_message_waiting(fd_set *fds)
+{
+	if (koplocks && koplocks->msg_waiting(fds))
+		return True;
+
+	if (FD_ISSET(oplock_sock, fds))
+		return True;
+
+	return False;
+}
 
 /****************************************************************************
  Read an oplock break message from either the oplock UDP fd or the
Index: smbd/process.c
===================================================================
RCS file: /data/cvs/samba/source/smbd/process.c,v
retrieving revision 1.44.2.21
diff -u -r1.44.2.21 process.c
--- smbd/process.c	27 Aug 2001 22:42:41 -0000	1.44.2.21
+++ smbd/process.c	5 Sep 2001 21:40:24 -0000
@@ -223,7 +223,13 @@
 		return False;
 	}
 
-	if (!FD_ISSET(smbd_server_fd(),&fds) || selrtn > 1) {
+	/*
+	 * Ensure we process oplock break messages by preference.
+	 * This is IMPORTANT ! Otherwise we can starve other processes
+	 * sending us an oplock break message. JRA.
+	 */
+
+	if (oplock_message_waiting(&fds)) {
 		async_processing(&fds, buffer, buffer_len);
 		if (!FD_ISSET(smbd_server_fd(),&fds)) goto again;
 	}

-- 
--------------------------------------------------------
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