From: Howard Chu Date: Sun, 24 Apr 2005 22:21:57 +0000 (+0000) Subject: ITS#3671 add REP_ENTRY_MUSTRELEASE flag, release the entry before X-Git-Tag: OPENLDAP_AC_BP~807 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b92387bb1caf75bac5bf308d1780204a36ceb5dc;p=openldap ITS#3671 add REP_ENTRY_MUSTRELEASE flag, release the entry before attempting to write the response on the network. (This should probably be the default behavior anyway, since network hangs of this sort can cause problems for any backend that has entry locks.) --- diff --git a/servers/slapd/result.c b/servers/slapd/result.c index 38bad417eb..37a91b6837 100644 --- a/servers/slapd/result.c +++ b/servers/slapd/result.c @@ -1192,6 +1192,12 @@ slap_send_search_entry( Operation *op, SlapReply *rs ) goto error_return; } + if ( rs->sr_flags & REP_ENTRY_MUSTRELEASE ) { + be_entry_release_rw( op, rs->sr_entry, 0 ); + rs->sr_flags ^= REP_ENTRY_MUSTRELEASE; + rs->sr_entry = NULL; + } + if ( op->o_res_ber == NULL ) { bytes = send_ldap_ber( op->o_conn, ber ); ber_free_buf( ber ); @@ -1214,7 +1220,7 @@ slap_send_search_entry( Operation *op, SlapReply *rs ) } Statslog( LDAP_DEBUG_STATS2, "%s ENTRY dn=\"%s\"\n", - op->o_log_prefix, rs->sr_entry->e_dn, 0, 0, 0 ); + op->o_log_prefix, edn, 0, 0, 0 ); Debug( LDAP_DEBUG_TRACE, "<= send_search_entry: conn %lu exit.\n", op->o_connid, 0, 0 ); @@ -1387,6 +1393,12 @@ slap_send_search_reference( Operation *op, SlapReply *rs ) goto rel; } + if ( rs->sr_flags & REP_ENTRY_MUSTRELEASE ) { + be_entry_release_rw( op, rs->sr_entry, 0 ); + rs->sr_flags ^= REP_ENTRY_MUSTRELEASE; + rs->sr_entry = NULL; + } + #ifdef LDAP_CONNECTIONLESS if (!op->o_conn || op->o_conn->c_is_udp == 0) { #endif diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 3537d3f907..5c085fdd25 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -1913,6 +1913,7 @@ typedef struct slap_rep { slap_mask_t sr_flags; #define REP_ENTRY_MODIFIABLE 0x0001U #define REP_ENTRY_MUSTBEFREED 0x0002U +#define REP_ENTRY_MUSTRELEASE 0x0004U #define REP_MATCHED_MUSTBEFREED 0x0010U #define REP_REF_MUSTBEFREED 0x0020U } SlapReply;