Author: nhosoi
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12379
Modified Files:
vlv.c
Log Message:
[183222] Directory Server hangs when running VLV search and update operations
simultaneously.
Demoted the write lock to the read lock in vlv_update_all_indexes
Index: vlv.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/vlv.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- vlv.c 19 Apr 2005 22:07:38 -0000 1.6
+++ vlv.c 8 Mar 2006 01:31:12 -0000 1.7
@@ -72,6 +72,7 @@
backend *be = inst->inst_be;
vlvSearch_init(newVlvSearch, pb, entryBefore, inst);
+ /* vlvSearchList is modified; need Wlock */
PR_RWLock_Wlock(be->vlvSearchList_lock);
vlvSearch_addtolist(newVlvSearch, (struct vlvSearch **)&be->vlvSearchList);
PR_RWLock_Unlock(be->vlvSearchList_lock);
@@ -89,7 +90,8 @@
slapi_sdn_init(&parentdn);
slapi_sdn_get_parent(slapi_entry_get_sdn(entryBefore),&parentdn);
{
- PR_RWLock_Wlock(be->vlvSearchList_lock);
+ /* vlvIndex list is modified; need Wlock */
+ PR_RWLock_Wlock(be->vlvSearchList_lock);
parent= vlvSearch_finddn((struct vlvSearch *)be->vlvSearchList,
&parentdn);
if(parent!=NULL)
{
@@ -109,10 +111,11 @@
int vlv_DeleteSearchEntry(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry*
entryAfter, int *returncode, char *returntext, void *arg)
{
struct vlvSearch* p=NULL;
- backend *be= ((ldbm_instance*)arg)->inst_be;
+ backend *be= ((ldbm_instance*)arg)->inst_be;
- PR_RWLock_Wlock(be->vlvSearchList_lock);
- p = vlvSearch_finddn((struct vlvSearch *)be->vlvSearchList,
slapi_entry_get_sdn(entryBefore));
+ /* vlvSearchList is modified; need Wlock */
+ PR_RWLock_Wlock(be->vlvSearchList_lock);
+ p = vlvSearch_finddn((struct vlvSearch *)be->vlvSearchList,
slapi_entry_get_sdn(entryBefore));
if(p!=NULL)
{
LDAPDebug( LDAP_DEBUG_ANY, "Deleted Virtual List View Search (%s).\n",
p->vlv_name, 0, 0);
@@ -269,7 +272,7 @@
int any_not_done = 0;
- PR_RWLock_Wlock(be->vlvSearchList_lock);
+ PR_RWLock_Wlock(be->vlvSearchList_lock);
if (seen_them_all) {
PR_RWLock_Unlock(be->vlvSearchList_lock);
return;
@@ -320,6 +323,7 @@
{
struct vlvSearch *t = NULL;
struct vlvSearch *nt = NULL;
+ /* vlvSearchList is modified; need Wlock */
PR_RWLock_Wlock(be->vlvSearchList_lock);
for (t = (struct vlvSearch *)be->vlvSearchList; NULL != t; )
{
@@ -762,8 +766,8 @@
*
* JCM: If only non-sorted attributes are changed, then the indexes don't need
updating.
* JCM: Detecting this fact, given multi-valued atribibutes, might be tricky...
- * Added write lock
-*/
+ * Read lock (traverse vlvSearchList; no change on vlvSearchList/vlvIndex lists)
+ */
int
vlv_update_all_indexes(back_txn *txn, backend *be, Slapi_PBlock *pb, struct backentry*
oldEntry, struct backentry* newEntry)
@@ -772,7 +776,7 @@
struct vlvSearch* ps=NULL;
struct ldbminfo *li = ((ldbm_instance *)be->be_instance_info)->inst_li;
- PR_RWLock_Wlock(be->vlvSearchList_lock);
+ PR_RWLock_Rlock(be->vlvSearchList_lock);
ps = (struct vlvSearch *)be->vlvSearchList;
for(;ps!=NULL;ps= ps->vlv_next)
{
@@ -1927,10 +1931,11 @@
tag1=create_vlv_search_tag(dn);
buf=slapi_ch_smprintf("%s%s%s%s%s","cn=MCC ",tag1,",
cn=",inst->inst_name,LDBM_PLUGIN_ROOT);
newdn=slapi_sdn_new_dn_byval(buf);
+ /* vlvSearchList is modified; need Wlock */
PR_RWLock_Wlock(be->vlvSearchList_lock);
p = vlvSearch_finddn((struct vlvSearch *)be->vlvSearchList, newdn);
- if(p!=NULL)
- {
+ if(p!=NULL)
+ {
LDAPDebug( LDAP_DEBUG_ANY, "Deleted Virtual List View Search (%s).\n",
p->vlv_name, 0, 0);
tag2=create_vlv_search_tag(dn);
buf2=slapi_ch_smprintf("%s%s,%s",TAG,tag2,buf);