[Pkg-openldap-devel] r785 - in openldap/trunk-2.3: . debian debian/patches

Russ Allbery rra at alioth.debian.org
Sun Mar 4 07:55:31 CET 2007


Author: rra
Date: 2007-03-04 06:55:30 +0000 (Sun, 04 Mar 2007)
New Revision: 785

Added:
   openldap/trunk-2.3/debian/patches/connection-race
Modified:
   openldap/trunk-2.3/
   openldap/trunk-2.3/debian/changelog
   openldap/trunk-2.3/debian/patches/series
Log:
* Apply upstream patch to prevent a race condition in slapd when
  shutting down connections.


Property changes on: openldap/trunk-2.3
___________________________________________________________________
Name: svn:ignore
   + .pc


Modified: openldap/trunk-2.3/debian/changelog
===================================================================
--- openldap/trunk-2.3/debian/changelog	2007-03-01 02:58:01 UTC (rev 784)
+++ openldap/trunk-2.3/debian/changelog	2007-03-04 06:55:30 UTC (rev 785)
@@ -10,8 +10,10 @@
   * When starting slapd, create a symlink from /var/run/ldapi to
     /var/run/slapd/ldapi for compatibility with 2.1 client libraries.
     Closes: #385809.
+  * Apply upstream patch to prevent a race condition in slapd when
+    shutting down connections.
 
- -- Russ Allbery <rra at debian.org>  Wed, 28 Feb 2007 18:57:43 -0800
+ -- Russ Allbery <rra at debian.org>  Sat,  3 Mar 2007 22:55:11 -0800
 
 openldap2.3 (2.3.30-4) unstable; urgency=low
 

Added: openldap/trunk-2.3/debian/patches/connection-race
===================================================================
--- openldap/trunk-2.3/debian/patches/connection-race	2007-03-01 02:58:01 UTC (rev 784)
+++ openldap/trunk-2.3/debian/patches/connection-race	2007-03-04 06:55:30 UTC (rev 785)
@@ -0,0 +1,58 @@
+===================================================================
+RCS file: /repo/OpenLDAP/pkg/ldap/servers/slapd/connection.c,v
+retrieving revision 1.296.2.21
+retrieving revision 1.296.2.23
+diff -p -u -r1.296.2.21 -r1.296.2.23
+--- servers/slapd/connection.c	2006/12/13 15:58:10	1.296.2.21
++++ /repo/OpenLDAP/pkg/ldap/servers/slapd/connection.c	2006/12/24 18:05:13	1.296.2.23
+@@ -196,23 +196,22 @@ int connections_shutdown(void)
+ 	ber_socket_t i;
+ 
+ 	for ( i = 0; i < dtblsize; i++ ) {
+-		if( connections[i].c_struct_state != SLAP_C_USED ) {
+-			continue;
+-		}
+-		/* give persistent clients a chance to cleanup */
+-		if( connections[i].c_conn_state == SLAP_C_CLIENT ) {
+-			ldap_pvt_thread_pool_submit( &connection_pool,
+-			connections[i].c_clientfunc, connections[i].c_clientarg );
+-			continue;
+-		}
+-
+-		ldap_pvt_thread_mutex_lock( &connections[i].c_mutex );
+-
+-		/* c_mutex is locked */
+-		connection_closing( &connections[i], "slapd shutdown" );
+-		connection_close( &connections[i] );
++		if( connections[i].c_struct_state != SLAP_C_UNINITIALIZED ) {
++			ldap_pvt_thread_mutex_lock( &connections[i].c_mutex );
++			if( connections[i].c_struct_state == SLAP_C_USED ) {
+ 
+-		ldap_pvt_thread_mutex_unlock( &connections[i].c_mutex );
++				/* give persistent clients a chance to cleanup */
++				if( connections[i].c_conn_state == SLAP_C_CLIENT ) {
++					ldap_pvt_thread_pool_submit( &connection_pool,
++					connections[i].c_clientfunc, connections[i].c_clientarg );
++				} else {
++					/* c_mutex is locked */
++					connection_closing( &connections[i], "slapd shutdown" );
++					connection_close( &connections[i] );
++				}
++			}
++			ldap_pvt_thread_mutex_unlock( &connections[i].c_mutex );
++		}
+ 	}
+ 
+ 	return 0;
+@@ -306,9 +305,9 @@ static Connection* connection_get( ber_s
+ 	if( c != NULL ) {
+ 		ber_socket_t	sd;
+ 
+-		assert( c->c_struct_state != SLAP_C_UNINITIALIZED );
+-
+ 		ldap_pvt_thread_mutex_lock( &c->c_mutex );
++
++		assert( c->c_struct_state != SLAP_C_UNINITIALIZED );
+ 
+ 		ber_sockbuf_ctrl( c->c_sb, LBER_SB_OPT_GET_FD, &sd );
+ 		if( c->c_struct_state != SLAP_C_USED ) {

Modified: openldap/trunk-2.3/debian/patches/series
===================================================================
--- openldap/trunk-2.3/debian/patches/series	2007-03-01 02:58:01 UTC (rev 784)
+++ openldap/trunk-2.3/debian/patches/series	2007-03-04 06:55:30 UTC (rev 785)
@@ -18,3 +18,4 @@
 kbind-security-fix -p0
 fix-memleak-on-failed-bind -p0
 fix-memleak-acls-uses-sets -p0
+connection-race -p0




More information about the Pkg-openldap-devel mailing list