ITS#1733 eliminate o_abandonmutex

This commit is contained in:
Howard Chu 2002-04-11 08:03:40 +00:00
parent 0825e12b42
commit efecf4e121
20 changed files with 7 additions and 63 deletions

View File

@ -92,9 +92,7 @@ do_abandon(
LDAP_STAILQ_FOREACH( o, &conn->c_ops, o_next ) {
if ( o->o_msgid == id ) {
ldap_pvt_thread_mutex_lock( &o->o_abandonmutex );
o->o_abandon = 1;
ldap_pvt_thread_mutex_unlock( &o->o_abandonmutex );
goto done;
}
}

View File

@ -44,7 +44,6 @@ bdb_search(
int attrsonly )
{
struct bdb_info *bdb = (struct bdb_info *) be->be_private;
int abandon;
int rc;
const char *text = NULL;
time_t stoptime;
@ -299,11 +298,7 @@ bdb_search(
int scopeok = 0;
/* check for abandon */
ldap_pvt_thread_mutex_lock( &op->o_abandonmutex );
abandon = op->o_abandon;
ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
if ( abandon ) {
if ( op->o_abandon ) {
rc = 0;
goto done;
}

View File

@ -207,10 +207,7 @@ int ldbm_modify_internal(
}
/* check for abandon */
ldap_pvt_thread_mutex_lock( &op->o_abandonmutex );
rc = op->o_abandon;
ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
if ( rc ) {
if ( op->o_abandon ) {
rc = SLAPD_ABANDON;
goto exit;
}

View File

@ -468,13 +468,10 @@ ldbm_back_modrdn(
#endif
/* check for abandon */
ldap_pvt_thread_mutex_lock( &op->o_abandonmutex );
if ( op->o_abandon ) {
ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
goto return_results;
}
ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
if ( ( rc_id = dn2id ( be, &new_ndn, &id ) ) || id != NOID ) {
/* if (rc_id) something bad happened to ldbm cache */
send_ldap_result( conn, op,
@ -708,12 +705,9 @@ ldbm_back_modrdn(
/* check for abandon */
ldap_pvt_thread_mutex_lock( &op->o_abandonmutex );
if ( op->o_abandon ) {
ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
goto return_results;
}
ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
/* delete old one */
if ( dn2id_delete( be, &e->e_nname, e->e_id ) != 0 ) {

View File

@ -295,16 +295,11 @@ searchit:
int scopeok = 0;
/* check for abandon */
ldap_pvt_thread_mutex_lock( &op->o_abandonmutex );
if ( op->o_abandon ) {
ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
rc = 0;
goto done;
}
ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
/* check time limit */
if ( tlimit != -1 && slap_get_time() > stoptime ) {
send_search_result( conn, op, LDAP_TIMELIMIT_EXCEEDED,

View File

@ -406,9 +406,7 @@ meta_back_search(
int ab, gotit = 0;
/* check for abandon */
ldap_pvt_thread_mutex_lock( &op->o_abandonmutex );
ab = op->o_abandon;
ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
for ( i = 0, lsc = lc->conns; lsc[ 0 ] != NULL; lsc++, i++ ) {
if ( lsc[ 0 ]->candidate != META_CANDIDATE ) {

View File

@ -196,9 +196,7 @@ monitor_subsys_log_modify(
#if 0 /* need op */
/* check for abandon */
ldap_pvt_thread_mutex_lock( &op->o_abandonmutex );
if ( op->o_abandon ) {
ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
rc = SLAPD_ABANDON;
goto cleanup;

View File

@ -132,13 +132,10 @@ passwd_back_search(
for ( pw = getpwent(); pw != NULL; pw = getpwent() ) {
/* check for abandon */
ldap_pvt_thread_mutex_lock( &op->o_abandonmutex );
if ( op->o_abandon ) {
ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
endpwent();
return( -1 );
}
ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
/* check time limit */
if ( slap_get_time() > stoptime ) {

View File

@ -9,7 +9,6 @@
#include <stdio.h>
#include <ac/signal.h>
#include <ac/socket.h>
#include <ac/string.h>

View File

@ -584,13 +584,10 @@ int backsql_search(BackendDB *be,Connection *conn,Operation *op,
for(eid=srch_info.id_list;eid!=NULL;eid=eid->next)
{
/* check for abandon */
ldap_pvt_thread_mutex_lock(&op->o_abandonmutex);
if (op->o_abandon)
{
ldap_pvt_thread_mutex_unlock(&op->o_abandonmutex);
break;
}
ldap_pvt_thread_mutex_unlock(&op->o_abandonmutex);
/* check time limit */
if ( tlimit != -1 && slap_get_time() > stoptime)

View File

@ -993,12 +993,8 @@ backend_group(
)
{
GroupAssertion *g;
int i;
ldap_pvt_thread_mutex_lock( &op->o_abandonmutex );
i = op->o_abandon;
ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
if (i) return SLAPD_ABANDON;
if ( op->o_abandon ) return SLAPD_ABANDON;
if ( !dn_match( &target->e_nname, gr_ndn ) ) {
/* we won't attempt to send it to a different backend */

View File

@ -349,14 +349,11 @@ glue_back_search (
break;
}
}
rc = 0;
/*
* check for abandon
*/
ldap_pvt_thread_mutex_lock (&op->o_abandonmutex);
rc = op->o_abandon;
ldap_pvt_thread_mutex_unlock (&op->o_abandonmutex);
if (rc) {
rc = 0;
if (op->o_abandon) {
goto done;
}
be = gi->n[i].be;

View File

@ -11,7 +11,6 @@
#include <ac/socket.h>
#include <ac/errno.h>
#include <ac/signal.h>
#include <ac/string.h>
#include <ac/time.h>
#include <ac/unistd.h>
@ -740,9 +739,7 @@ static void connection_abandon( Connection *c )
Operation *o;
LDAP_STAILQ_FOREACH(o, &c->c_ops, o_next) {
ldap_pvt_thread_mutex_lock( &o->o_abandonmutex );
o->o_abandon = 1;
ldap_pvt_thread_mutex_unlock( &o->o_abandonmutex );
}
/* remove pending operations */

View File

@ -10,7 +10,6 @@
#include <ac/ctype.h>
#include <ac/errno.h>
#include <ac/signal.h>
#include <ac/socket.h>
#include <ac/string.h>
#include <ac/time.h>

View File

@ -7,7 +7,6 @@
#include <stdio.h>
#include <ac/signal.h>
#include <ac/socket.h>
#include <ac/string.h>
#include <ac/time.h>

View File

@ -36,8 +36,6 @@ slap_op_free( Operation *op )
ldap_controls_free( op->o_ctrls );
}
ldap_pvt_thread_mutex_destroy( &op->o_abandonmutex );
free( (char *) op );
}
@ -53,8 +51,6 @@ slap_op_alloc(
op = (Operation *) ch_calloc( 1, sizeof(Operation) );
ldap_pvt_thread_mutex_init( &op->o_abandonmutex );
op->o_ber = ber;
op->o_msgid = msgid;
op->o_tag = tag;

View File

@ -11,7 +11,6 @@
#include <ac/socket.h>
#include <ac/errno.h>
#include <ac/signal.h>
#include <ac/string.h>
#include <ac/ctype.h>
#include <ac/time.h>

View File

@ -11,7 +11,6 @@
#include <ac/socket.h>
#include <ac/errno.h>
#include <ac/signal.h>
#include <ac/string.h>
#include <ac/ctype.h>
#include <ac/time.h>

View File

@ -394,7 +394,6 @@ void slap_sasl2dn( struct berval *saslname, struct berval *dn )
goto FINISHED;
suffix_alias( be, &searchbase );
ldap_pvt_thread_mutex_init( &op.o_abandonmutex );
op.o_tag = LDAP_REQ_SEARCH;
op.o_protocol = LDAP_VERSION3;
op.o_ndn = *saslname;
@ -405,8 +404,6 @@ void slap_sasl2dn( struct berval *saslname, struct berval *dn )
scope, /*deref=*/1, /*sizelimit=*/1, /*time=*/0, filter, /*fstr=*/NULL,
/*attrs=*/NULL, /*attrsonly=*/0 );
ldap_pvt_thread_mutex_destroy( &op.o_abandonmutex );
FINISHED:
if( searchbase.bv_len ) ch_free( searchbase.bv_val );
if( filter ) filter_free( filter );
@ -513,7 +510,6 @@ int slap_sasl_match( struct berval *rule, struct berval *assertDN, struct berval
sm.match = 0;
cb.sc_private = &sm;
ldap_pvt_thread_mutex_init( &op.o_abandonmutex );
op.o_tag = LDAP_REQ_SEARCH;
op.o_protocol = LDAP_VERSION3;
op.o_ndn = *authc;
@ -524,8 +520,6 @@ int slap_sasl_match( struct berval *rule, struct berval *assertDN, struct berval
scope, /*deref=*/1, /*sizelimit=*/0, /*time=*/0, filter, /*fstr=*/NULL,
/*attrs=*/NULL, /*attrsonly=*/0 );
ldap_pvt_thread_mutex_destroy( &op.o_abandonmutex );
if (sm.match)
rc = LDAP_SUCCESS;
else

View File

@ -16,6 +16,7 @@
#include <sys/types.h>
#include <ac/syslog.h>
#include <ac/regex.h>
#include <ac/signal.h>
#include <ac/socket.h>
#include <ac/time.h>
#include <ac/param.h>
@ -1442,8 +1443,7 @@ typedef struct slap_op {
ldap_pvt_thread_t o_tid; /* thread handling this op */
ldap_pvt_thread_mutex_t o_abandonmutex; /* protects o_abandon */
char o_abandon; /* abandon flag */
volatile sig_atomic_t o_abandon; /* abandon flag */
#define SLAP_NO_CONTROL 0
#define SLAP_NONCRITICAL_CONTROL 1