summaryrefslogtreecommitdiffstats
path: root/ldap
diff options
context:
space:
mode:
authorNoriko Hosoi <nhosoi@redhat.com>2006-12-07 21:15:00 +0000
committerNoriko Hosoi <nhosoi@redhat.com>2006-12-07 21:15:00 +0000
commit199480487674a0b6bafaf359be27bc2af8b313f4 (patch)
tree6b0942744f00ee1ab0edfa2fe256436049b5f111 /ldap
parentac8acf7645f37ca9027157a3eb697c15f106f81f (diff)
downloadds-199480487674a0b6bafaf359be27bc2af8b313f4.tar.gz
ds-199480487674a0b6bafaf359be27bc2af8b313f4.tar.xz
ds-199480487674a0b6bafaf359be27bc2af8b313f4.zip
Resolves: #183222
Summary: Directory Server hangs when running VLV search and update operations simultaneously. (Comment#22) Change: Before creating db cursor, unlock vlvSearchList.
Diffstat (limited to 'ldap')
-rw-r--r--ldap/servers/slapd/back-ldbm/vlv.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/ldap/servers/slapd/back-ldbm/vlv.c b/ldap/servers/slapd/back-ldbm/vlv.c
index 458410e7..ac08b2af 100644
--- a/ldap/servers/slapd/back-ldbm/vlv.c
+++ b/ldap/servers/slapd/back-ldbm/vlv.c
@@ -59,7 +59,7 @@
static PRUint32 vlv_trim_candidates_byindex(PRUint32 length, const struct vlv_request *vlv_request_control);
static PRUint32 vlv_trim_candidates_byvalue(backend *be, const IDList *candidates, const sort_spec* sort_control, const struct vlv_request *vlv_request_control);
-static int vlv_build_candidate_list( backend *be, struct vlvIndex* p, const struct vlv_request *vlv_request_control, IDList** candidates, struct vlv_response *vlv_response_control);
+static int vlv_build_candidate_list( backend *be, struct vlvIndex* p, const struct vlv_request *vlv_request_control, IDList** candidates, struct vlv_response *vlv_response_control, int is_srchlist_locked);
/* New mutex for vlv locking
PRRWLock * vlvSearchList_lock=NULL;
@@ -1068,15 +1068,16 @@ vlv_search_build_candidate_list(Slapi_PBlock *pb, const Slapi_DN *base, int *vlv
PR_RWLock_Rlock(be->vlvSearchList_lock);
if((pi=vlv_find_search(be, base, scope, fstr, sort_control)) == NULL) {
unsigned int opnote = SLAPI_OP_NOTE_UNINDEXED;
+ PR_RWLock_Unlock(be->vlvSearchList_lock);
slapi_pblock_set( pb, SLAPI_OPERATION_NOTES, &opnote );
rc = VLV_FIND_SEARCH_FAILED;
} else if((*vlv_rc=vlvIndex_accessallowed(pi, pb)) != LDAP_SUCCESS) {
+ PR_RWLock_Unlock(be->vlvSearchList_lock);
rc = VLV_ACCESS_DENIED;
- } else if ((*vlv_rc=vlv_build_candidate_list(be,pi,vlv_request_control,candidates,vlv_response_control)) != LDAP_SUCCESS) {
+ } else if ((*vlv_rc=vlv_build_candidate_list(be,pi,vlv_request_control,candidates,vlv_response_control, 1)) != LDAP_SUCCESS) {
rc = VLV_BLD_LIST_FAILED;
vlv_response_control->result=*vlv_rc;
}
- PR_RWLock_Unlock(be->vlvSearchList_lock);
return rc;
}
@@ -1096,7 +1097,7 @@ vlv_search_build_candidate_list(Slapi_PBlock *pb, const Slapi_DN *base, int *vlv
static int
-vlv_build_candidate_list( backend *be, struct vlvIndex* p, const struct vlv_request *vlv_request_control, IDList** candidates, struct vlv_response *vlv_response_control)
+vlv_build_candidate_list( backend *be, struct vlvIndex* p, const struct vlv_request *vlv_request_control, IDList** candidates, struct vlv_response *vlv_response_control, int is_srchlist_locked)
{
int return_value = LDAP_SUCCESS;
DB *db = NULL;
@@ -1111,6 +1112,9 @@ vlv_build_candidate_list( backend *be, struct vlvIndex* p, const struct vlv_requ
slapi_sdn_get_dn(vlvIndex_getBase(p)), p->vlv_search->vlv_filter,
vlvIndex_getName(p));
if (!vlvIndex_online(p)) {
+ if (is_srchlist_locked) {
+ PR_RWLock_Unlock(be->vlvSearchList_lock);
+ }
return -1;
}
rc = dblayer_get_index_file(be, p->vlv_attrinfo, &db, 0);
@@ -1118,9 +1122,20 @@ vlv_build_candidate_list( backend *be, struct vlvIndex* p, const struct vlv_requ
/* shouldn't happen */
LDAPDebug(LDAP_DEBUG_ANY, "VLV: can't get index file '%s' (err %d)\n",
p->vlv_attrinfo->ai_type, rc, 0);
+ if (is_srchlist_locked) {
+ PR_RWLock_Unlock(be->vlvSearchList_lock);
+ }
return -1;
}
+ length = vlvIndex_get_indexlength(p, db, 0 /* txn */);
+
+ /* Increment the usage counter */
+ vlvIndex_incrementUsage(p);
+
+ if (is_srchlist_locked) {
+ PR_RWLock_Unlock(be->vlvSearchList_lock);
+ }
err = db->cursor(db, 0 /* txn */, &dbc, 0);
if (err != 0) {
/* shouldn't happen */
@@ -1129,11 +1144,6 @@ vlv_build_candidate_list( backend *be, struct vlvIndex* p, const struct vlv_requ
return -1;
}
- length = vlvIndex_get_indexlength(p, db, 0 /* txn */);
-
- /* Increment the usage counter */
- vlvIndex_incrementUsage(p);
-
if (vlv_request_control)
{
switch(vlv_request_control->tag) {