struct berval li_base_path;
enumCookie li_tool_cookie;
ID li_tool_current;
- ldap_pvt_thread_mutex_t li_mutex;
+ ldap_pvt_thread_rdwr_t li_rdwr;
};
#ifdef _WIN32
}
ni = (struct ldif_info *)op->o_bd->be_private;
- ldap_pvt_thread_mutex_lock( &ni->li_mutex );
+ ldap_pvt_thread_rdwr_rlock( &ni->li_rdwr );
entry = (Entry *)get_entry( op, &ni->li_base_path );
/* no object is found for them */
entry = (Entry *)get_entry( op, &ni->li_base_path );
}
- ldap_pvt_thread_mutex_unlock( &ni->li_mutex );
+ ldap_pvt_thread_rdwr_runlock( &ni->li_rdwr );
op->o_req_dn = odn;
op->o_req_ndn = ondn;
return rc;
}
- ldap_pvt_thread_mutex_unlock( &ni->li_mutex );
+ ldap_pvt_thread_rdwr_runlock( &ni->li_rdwr );
if ( is_entry_referral( entry ) ) {
/* entry is a referral */
Entry * entry = NULL;
ni = (struct ldif_info *) op->o_bd->be_private;
- ldap_pvt_thread_mutex_lock(&ni->li_mutex);
+ ldap_pvt_thread_rdwr_rlock(&ni->li_rdwr);
entry = (Entry *) get_entry(op, &ni->li_base_path);
/* no object is found for them */
goto return_result;
return_result:
- ldap_pvt_thread_mutex_unlock(&ni->li_mutex);
+ ldap_pvt_thread_rdwr_runlock(&ni->li_rdwr);
if(return_val != 0)
send_ldap_result( op, rs );
if(entry != NULL)
ck.op = op;
ck.rs = rs;
- ldap_pvt_thread_mutex_lock(&ni->li_mutex);
+ ldap_pvt_thread_rdwr_rlock(&ni->li_rdwr);
rs->sr_err = enum_tree( &ck );
- ldap_pvt_thread_mutex_unlock(&ni->li_mutex);
+ ldap_pvt_thread_rdwr_runlock(&ni->li_rdwr);
send_ldap_result(op, rs);
return rs->sr_err;
&rs->sr_text, textbuf, sizeof( textbuf ) );
if ( rs->sr_err != LDAP_SUCCESS ) goto send_res;
- ldap_pvt_thread_mutex_lock(&ni->li_mutex);
+ ldap_pvt_thread_rdwr_wlock(&ni->li_rdwr);
dn2path(&dn, &op->o_bd->be_nsuffix[0], &ni->li_base_path, &leaf_path);
SLAP_FREE(leaf_path.bv_val);
}
- ldap_pvt_thread_mutex_unlock(&ni->li_mutex);
+ ldap_pvt_thread_rdwr_wunlock(&ni->li_rdwr);
send_res:
Debug( LDAP_DEBUG_TRACE,
slap_mods_opattrs( op, &op->orm_modlist, 1 );
- ldap_pvt_thread_mutex_lock(&ni->li_mutex);
+ ldap_pvt_thread_rdwr_wlock(&ni->li_rdwr);
dn2path(&op->o_req_ndn, &op->o_bd->be_nsuffix[0], &ni->li_base_path,
&path);
entry = (Entry *) get_entry(op, &ni->li_base_path);
if(path.bv_val != NULL)
SLAP_FREE(path.bv_val);
rs->sr_text = NULL;
- ldap_pvt_thread_mutex_unlock(&ni->li_mutex);
+ ldap_pvt_thread_rdwr_wunlock(&ni->li_rdwr);
send_ldap_result(op, rs);
slap_graduate_commit_csn( op );
return 0;
slap_get_csn( op, &csn, 1 );
}
- ldap_pvt_thread_mutex_lock(&ni->li_mutex);
+ ldap_pvt_thread_rdwr_wlock(&ni->li_rdwr);
dn2path(&op->o_req_ndn, &op->o_bd->be_nsuffix[0], &ni->li_base_path, &path);
path.bv_val[path.bv_len - STRLENOF(LDIF)] = '\0';
rs->sr_err = LDAP_SUCCESS;
SLAP_FREE(path.bv_val);
- ldap_pvt_thread_mutex_unlock(&ni->li_mutex);
+ ldap_pvt_thread_rdwr_wunlock(&ni->li_rdwr);
send_ldap_result(op, rs);
slap_graduate_commit_csn( op );
return 0;
else { /* do the modrdn */
exists_res = open(newpath.bv_val, O_RDONLY);
if(exists_res == -1 && errno == ENOENT) {
+ ldap_pvt_thread_mutex_lock( &entry2str_mutex );
res = spew_entry(entry, &newpath);
if(res != -1) {
/* if this fails we should log something bad */
res = LDAP_UNWILLING_TO_PERFORM;
unlink(newpath.bv_val); /* in case file was created */
}
+ ldap_pvt_thread_mutex_unlock( &entry2str_mutex );
}
else if(exists_res) {
int close_res = close(exists_res);
slap_mods_opattrs( op, &op->orr_modlist, 1 );
- ldap_pvt_thread_mutex_lock( &ni->li_mutex );
- ldap_pvt_thread_mutex_lock( &entry2str_mutex );
+ ldap_pvt_thread_rdwr_wlock( &ni->li_rdwr );
entry = (Entry *) get_entry( op, &ni->li_base_path );
/* build the mods to the entry */
entry_free( entry );
}
rs->sr_text = "";
- ldap_pvt_thread_mutex_unlock( &ni->li_mutex );
- ldap_pvt_thread_mutex_unlock( &entry2str_mutex );
+ ldap_pvt_thread_rdwr_wunlock( &ni->li_rdwr );
send_ldap_result( op, rs );
slap_graduate_commit_csn( op );
return 0;
assert( ndn != NULL );
assert( !BER_BVISNULL( ndn ) );
- ldap_pvt_thread_mutex_lock( &ni->li_mutex );
+ ldap_pvt_thread_rdwr_rlock( &ni->li_rdwr );
op->o_req_dn = *ndn;
op->o_req_ndn = *ndn;
*ent = (Entry *) get_entry( op, &ni->li_base_path );
op->o_req_dn = op_dn;
op->o_req_ndn = op_ndn;
- ldap_pvt_thread_mutex_unlock( &ni->li_mutex );
+ ldap_pvt_thread_rdwr_runlock( &ni->li_rdwr );
if ( *ent && oc && !is_entry_objectclass_or_sub( *ent, oc ) ) {
entry_free( *ent );
ni = ch_calloc( 1, sizeof(struct ldif_info) );
be->be_private = ni;
be->be_cf_ocs = ldifocs;
- ldap_pvt_thread_mutex_init(&ni->li_mutex);
+ ldap_pvt_thread_rdwr_init(&ni->li_rdwr);
return 0;
}
struct ldif_info *ni = be->be_private;
ch_free(ni->li_base_path.bv_val);
- ldap_pvt_thread_mutex_destroy(&ni->li_mutex);
+ ldap_pvt_thread_rdwr_destroy(&ni->li_rdwr);
free( be->be_private );
return 0;
}