+
+ if ( get_assert( op ) &&
+ ( test_filter( op, e, get_assertion( op )) != LDAP_COMPARE_TRUE ))
+ {
+ rs->sr_err = LDAP_ASSERTION_FAILED;
+ goto return_results;
+ }
+
+ if ( rs->sr_err == LDAP_SUCCESS && !op->o_noop && !op->o_no_psearch ) {
+ ldap_pvt_thread_rdwr_wlock( &bdb->bi_pslist_rwlock );
+ LDAP_LIST_FOREACH ( ps_list, &bdb->bi_psearch_list, o_ps_link ) {
+ rc = bdb_psearch(op, rs, ps_list, e, LDAP_PSEARCH_BY_PREMODIFY );
+ if ( rc == LDAP_BUSY && op->o_ps_send_wait ) {
+ ldap_pvt_thread_rdwr_wunlock( &bdb->bi_pslist_rwlock );
+ goto retry;
+ } else if ( rc ) {
+ Debug( LDAP_DEBUG_TRACE,
+ LDAP_XSTRING(bdb_modify)
+ ": persistent search failed (%d,%d)\n",
+ rc, rs->sr_err, 0 );
+ }
+ }
+ ldap_pvt_thread_rdwr_wunlock( &bdb->bi_pslist_rwlock );
+ }
+
+ if( op->o_preread ) {
+ if( preread_ctrl == NULL ) {
+ preread_ctrl = &ctrls[num_ctrls++];
+ ctrls[num_ctrls] = NULL;
+ }
+ if ( slap_read_controls( op, rs, e,
+ &slap_pre_read_bv, preread_ctrl ) )
+ {
+ Debug( LDAP_DEBUG_TRACE,
+ "<=- " LDAP_XSTRING(bdb_modify)
+ ": pre-read failed!\n", 0, 0, 0 );
+ goto return_results;
+ }
+ }
+
+ /* nested transaction */
+ rs->sr_err = TXN_BEGIN( bdb->bi_dbenv, ltid, <2,
+ bdb->bi_db_opflags );
+ rs->sr_text = NULL;
+ if( rs->sr_err != 0 ) {
+ Debug( LDAP_DEBUG_TRACE,
+ LDAP_XSTRING(bdb_modify) ": txn_begin(2) failed: "
+ "%s (%d)\n",
+ db_strerror(rs->sr_err), rs->sr_err, 0 );
+ rs->sr_err = LDAP_OTHER;
+ rs->sr_text = "internal error";
+ goto return_results;
+ }