]> git.sur5r.net Git - openldap/commitdiff
Reverse lock order when detaching op
authorHoward Chu <hyc@openldap.org>
Wed, 28 Jan 2009 02:03:07 +0000 (02:03 +0000)
committerHoward Chu <hyc@openldap.org>
Wed, 28 Jan 2009 02:03:07 +0000 (02:03 +0000)
servers/slapd/overlays/syncprov.c

index ef20194d89b8970032ed1aa890a6aae532e9aaf8..2f8686acecde99fd327ea91623917de1bd3eeb7d 100644 (file)
@@ -2123,17 +2123,16 @@ syncprov_search_response( Operation *op, SlapReply *rs )
                                op->o_tmpfree( cookie.bv_val, op->o_tmpmemctx );
 
                        /* Detach this Op from frontend control */
-                       ldap_pvt_thread_mutex_lock( &ss->ss_so->s_mutex );
                        ldap_pvt_thread_mutex_lock( &op->o_conn->c_mutex );
 
                        /* But not if this connection was closed along the way */
                        if ( op->o_abandon ) {
                                ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
-                               ldap_pvt_thread_mutex_unlock( &ss->ss_so->s_mutex );
                                /* syncprov_ab_cleanup will free this syncop */
                                return SLAPD_ABANDON;
 
                        } else {
+                               ldap_pvt_thread_mutex_lock( &ss->ss_so->s_mutex );
                                /* Turn off the refreshing flag */
                                ss->ss_so->s_flags ^= PS_IS_REFRESHING;
 
@@ -2144,8 +2143,8 @@ syncprov_search_response( Operation *op, SlapReply *rs )
                                /* If there are queued responses, fire them off */
                                if ( ss->ss_so->s_res )
                                        syncprov_qstart( ss->ss_so );
+                               ldap_pvt_thread_mutex_unlock( &ss->ss_so->s_mutex );
                        }
-                       ldap_pvt_thread_mutex_unlock( &ss->ss_so->s_mutex );
 
                        return LDAP_SUCCESS;
                }