[Fedora-directory-commits] ldapserver/ldap/servers/plugins/passthru ptpreop.c, 1.4, 1.4.2.1
by Doctor Conrad
Author: nhosoi
Update of /cvs/dirsec/ldapserver/ldap/servers/plugins/passthru
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv25304
Modified Files:
Tag: Directory71RtmBranch
ptpreop.c
Log Message:
Resolves: #176302
Summary: crash in PTA plugin when bind returned controls
Description: applied the patch to Directory71RtmBranch
Index: ptpreop.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/passthru/ptpreop.c,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -u -r1.4 -r1.4.2.1
--- ptpreop.c 19 Apr 2005 22:07:31 -0000 1.4
+++ ptpreop.c 11 Jan 2008 18:39:10 -0000 1.4.2.1
@@ -143,7 +143,7 @@
static int
passthru_bindpreop( Slapi_PBlock *pb )
{
- int rc, method;
+ int rc, method, freeresctrls=1;
char *normbinddn, *matcheddn;
char *libldap_errmsg, *pr_errmsg, *errmsg;
PassThruConfig *cfg;
@@ -253,7 +253,8 @@
* Send a result to our client.
*/
if ( resctrls != NULL ) {
- (void)slapi_pblock_set( pb, SLAPI_RESCONTROLS, &resctrls );
+ (void)slapi_pblock_set( pb, SLAPI_RESCONTROLS, resctrls );
+ freeresctrls=0;
}
slapi_send_ldap_result( pb, rc, matcheddn, errmsg, 0, urls );
}
@@ -270,7 +271,7 @@
if ( pr_errmsg != NULL ) {
PR_smprintf_free( pr_errmsg );
}
- if ( resctrls != NULL ) {
+ if ( freeresctrls && (resctrls != NULL) ) {
ldap_controls_free( resctrls );
}
if ( matcheddn != NULL ) {
16 years, 3 months
[Fedora-directory-commits] ldapserver/ldap/servers/slapd/back-ldbm vlv.c, 1.6.2.3, 1.6.2.4
by Doctor Conrad
Author: nhosoi
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv15322
Modified Files:
Tag: Directory71RtmBranch
vlv.c
Log Message:
Resolves: #314851
Summary: vlv: crash after repeated backend creation/deletion
Description: applied the patch to Directory71RtmBranch
Index: vlv.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/vlv.c,v
retrieving revision 1.6.2.3
retrieving revision 1.6.2.4
diff -u -r1.6.2.3 -r1.6.2.4
--- vlv.c 11 Jan 2008 01:02:52 -0000 1.6.2.3
+++ vlv.c 11 Jan 2008 03:06:04 -0000 1.6.2.4
@@ -71,6 +71,9 @@
struct vlvSearch* newVlvSearch= vlvSearch_new();
backend *be = inst->inst_be;
+ if (NULL == be) { /* backend is not associated */
+ return SLAPI_DSE_CALLBACK_ERROR;
+ }
vlvSearch_init(newVlvSearch, pb, entryBefore, inst);
/* vlvSearchList is modified; need Wlock */
PR_RWLock_Wlock(be->vlvSearchList_lock);
@@ -275,6 +278,9 @@
ldbm_instance *inst = (ldbm_instance*)arg;
backend *be= inst->inst_be;
+ if (NULL == be) { /* backend is not associated */
+ return SLAPI_DSE_CALLBACK_ERROR;
+ }
vlvSearch_init(newVlvSearch, pb, entryBefore, inst);
vlvSearch_addtolist(newVlvSearch, (struct vlvSearch **)&be->vlvSearchList);
return SLAPI_DSE_CALLBACK_OK;
16 years, 3 months
[Fedora-directory-commits] ldapserver/ldap/servers/slapd libglobs.c, 1.6, 1.6.2.1 proto-slap.h, 1.10.2.3, 1.10.2.4 connection.c, 1.8, 1.8.2.1 daemon.c, 1.6, 1.6.2.1 task.c, 1.7, 1.7.2.1 monitor.c, 1.5, 1.5.2.1 psearch.c, 1.5, 1.5.2.1 fe.h, 1.4, 1.4.2.1 globals.c, 1.4, 1.4.2.1
by Doctor Conrad
Author: nhosoi
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv31666
Modified Files:
Tag: Directory71RtmBranch
libglobs.c proto-slap.h connection.c daemon.c task.c monitor.c
psearch.c fe.h globals.c
Log Message:
Resolves: #240897
Summary: CRM 1474928 : ds7.1 db index/vlv not handling a stop-slapd, hangs slapd
Description: applied the patch to Directory71RtmBranch
Index: libglobs.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/libglobs.c,v
retrieving revision 1.6
retrieving revision 1.6.2.1
diff -u -r1.6 -r1.6.2.1
--- libglobs.c 19 Apr 2005 22:07:36 -0000 1.6
+++ libglobs.c 11 Jan 2008 01:09:14 -0000 1.6.2.1
@@ -651,6 +651,29 @@
}
/*
+ * counter for active threads
+ */
+static PRInt32 active_threads = 0;
+
+void
+g_incr_active_threadcnt()
+{
+ PR_AtomicIncrement(&active_threads);
+}
+
+void
+g_decr_active_threadcnt()
+{
+ PR_AtomicDecrement(&active_threads);
+}
+
+int
+g_get_active_threadcnt()
+{
+ return (int)active_threads;
+}
+
+/*
** Setting this flag forces the server to shutdown.
*/
static int slapd_shutdown;
Index: proto-slap.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/proto-slap.h,v
retrieving revision 1.10.2.3
retrieving revision 1.10.2.4
diff -u -r1.10.2.3 -r1.10.2.4
--- proto-slap.h 18 Mar 2006 17:48:37 -0000 1.10.2.3
+++ proto-slap.h 11 Jan 2008 01:09:14 -0000 1.10.2.4
@@ -196,6 +196,9 @@
int g_get_deftime();
void be_unbindall( Connection *conn, Operation *op);
int be_nbackends_public();
+void g_incr_active_threadcnt();
+void g_decr_active_threadcnt();
+int g_get_active_threadcnt();
/*
* bind.c
Index: connection.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/connection.c,v
retrieving revision 1.8
retrieving revision 1.8.2.1
diff -u -r1.8 -r1.8.2.1
--- connection.c 12 May 2005 03:43:15 -0000 1.8
+++ connection.c 11 Jan 2008 01:09:14 -0000 1.8.2.1
@@ -393,7 +393,7 @@
LDAPDebug( LDAP_DEBUG_ANY, "PR_CreateThread failed, " SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
prerr, slapd_pr_strerror( prerr ), 0 );
} else {
- PR_AtomicIncrement(&active_threads);
+ g_incr_active_threadcnt();
}
}
}
@@ -730,7 +730,7 @@
}
}
}
- PR_AtomicDecrement(&active_threads);
+ g_decr_active_threadcnt();
}
static int handle_read_data(Connection *conn,Operation **op,
@@ -1911,9 +1911,11 @@
No bother to do so much calcuation, short-cut to non-turbo mode if no activities in passed interval */
new_mode = 0;
} else {
+ double activet = 0.0;
connection_find_our_rank(conn,&connection_count, &our_rank);
LDAPDebug(LDAP_DEBUG_CONNS,"conn %d turbo rank = %d out of %d conns\n",conn->c_connid,our_rank,connection_count);
- threshold_rank = (int)((double)active_threads * ((double)CONN_TURBO_PERCENTILE / 100.0) );
+ activet = (double)g_get_active_threadcnt();
+ threshold_rank = (int)(activet * ((double)CONN_TURBO_PERCENTILE / 100.0));
/* adjust threshold_rank according number of connections,
less turbo threads as more connections,
@@ -1986,7 +1988,7 @@
if( op_shutdown ) {
LDAPDebug( LDAP_DEBUG_TRACE,
"op_thread received shutdown signal\n", 0, 0, 0 );
- PR_AtomicDecrement(&active_threads);
+ g_decr_active_threadcnt();
return;
}
@@ -2002,7 +2004,7 @@
case CONN_SHUTDOWN:
LDAPDebug( LDAP_DEBUG_TRACE,
"op_thread received shutdown signal\n", 0, 0, 0 );
- PR_AtomicDecrement(&active_threads);
+ g_decr_active_threadcnt();
return;
case CONN_FOUND_WORK_TO_DO:
default:
@@ -2065,7 +2067,7 @@
case CONN_SHUTDOWN:
LDAPDebug( LDAP_DEBUG_TRACE,
"op_thread received shutdown signal\n", 0, 0, 0 );
- PR_AtomicDecrement(&active_threads);
+ g_decr_active_threadcnt();
return;
default:
break;
@@ -2296,7 +2298,7 @@
#ifdef _WIN32
LDAPDebug( LDAP_DEBUG_ANY,
"slapd shutting down - waiting for %d threads to terminate\n",
- active_threads, 0, 0 );
+ g_get_active_threadcnt(), 0, 0 );
/* kill off each worker waiting on GetQueuedCompletionStatus */
for ( i = 0; i < max_threads; ++ i )
{
Index: daemon.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/daemon.c,v
retrieving revision 1.6
retrieving revision 1.6.2.1
diff -u -r1.6 -r1.6.2.1
--- daemon.c 19 Apr 2005 22:07:36 -0000 1.6
+++ daemon.c 11 Jan 2008 01:09:15 -0000 1.6.2.1
@@ -695,15 +695,16 @@
housekeeping_stop(); /* Run this after op_thread_cleanup() logged sth */
#ifndef _WIN32
- if ( active_threads > 0 ) {
+ threads = g_get_active_threadcnt();
+ if ( threads > 0 ) {
LDAPDebug( LDAP_DEBUG_ANY,
"slapd shutting down - waiting for %d thread%s to terminate\n",
- active_threads, ( active_threads > 1 ) ? "s" : "", 0 );
+ threads, ( threads > 1 ) ? "s" : "", 0 );
}
#endif
- threads = active_threads;
- while ( active_threads > 0 ) {
+ threads = g_get_active_threadcnt();
+ while ( threads > 0 ) {
PRPollDesc xpd;
char x;
int spe = 0;
@@ -733,11 +734,11 @@
/* no data */
}
DS_Sleep(PR_INTERVAL_NO_WAIT);
- if ( threads != active_threads ) {
+ if ( threads != g_get_active_threadcnt() ) {
LDAPDebug( LDAP_DEBUG_TRACE,
"slapd shutting down - waiting for %d threads to terminate\n",
- active_threads, 0, 0 );
- threads = active_threads;
+ g_get_active_threadcnt(), 0, 0 );
+ threads = g_get_active_threadcnt();
}
}
@@ -1096,7 +1097,7 @@
snmp_collator_update();
prevtime = curtime;
- num_active_threads = active_threads;
+ num_active_threads = g_get_active_threadcnt();
if ( (num_active_threads == 0) ||
(difftime(curtime, housekeeping_fire_time) >=
slapd_housekeeping_timer*3) ) {
Index: task.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/task.c,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -u -r1.7 -r1.7.2.1
--- task.c 19 Apr 2005 22:07:37 -0000 1.7
+++ task.c 11 Jan 2008 01:09:15 -0000 1.7.2.1
@@ -585,6 +585,7 @@
int count;
Slapi_Task *task = pb->pb_task;
+ g_incr_active_threadcnt();
for (count = 0, inp = instance_names; *inp; inp++, count++)
;
task->task_work = count;
@@ -684,6 +685,7 @@
task->task_exitcode = rv;
task->task_state = SLAPI_TASK_FINISHED;
slapi_task_status_changed(task);
+ g_decr_active_threadcnt();
}
static int task_export_add(Slapi_PBlock *pb, Slapi_Entry *e,
@@ -925,6 +927,7 @@
Slapi_Task *task = pb->pb_task;
int rv;
+ g_incr_active_threadcnt();
task->task_work = 1;
task->task_progress = 0;
task->task_state = SLAPI_TASK_RUNNING;
@@ -953,6 +956,7 @@
slapi_ch_free((void **)&pb->pb_seq_val);
slapi_pblock_destroy(pb);
+ g_decr_active_threadcnt();
}
static int task_backup_add(Slapi_PBlock *pb, Slapi_Entry *e,
@@ -1068,6 +1072,7 @@
Slapi_Task *task = pb->pb_task;
int rv;
+ g_incr_active_threadcnt();
task->task_work = 1;
task->task_progress = 0;
task->task_state = SLAPI_TASK_RUNNING;
@@ -1096,6 +1101,7 @@
slapi_ch_free((void **)&pb->pb_seq_val);
slapi_pblock_destroy(pb);
+ g_decr_active_threadcnt();
}
static int task_restore_add(Slapi_PBlock *pb, Slapi_Entry *e,
@@ -1219,6 +1225,7 @@
Slapi_Task *task = pb->pb_task;
int rv;
+ g_incr_active_threadcnt();
task->task_work = 1;
task->task_progress = 0;
task->task_state = SLAPI_TASK_RUNNING;
@@ -1239,6 +1246,7 @@
charray_free(pb->pb_db2index_attrs);
slapi_ch_free((void **)&pb->pb_instance_name);
slapi_pblock_destroy(pb);
+ g_decr_active_threadcnt();
}
static int task_index_add(Slapi_PBlock *pb, Slapi_Entry *e,
Index: monitor.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/monitor.c,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -u -r1.5 -r1.5.2.1
--- monitor.c 19 Apr 2005 22:07:36 -0000 1.5
+++ monitor.c 11 Jan 2008 01:09:15 -0000 1.5.2.1
@@ -81,7 +81,7 @@
attrlist_replace( &e->e_attrs, "version", vals );
slapi_ch_free( (void **) &val.bv_val );
- sprintf( buf, "%d", active_threads );
+ sprintf( buf, "%d", g_get_active_threadcnt() );
val.bv_val = buf;
val.bv_len = strlen( buf );
attrlist_replace( &e->e_attrs, "threads", vals );
Index: psearch.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/psearch.c,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -u -r1.5 -r1.5.2.1
--- psearch.c 19 Apr 2005 22:07:36 -0000 1.5
+++ psearch.c 11 Jan 2008 01:09:15 -0000 1.5.2.1
@@ -290,7 +290,7 @@
char **pbattrs = NULL;
int conn_acq_flag = 0;
- PR_AtomicIncrement( &active_threads );
+ g_incr_active_threadcnt();
/* need to acquire a reference to this connection so that it will not
be released or cleaned up out from under us */
@@ -438,7 +438,7 @@
pe_ch_free( &peq );
}
slapi_ch_free((void **) &ps );
- PR_AtomicDecrement(&active_threads);
+ g_decr_active_threadcnt();
}
Index: fe.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/fe.h,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -u -r1.4 -r1.4.2.1
--- fe.h 19 Apr 2005 22:07:36 -0000 1.4
+++ fe.h 11 Jan 2008 01:09:15 -0000 1.4.2.1
@@ -51,7 +51,6 @@
#endif /* DONT_DECLARE_SLAPD_LDAP_DEBUG */
#endif
#endif
-extern int active_threads;
extern PRInt32 ops_initiated;
extern PRInt32 ops_completed;
extern PRLock *ops_mutex;
Index: globals.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/globals.c,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -u -r1.4 -r1.4.2.1
--- globals.c 19 Apr 2005 22:07:36 -0000 1.4
+++ globals.c 11 Jan 2008 01:09:15 -0000 1.4.2.1
@@ -86,14 +86,12 @@
/*
* global variables that need mutex protection
*/
-int active_threads;
PRInt32 ops_initiated;
PRInt32 ops_completed;
PRLock *ops_mutex;
int num_conns;
PRLock *num_conns_mutex;
-
/*
DEC/COMPAQ has released a patch for 4.0d (e?) which will speed up
malloc/free considerably in multithreaded multiprocessor
16 years, 3 months
[Fedora-directory-commits] ldapserver/ldap/servers/slapd/back-ldbm vlv.c, 1.6.2.2, 1.6.2.3
by Doctor Conrad
Author: nhosoi
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv31508
Modified Files:
Tag: Directory71RtmBranch
vlv.c
Log Message:
Resolves: #171081
Summary: ldapsearch hung at browsing index creation
Description: applied the patch to Directory71RtmBranch
Index: vlv.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/vlv.c,v
retrieving revision 1.6.2.2
retrieving revision 1.6.2.3
diff -u -r1.6.2.2 -r1.6.2.3
--- vlv.c 10 Jan 2008 19:44:21 -0000 1.6.2.2
+++ vlv.c 11 Jan 2008 01:02:52 -0000 1.6.2.3
@@ -111,18 +111,28 @@
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;
-
+ ldbm_instance *inst = (ldbm_instance*)arg;
+ backend *be= inst->inst_be;
+
+ if (instance_set_busy(inst) != 0)
+ {
+ LDAPDebug( LDAP_DEBUG_ANY,
+ "Backend instance: '%s' is already in the middle of "
+ "another task and cannot be disturbed.\n",
+ inst->inst_name, 0, 0);
+ return SLAPI_DSE_CALLBACK_ERROR;
+ }
/* vlvSearchList is modified; need Wlock */
- PR_RWLock_Wlock(be->vlvSearchList_lock);
- p = vlvSearch_finddn((struct vlvSearch *)be->vlvSearchList, slapi_entry_get_sdn(entryBefore));
+ 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);
- vlvSearch_removefromlist((struct vlvSearch **)&be->vlvSearchList,p->vlv_dn);
- vlvSearch_delete(&p);
+ {
+ LDAPDebug( LDAP_DEBUG_ANY, "Deleted Virtual List View Search (%s).\n", p->vlv_name, 0, 0);
+ vlvSearch_removefromlist((struct vlvSearch **)&be->vlvSearchList,p->vlv_dn);
+ vlvSearch_delete(&p);
}
- PR_RWLock_Unlock(be->vlvSearchList_lock);
+ PR_RWLock_Unlock(be->vlvSearchList_lock);
+ instance_set_not_busy(inst);
return SLAPI_DSE_CALLBACK_OK;
}
@@ -131,8 +141,18 @@
int vlv_DeleteIndexEntry(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* entryAfter, int *returncode, char *returntext, void *arg)
{
- LDAPDebug( LDAP_DEBUG_ANY, "Deleted Virtual List View Index.\n", 0, 0, 0);
- return SLAPI_DSE_CALLBACK_OK;
+ ldbm_instance *inst = (ldbm_instance*)arg;
+ if (inst && (inst->inst_flags & INST_FLAG_BUSY)) {
+ LDAPDebug( LDAP_DEBUG_ANY,
+ "Backend instance: '%s' is already in the middle of "
+ "another task and cannot be disturbed.\n",
+ inst->inst_name, 0, 0);
+ return SLAPI_DSE_CALLBACK_ERROR;
+ } else {
+ LDAPDebug( LDAP_DEBUG_ANY,
+ "Deleted Virtual List View Index.\n", 0, 0, 0);
+ return SLAPI_DSE_CALLBACK_OK;
+ }
}
@@ -1492,11 +1512,12 @@
}
id= candidates->b_ids[current];
e = id2entry( be, id, NULL, &err );
- if ( e == NULL )
- {
+ if ( e == NULL )
+ {
int rval;
- LDAPDebug( LDAP_DEBUG_ANY, "vlv_trim_candidates_byvalue: Candidate ID %lu not found err=%d\n", (u_long)id, err, 0 );
- rval = idl_delete(&candidates, id);
+ LDAPDebug( LDAP_DEBUG_ANY, "vlv_trim_candidates_byvalue: "
+ "Candidate ID %lu not found err=%d\n", (u_long)id, err, 0 );
+ rval = idl_delete((IDList **)&candidates, id);
if (0 == rval || 1 == rval || 2 == rval) {
goto retry;
} else {
@@ -1953,6 +1974,14 @@
const char *dn= slapi_sdn_get_dn(&e->e_sdn);
backend *be= inst->inst_be;
+ if (instance_set_busy(inst) != 0)
+ {
+ LDAPDebug( LDAP_DEBUG_ANY,
+ "Backend instance: '%s' is already in the middle of "
+ "another task and cannot be disturbed.\n",
+ inst->inst_name, 0, 0);
+ return LDAP_OPERATIONS_ERROR;
+ }
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);
@@ -1991,6 +2020,7 @@
} else {
PR_RWLock_Unlock(be->vlvSearchList_lock);
}
+ instance_set_not_busy(inst);
slapi_ch_free((void **)&tag1);
slapi_ch_free((void **)&buf);
slapi_sdn_free(&newdn);
16 years, 3 months
[Fedora-directory-commits] ldapserver/ldap/servers/slapd/back-ldbm ldif2ldbm.c, 1.7, 1.7.2.1 vlv_srch.c, 1.6, 1.6.2.1
by Doctor Conrad
Author: nhosoi
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv24438
Modified Files:
Tag: Directory71RtmBranch
ldif2ldbm.c vlv_srch.c
Log Message:
Resolves: #243820
Summary: Online browsing indexing hangs
Description: applied the patch to Directory71RtmBranch
Index: ldif2ldbm.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/ldif2ldbm.c,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -u -r1.7 -r1.7.2.1
--- ldif2ldbm.c 19 Apr 2005 22:07:38 -0000 1.7
+++ ldif2ldbm.c 11 Jan 2008 00:44:38 -0000 1.7.2.1
@@ -188,7 +188,7 @@
int *status)
{
backend *be;
- const char *pdn;
+ char *pdn;
ID pid = 0;
slapi_pblock_get(pb, SLAPI_BACKEND, &be);
@@ -216,7 +216,7 @@
* suffix entry, or its erroneous. So, we signal this to the
* caller via the status parameter.
*/
- bv.bv_val = (char *)pdn;
+ bv.bv_val = pdn;
bv.bv_len = strlen(pdn);
if ( (idl = index_read( be, "entrydn", indextype_EQUALITY, &bv, NULL,
&err )) != NULL ) {
@@ -225,7 +225,7 @@
} else if ( 0 != err ) {
if (DB_NOTFOUND != err ) {
LDAPDebug( LDAP_DEBUG_ANY, "database error %d\n", err, 0, 0 );
- slapi_ch_free( (void**)&pdn );
+ slapi_ch_free_string( &pdn );
return( -1 );
} else {
if (NULL != status) {
@@ -233,7 +233,7 @@
}
}
}
- slapi_ch_free( (void**)&pdn );
+ slapi_ch_free_string( &pdn );
} else {
if (NULL != status) {
*status = IMPORT_ADD_OP_ATTRS_NO_PARENT;
@@ -315,7 +315,7 @@
* let's do it so we can reuse the modify routines) */
cache_lock_entry( &inst->inst_cache, e );
modify_init(&mc,e);
- sprintf(value_buffer,"%lu",sub_count);
+ sprintf(value_buffer,"%u",sub_count);
/* attr numsubordinates could already exist in the entry,
let's check whether it's already there or not */
isreplace = (attrlist_find(e->ep_entry->e_attrs, numsubordinates) != NULL);
@@ -1252,7 +1252,7 @@
"ldbm2index: Unknown VLV Index named '%s'\n", index, 0, 0);
LDAPDebug(LDAP_DEBUG_ANY,
"ldbm2index: Known VLV Indexes are: %s\n", text, 0, 0);
- slapi_ch_free((void**)&text);
+ slapi_ch_free_string(&text);
}
/*
@@ -1276,20 +1276,25 @@
IDList *idl = NULL; /* optimization for vlv index creation */
int numvlv = 0;
int return_value = -1;
+ int rc = -1;
ID temp_id;
- int i, j;
+ int i, j, vlvidx;
ID lastid;
- struct backentry *ep;
+ struct backentry *ep = NULL;
char *type;
NIDS idindex = 0;
int count = 0;
Slapi_Attr *attr;
Slapi_Task *task;
- int ret = 0;
int isfirst = 1;
int index_aid = 0; /* index ancestorid */
+ struct vlvIndex *vlvip = NULL;
+ back_txn txn;
LDAPDebug( LDAP_DEBUG_TRACE, "=> ldbm_back_ldbm2index\n", 0, 0, 0 );
+ if ( g_get_shutdown() || c_get_shutdown() ) {
+ return return_value;
+ }
slapi_pblock_get(pb, SLAPI_BACKEND_INSTANCE_NAME, &instance_name);
slapi_pblock_get(pb, SLAPI_PLUGIN_PRIVATE, &li);
@@ -1301,6 +1306,7 @@
/* No ldbm backend exists until we process the config info. */
li->li_flags |= TASK_RUNNING_FROM_COMMANDLINE;
ldbm_config_load_dse_info(li);
+ txn.back_txn_txn = NULL; /* no transaction */
}
inst = ldbm_instance_find_by_name(li, instance_name);
@@ -1311,7 +1317,7 @@
}
LDAPDebug(LDAP_DEBUG_ANY, "Unknown ldbm instance %s\n",
instance_name, 0, 0);
- return -1;
+ return return_value;
}
be = inst->inst_be;
slapi_pblock_set(pb, SLAPI_BACKEND, be);
@@ -1326,14 +1332,14 @@
if (0 != dblayer_start(li,DBLAYER_INDEX_MODE)) {
LDAPDebug( LDAP_DEBUG_ANY,
"ldbm2index: Failed to init database\n", 0, 0, 0 );
- return( -1 );
+ return return_value;
}
/* dblayer_instance_start will init the id2entry index. */
if (0 != dblayer_instance_start(be, DBLAYER_INDEX_MODE)) {
- LDAPDebug(LDAP_DEBUG_ANY, "db2ldif: Failed to init instance\n",
+ LDAPDebug(LDAP_DEBUG_ANY, "ldbm2index: Failed to init instance\n",
0, 0, 0);
- return -1;
+ return return_value;
}
/* Initialise the Virtual List View code */
@@ -1345,34 +1351,31 @@
LDAPDebug(LDAP_DEBUG_ANY, "ldbm: '%s' is already in the middle of "
"another task and cannot be disturbed.\n",
inst->inst_name, 0, 0);
- return -1;
+ return return_value;
}
if ((( dblayer_get_id2entry( be, &db )) != 0 ) || (db == NULL)) {
LDAPDebug( LDAP_DEBUG_ANY, "Could not open/create id2entry\n",
0, 0, 0 );
- instance_set_not_busy(inst);
- return( -1 );
+ goto err_min;
}
/* get a cursor to we can walk over the table */
- return_value = db->cursor(db, NULL, &dbc, 0);
- if (0 != return_value ) {
+ rc = db->cursor(db, NULL, &dbc, 0);
+ if (0 != rc ) {
LDAPDebug( LDAP_DEBUG_ANY,
"Failed to get cursor for ldbm2index\n", 0, 0, 0 );
- dblayer_release_id2entry(be, db);
- instance_set_not_busy(inst);
- return( -1 );
+ goto err_min;
}
/* ask for the last id so we can give cute percentages */
key.flags = DB_DBT_MALLOC;
data.flags = DB_DBT_MALLOC;
- return_value = dbc->c_get(dbc, &key, &data, DB_LAST);
- if (return_value == DB_NOTFOUND) {
+ rc = dbc->c_get(dbc, &key, &data, DB_LAST);
+ if (rc == DB_NOTFOUND) {
lastid = 0;
isfirst = 0; /* neither a first nor a last */
- } else if (return_value == 0) {
+ } else if (rc == 0) {
lastid = id_stored_to_internal((char *)key.data);
free(key.data);
free(data.data);
@@ -1381,10 +1384,7 @@
LDAPDebug(LDAP_DEBUG_ANY,
"Failed to seek within id2entry (BAD %d)\n",
return_value, 0 ,0);
- dbc->c_close(dbc);
- dblayer_release_id2entry(be, db);
- instance_set_not_busy(inst);
- return( -1 );
+ goto err_out;
}
/* Work out which indexes we should build */
@@ -1395,11 +1395,13 @@
*/
{
char **attrs = NULL;
- struct vlvIndex *p = NULL;
struct attrinfo *ai = NULL;
slapi_pblock_get(pb, SLAPI_DB2INDEX_ATTRS, &attrs);
for (i = 0; attrs[i] != NULL; i++) {
+ if ( g_get_shutdown() || c_get_shutdown() ) {
+ goto err_out;
+ }
switch(attrs[i][0]) {
case 't': /* attribute type to index */
db2index_add_indexed_attr(be, attrs[i]);
@@ -1427,13 +1429,11 @@
dblayer_erase_index_file(be, ai, i/* chkpt; 1st time only */);
break;
case 'T': /* VLV Search to index */
- p = vlv_find_searchname((attrs[i])+1, be);
- if (p == NULL) {
+ vlvip = vlv_find_searchname((attrs[i])+1, be);
+ if (vlvip == NULL) {
ldbm2index_bad_vlv(task, inst, attrs[i]+1);
- ret = -1;
- goto out;
} else {
- vlvIndex_go_offline(p, be);
+ vlvIndex_go_offline(vlvip, be);
if (pvlv == NULL) {
pvlv = (struct vlvIndex **)slapi_ch_calloc(1,
sizeof(struct vlvIndex *));
@@ -1441,10 +1441,10 @@
pvlv = (struct vlvIndex **)slapi_ch_realloc((char*)pvlv,
(numvlv+1)*sizeof(struct vlvIndex *));
}
- pvlv[numvlv] = p;
+ pvlv[numvlv] = vlvip;
numvlv++;
/* Get rid of the index if it already exists */
- PR_Delete(vlvIndex_filename(p));
+ PR_Delete(vlvIndex_filename(vlvip));
if (task) {
slapi_task_log_notice(task, "%s: Indexing VLV: %s",
inst->inst_name, attrs[i]+1);
@@ -1462,12 +1462,12 @@
* entire database.
*/
if (!indexAttrs && !index_aid && pvlv) {
- int i, err;
+ int err;
char **suffix_list = NULL;
/* create suffix list */
- for (i = 0; i < numvlv; i++) {
- char *s = slapi_ch_strdup(slapi_sdn_get_dn(vlvIndex_getBase(pvlv[i])));
+ for (vlvidx = 0; vlvidx < numvlv; vlvidx++) {
+ char *s = slapi_ch_strdup(slapi_sdn_get_dn(vlvIndex_getBase(pvlv[vlvidx])));
s = slapi_dn_normalize_case(s);
charray_add(&suffix_list, s);
@@ -1503,11 +1503,10 @@
idindex = 0;
}
- /* Bug 603120: slapd dumps core while indexing and deleting the db at the
- * same time. Now added the lock for the indexing code too.
- */
- vlv_acquire_lock(be);
while (1) {
+ if ( g_get_shutdown() || c_get_shutdown() ) {
+ goto err_out;
+ }
if (idl) {
if (idindex >= idl->b_nids)
break;
@@ -1516,12 +1515,11 @@
key.size = sizeof(temp_id);
data.flags = DB_DBT_MALLOC;
- return_value = db->get(db, NULL, &key, &data, 0);
- if (return_value) {
+ rc = db->get(db, NULL, &key, &data, 0);
+ if (rc) {
LDAPDebug(LDAP_DEBUG_ANY, "%s: Failed "
"to read database, errno=%d (%s)\n",
- inst->inst_name, return_value,
- dblayer_strerror(return_value));
+ inst->inst_name, rc, dblayer_strerror(return_value));
if (task) {
slapi_task_log_notice(task,
"%s: Failed to read database, err %d (%s)",
@@ -1537,27 +1535,24 @@
key.flags = DB_DBT_MALLOC;
data.flags = DB_DBT_MALLOC;
if (isfirst) {
- return_value = dbc->c_get(dbc, &key, &data, DB_FIRST);
+ rc = dbc->c_get(dbc, &key, &data, DB_FIRST);
isfirst = 0;
} else{
- return_value = dbc->c_get(dbc, &key, &data, DB_NEXT);
+ rc = dbc->c_get(dbc, &key, &data, DB_NEXT);
}
- if (0 != return_value) {
- if (DB_NOTFOUND == return_value) {
- break;
- } else {
- LDAPDebug(LDAP_DEBUG_ANY, "%s: Failed to read database, "
- "errno=%d (%s)\n", inst->inst_name, return_value,
- dblayer_strerror(return_value));
- if (task) {
- slapi_task_log_notice(task,
+ if (DB_NOTFOUND == rc) {
+ break;
+ } else if (0 != rc) {
+ LDAPDebug(LDAP_DEBUG_ANY, "%s: Failed to read database, "
+ "errno=%d (%s)\n", inst->inst_name, rc,
+ dblayer_strerror(rc));
+ if (task) {
+ slapi_task_log_notice(task,
"%s: Failed to read database, err %d (%s)",
- inst->inst_name, return_value,
- dblayer_strerror(return_value));
- }
- break;
+ inst->inst_name, rc, dblayer_strerror(rc));
}
+ break;
}
temp_id = id_stored_to_internal((char *)key.data);
free(key.data);
@@ -1594,9 +1589,7 @@
LDAPDebug(LDAP_DEBUG_ANY,
"%s: ERROR: Could not add op attrs to entry (id %lu)\n",
inst->inst_name, (u_long)ep->ep_id, 0);
- backentry_free( &ep );
- ret = -1;
- goto out;
+ goto err_out;
}
/*
@@ -1606,21 +1599,17 @@
for (i = slapi_entry_first_attr(ep->ep_entry, &attr); i == 0;
i = slapi_entry_next_attr(ep->ep_entry, attr, &attr)) {
Slapi_Value **svals;
- int rc = 0;
slapi_attr_get_type( attr, &type );
for ( j = 0; indexAttrs[j] != NULL; j++ ) {
+ if ( g_get_shutdown() || c_get_shutdown() ) {
+ goto err_out;
+ }
if (slapi_attr_type_cmp(indexAttrs[j], type,
SLAPI_TYPE_CMP_SUBTYPE) == 0 ) {
- back_txn txn;
svals = attr_get_present_values(attr);
- if (run_from_cmdline)
- {
- txn.back_txn_txn = NULL;
- }
- else
- {
+ if (!run_from_cmdline) {
rc = dblayer_txn_begin(li, NULL, &txn);
if (0 != rc) {
LDAPDebug(LDAP_DEBUG_ANY,
@@ -1637,8 +1626,8 @@
inst->inst_name, indexAttrs[j], rc,
dblayer_strerror(rc));
}
- ret = -2;
- goto out;
+ return_value = -2;
+ goto err_out;
}
}
rc = index_addordel_values_sv(
@@ -1657,13 +1646,13 @@
"(err %d: %s)", inst->inst_name,
indexAttrs[j], rc, dblayer_strerror(rc));
}
- if (!run_from_cmdline)
- dblayer_txn_abort(li, &txn);
- ret = -2;
- goto out;
+ if (!run_from_cmdline) {
+ dblayer_txn_abort(li, &txn);
+ }
+ return_value = -2;
+ goto err_out;
}
- if (!run_from_cmdline)
- {
+ if (!run_from_cmdline) {
rc = dblayer_txn_commit(li, &txn);
if (0 != rc) {
LDAPDebug(LDAP_DEBUG_ANY,
@@ -1680,8 +1669,8 @@
"(err %d: %s)", inst->inst_name,
indexAttrs[j], rc, dblayer_strerror(rc));
}
- ret = -2;
- goto out;
+ return_value = -2;
+ goto err_out;
}
}
}
@@ -1692,21 +1681,16 @@
/*
* Update the Virtual List View indexes
*/
- for ( j = 0; j<numvlv; j++ ) {
- back_txn txn;
- int rc = 0;
- if (run_from_cmdline)
- {
- txn.back_txn_txn = NULL;
+ for ( vlvidx = 0; vlvidx < numvlv; vlvidx++ ) {
+ if ( g_get_shutdown() || c_get_shutdown() ) {
+ goto err_out;
}
- else
- if (!run_from_cmdline)
- {
+ if (!run_from_cmdline) {
rc = dblayer_txn_begin(li, NULL, &txn);
if (0 != rc) {
LDAPDebug(LDAP_DEBUG_ANY,
"%s: ERROR: failed to begin txn for update index '%s'\n",
- inst->inst_name, indexAttrs[j], 0);
+ inst->inst_name, indexAttrs[vlvidx], 0);
LDAPDebug(LDAP_DEBUG_ANY,
"%s: Error %d: %s\n", inst->inst_name, rc,
dblayer_strerror(rc));
@@ -1714,20 +1698,26 @@
slapi_task_log_notice(task,
"%s: ERROR: failed to begin txn for update index '%s' "
"(err %d: %s)", inst->inst_name,
- indexAttrs[j], rc, dblayer_strerror(rc));
+ indexAttrs[vlvidx], rc, dblayer_strerror(rc));
}
- ret = -2;
- goto out;
+ return_value = -2;
+ goto err_out;
}
}
- vlv_update_index(pvlv[j], &txn, li, pb, NULL, ep);
+ /*
+ * lock is needed around vlv_update_index to protect the
+ * vlv structure.
+ */
+ vlv_acquire_lock(be);
+ vlv_update_index(pvlv[vlvidx], &txn, li, pb, NULL, ep);
+ vlv_release_lock(be);
if (!run_from_cmdline)
{
rc = dblayer_txn_commit(li, &txn);
if (0 != rc) {
LDAPDebug(LDAP_DEBUG_ANY,
"%s: ERROR: failed to commit txn for update index '%s'\n",
- inst->inst_name, indexAttrs[j], 0);
+ inst->inst_name, indexAttrs[vlvidx], 0);
LDAPDebug(LDAP_DEBUG_ANY,
"%s: Error %d: %s\n", inst->inst_name, rc,
dblayer_strerror(rc));
@@ -1735,10 +1725,10 @@
slapi_task_log_notice(task,
"%s: ERROR: failed to commit txn for update index '%s' "
"(err %d: %s)", inst->inst_name,
- indexAttrs[j], rc, dblayer_strerror(rc));
+ indexAttrs[vlvidx], rc, dblayer_strerror(rc));
}
- ret = -2;
- goto out;
+ return_value = -2;
+ goto err_out;
}
}
}
@@ -1747,8 +1737,6 @@
* Update the ancestorid index
*/
if (index_aid) {
- int rc;
-
rc = ldbm_ancestorid_index_entry(be, ep, BE_INDEX_ADD, NULL);
if (rc != 0) {
LDAPDebug(LDAP_DEBUG_ANY,
@@ -1763,8 +1751,8 @@
"(err %d: %s)", inst->inst_name,
rc, dblayer_strerror(rc));
}
- ret = -2;
- goto out;
+ return_value = -2;
+ goto err_out;
}
}
@@ -1792,7 +1780,6 @@
backentry_free( &ep );
}
- vlv_release_lock(be);
/* if we got here, we finished successfully */
@@ -1804,8 +1791,8 @@
PR_ASSERT(ai != NULL);
ai->ai_indexmask &= ~INDEX_OFFLINE;
}
- for (i = 0; i < numvlv; i++) {
- vlvIndex_go_online(pvlv[i], be);
+ for (vlvidx = 0; vlvidx < numvlv; vlvidx++) {
+ vlvIndex_go_online(pvlv[vlvidx], be);
}
if (task) {
@@ -1816,19 +1803,27 @@
}
LDAPDebug(LDAP_DEBUG_ANY, "%s: Finished indexing.\n",
inst->inst_name, 0, 0);
-
-out:
+ return_value = 0; /* success */
+err_out:
+ backentry_free( &ep ); /* if ep or *ep is NULL, it does nothing */
if (idl) {
idl_free(idl);
} else {
dbc->c_close(dbc);
}
- dblayer_release_id2entry( be, db );
-
+ if (return_value < 0) {/* error case: undo vlv indexing */
+ /* if jumped to out due to an error, vlv lock has not been released */
+ for ( vlvidx = 0; vlvidx < numvlv; vlvidx++ ) {
+ vlvIndex_go_offline(pvlv[vlvidx], be);
+ vlv_acquire_lock(be);
+ vlvIndex_delete(&pvlv[vlvidx]);
+ vlv_release_lock(be);
+ }
+ }
+err_min:
+ dblayer_release_id2entry( be, db ); /* nope */
instance_set_not_busy(inst);
- LDAPDebug( LDAP_DEBUG_TRACE, "<= ldbm_back_ldbm2index\n", 0, 0, 0 );
-
if (run_from_cmdline) {
if (0 != dblayer_flush(li)) {
LDAPDebug(LDAP_DEBUG_ANY,
@@ -1844,8 +1839,13 @@
if (indexAttrs) {
slapi_ch_free((void **)&indexAttrs);
}
+ if (pvlv) {
+ slapi_ch_free((void **)&pvlv);
+ }
+
+ LDAPDebug( LDAP_DEBUG_TRACE, "<= ldbm_back_ldbm2index\n", 0, 0, 0 );
- return (ret);
+ return return_value;
}
/*
@@ -1887,7 +1887,7 @@
attr_index_config(be, "from db2index()", 0, argc, nsslapd_index_value, 0);
for ( i=0; i<argc; i++ ) {
- slapi_ch_free((void **)&nsslapd_index_value[i]);
+ slapi_ch_free_string(&nsslapd_index_value[i]);
}
return(0);
}
Index: vlv_srch.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/vlv_srch.c,v
retrieving revision 1.6
retrieving revision 1.6.2.1
diff -u -r1.6 -r1.6.2.1
--- vlv_srch.c 19 Apr 2005 22:07:38 -0000 1.6
+++ vlv_srch.c 11 Jan 2008 00:44:38 -0000 1.6.2.1
@@ -564,6 +564,8 @@
}
ldap_free_sort_keylist((*ppvs)->vlv_sortkey);
attrinfo_delete(&((*ppvs)->vlv_attrinfo));
+ slapi_ch_free((void**)&((*ppvs)->vlv_name));
+ slapi_ch_free((void**)&((*ppvs)->vlv_filename));
slapi_ch_free((void**)&((*ppvs)->vlv_mrpb));
slapi_ch_free((void**)&((*ppvs)->vlv_syntax_plugin));
PR_DestroyLock((*ppvs)->vlv_indexlength_lock);
16 years, 3 months
[Fedora-directory-commits] ldapserver/ldap/servers/slapd/back-ldbm proto-back-ldbm.h, 1.5, 1.5.2.1 idl.c, 1.4, 1.4.2.1 sort.c, 1.5.2.1, 1.5.2.2 vlv.c, 1.6.2.1, 1.6.2.2
by Doctor Conrad
Author: nhosoi
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv14329/servers/slapd/back-ldbm
Modified Files:
Tag: Directory71RtmBranch
proto-back-ldbm.h idl.c sort.c vlv.c
Log Message:
Resolves: #183222
Summary: Directory Server hangs when running VLV search and update operations
Description: applied the patch to Directory71RtmBranch
Index: proto-back-ldbm.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -u -r1.5 -r1.5.2.1
--- proto-back-ldbm.h 19 Apr 2005 22:07:38 -0000 1.5
+++ proto-back-ldbm.h 10 Jan 2008 19:44:21 -0000 1.5.2.1
@@ -213,6 +213,15 @@
int idl_is_allids(IDList *idl);
int idl_append( IDList *idl, ID id);
void idl_insert(IDList **idl, ID id);
+/*
+ * idl_delete - delete an id from an id list.
+ * returns 0 id deleted
+ * 1 id deleted, first id in block has changed
+ * 2 id deleted, block is empty
+ * 3 id not there
+ * 4 cannot delete from allids block
+ */
+int idl_delete( IDList **idl, ID id );
IDList * idl_allids( backend *be );
IDList * idl_fetch( backend *be, DB* db, DBT *key, DB_TXN *txn, struct attrinfo *a, int *err );
int idl_insert_key( backend *be, DB* db, DBT *key, ID id, DB_TXN *txn, struct attrinfo *a,int *disposition );
Index: idl.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/idl.c,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -u -r1.4 -r1.4.2.1
--- idl.c 19 Apr 2005 22:07:38 -0000 1.4
+++ idl.c 10 Jan 2008 19:44:21 -0000 1.4.2.1
@@ -44,7 +44,6 @@
*/
#undef IDL_LOCKING_ENABLE
-static int idl_delete( IDList **idl, ID id ) ;
static void make_cont_key( DBT *contkey, DBT *key, ID id );
static int idl_insert_maxids( IDList **idl, ID id, int maxids );
@@ -1591,7 +1590,7 @@
* 4 cannot delete from allids block
*/
-static int
+int
idl_delete( IDList **idl, ID id )
{
ID i, delpos;
Index: sort.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/sort.c,v
retrieving revision 1.5.2.1
retrieving revision 1.5.2.2
diff -u -r1.5.2.1 -r1.5.2.2
--- sort.c 2 Mar 2006 01:12:31 -0000 1.5.2.1
+++ sort.c 10 Jan 2008 19:44:21 -0000 1.5.2.2
@@ -677,7 +677,7 @@
a = id2entry(be,*id_a,NULL,&err);
if (NULL == a) {
if (0 != err ) {
- LDAPDebug(LDAP_DEBUG_ANY,"compare_entries db err %d\n",err,0,0);
+ LDAPDebug(LDAP_DEBUG_TRACE,"compare_entries db err %d\n",err,0,0);
}
/* Were up a creek without paddle here */
/* Best to log error and set some flag */
@@ -686,7 +686,7 @@
b = id2entry(be,*id_b,NULL,&err);
if (NULL == b) {
if (0 != err ) {
- LDAPDebug(LDAP_DEBUG_ANY,"compare_entries db err %d\n",err,0,0);
+ LDAPDebug(LDAP_DEBUG_TRACE,"compare_entries db err %d\n",err,0,0);
}
return 0;
}
Index: vlv.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/vlv.c,v
retrieving revision 1.6.2.1
retrieving revision 1.6.2.2
diff -u -r1.6.2.1 -r1.6.2.2
--- vlv.c 14 Mar 2007 16:25:34 -0000 1.6.2.1
+++ vlv.c 10 Jan 2008 19:44:21 -0000 1.6.2.2
@@ -54,7 +54,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;
@@ -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);
@@ -81,24 +82,25 @@
/* Callback to add a new VLV Index specification. Added write lock.*/
int vlv_AddIndexEntry(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* entryAfter, int *returncode, char *returntext, void *arg)
-{
- struct vlvSearch *parent;
- backend *be= ((ldbm_instance*)arg)->inst_be;
- Slapi_DN parentdn;
-
- slapi_sdn_init(&parentdn);
- slapi_sdn_get_parent(slapi_entry_get_sdn(entryBefore),&parentdn);
+{
+ struct vlvSearch *parent;
+ backend *be= ((ldbm_instance*)arg)->inst_be;
+ Slapi_DN parentdn;
+
+ slapi_sdn_init(&parentdn);
+ slapi_sdn_get_parent(slapi_entry_get_sdn(entryBefore),&parentdn);
{
- PR_RWLock_Wlock(be->vlvSearchList_lock);
+ /* vlvSearchList is modified; need Wlock */
+ PR_RWLock_Wlock(be->vlvSearchList_lock);
parent= vlvSearch_finddn((struct vlvSearch *)be->vlvSearchList, &parentdn);
if(parent!=NULL)
{
struct vlvIndex* newVlvIndex= vlvIndex_new();
- newVlvIndex->vlv_be=be;
+ newVlvIndex->vlv_be=be;
vlvIndex_init(newVlvIndex, be, parent, entryBefore);
- vlvSearch_addIndex(parent, newVlvIndex);
+ vlvSearch_addIndex(parent, newVlvIndex);
}
- PR_RWLock_Unlock(be->vlvSearchList_lock);
+ PR_RWLock_Unlock(be->vlvSearchList_lock);
}
slapi_sdn_done(&parentdn);
return SLAPI_DSE_CALLBACK_OK;
@@ -111,6 +113,7 @@
struct vlvSearch* p=NULL;
backend *be= ((ldbm_instance*)arg)->inst_be;
+ /* 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)
@@ -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,7 +766,7 @@
*
* 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
@@ -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)
{
@@ -1059,15 +1063,16 @@
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;
}
@@ -1087,7 +1092,7 @@
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;
@@ -1102,6 +1107,9 @@
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);
@@ -1109,9 +1117,20 @@
/* 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 */
@@ -1120,11 +1139,6 @@
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) {
@@ -1454,9 +1468,17 @@
typedown_value= vlv_create_matching_rule_value(sort_control->mr_pb,(struct berval *)&vlv_request_control->value);
compare_fn= slapi_berval_cmp;
}
+retry:
/*
* Perform a binary search over the candidate list
*/
+ if (0 == candidates->b_nids) { /* idlist is empty */
+ LDAPDebug( LDAP_DEBUG_ANY, "vlv_trim_candidates_byvalue: Candidate ID List is empty.\n", 0, 0, 0 );
+ ber_bvecfree((struct berval**)typedown_value);
+ return candidates->b_nids; /* not found */
+ }
+ low= 0;
+ high= candidates->b_nids-1;
do {
int err= 0;
struct backentry *e= NULL;
@@ -1472,7 +1494,15 @@
e = id2entry( be, id, NULL, &err );
if ( e == NULL )
{
+ int rval;
LDAPDebug( LDAP_DEBUG_ANY, "vlv_trim_candidates_byvalue: Candidate ID %lu not found err=%d\n", (u_long)id, err, 0 );
+ rval = idl_delete(&candidates, id);
+ if (0 == rval || 1 == rval || 2 == rval) {
+ goto retry;
+ } else {
+ ber_bvecfree((struct berval**)typedown_value);
+ return candidates->b_nids; /* not found */
+ }
}
else
{
@@ -1820,8 +1850,8 @@
IDList *idl;
Slapi_Filter *vlv_f;
- PR_RWLock_Rlock(be->vlvSearchList_lock);
slapi_sdn_init_dn_byref(&base_sdn, base);
+ PR_RWLock_Rlock(be->vlvSearchList_lock);
for (t = (struct vlvSearch *)be->vlvSearchList; t; t = t->vlv_next) {
/* all vlv "filters" start with (|(xxx)(objectclass=referral)).
* we only care about the (xxx) part.
@@ -1847,9 +1877,10 @@
}
if (dblayer_get_index_file(be, vi->vlv_attrinfo, &db, 0) == 0) {
+ length = vlvIndex_get_indexlength(vi, db, 0 /* txn */);
+ PR_RWLock_Unlock(be->vlvSearchList_lock);
err = db->cursor(db, 0 /* txn */, &dbc, 0);
if (err == 0) {
- length = vlvIndex_get_indexlength(vi, db, 0 /* txn */);
if (length == 0) /* 609377: index size could be 0 */
{
LDAPDebug(LDAP_DEBUG_TRACE, "vlv: index %s is empty\n",
@@ -1864,12 +1895,10 @@
}
dblayer_release_index_file(be, vi->vlv_attrinfo, db);
if (err == 0) {
- PR_RWLock_Unlock(be->vlvSearchList_lock);
return idl;
} else {
LDAPDebug(LDAP_DEBUG_ANY, "vlv find index: err %d\n",
err, 0, 0);
- PR_RWLock_Unlock(be->vlvSearchList_lock);
return NULL;
}
}
@@ -1927,6 +1956,7 @@
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)
16 years, 3 months
[Fedora-directory-commits] console/src/com/netscape/management/client/util IndexDialog.java, 1.1.1.1, 1.2
by Doctor Conrad
Author: rmeggins
Update of /cvs/dirsec/console/src/com/netscape/management/client/util
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv5629/console/src/com/netscape/management/client/util
Modified Files:
IndexDialog.java
Log Message:
Resolves: bug 428226
Description: Review Request: idm-console-framework: Core console package used by Fedora Directory Server and other IDM projects
Fix Description: bump version to 1.1.1
Added LICENSE to %doc in spec file
Fix some minor problems to allow compilation with the IcedTea Java
Index: IndexDialog.java
===================================================================
RCS file: /cvs/dirsec/console/src/com/netscape/management/client/util/IndexDialog.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- IndexDialog.java 18 Jul 2005 00:34:26 -0000 1.1.1.1
+++ IndexDialog.java 10 Jan 2008 18:35:38 -0000 1.2
@@ -21,20 +21,19 @@
package com.netscape.management.client.util;
import java.awt.*;
-import java.awt.event.*;
-import java.io.*;
import java.util.*;
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.StringReader;
import java.net.*;
import java.text.*;
import java.beans.*;
import javax.swing.*;
import javax.swing.event.*;
-import javax.swing.border.*;
-import javax.swing.text.*;
import javax.swing.text.html.*;
import com.netscape.management.client.console.*;
import com.netscape.management.client.components.*;
-import com.netscape.management.client.comm.*;
/**
* Dialog to select a topic to display, from a list of URLS organized
16 years, 3 months
[Fedora-directory-commits] console/src/com/netscape/management/client/topology DomainNode.java, 1.1.1.1, 1.2 TopTopologyNode.java, 1.1.1.1, 1.2
by Doctor Conrad
Author: rmeggins
Update of /cvs/dirsec/console/src/com/netscape/management/client/topology
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv5629/console/src/com/netscape/management/client/topology
Modified Files:
DomainNode.java TopTopologyNode.java
Log Message:
Resolves: bug 428226
Description: Review Request: idm-console-framework: Core console package used by Fedora Directory Server and other IDM projects
Fix Description: bump version to 1.1.1
Added LICENSE to %doc in spec file
Fix some minor problems to allow compilation with the IcedTea Java
Index: DomainNode.java
===================================================================
RCS file: /cvs/dirsec/console/src/com/netscape/management/client/topology/DomainNode.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- DomainNode.java 18 Jul 2005 00:34:18 -0000 1.1.1.1
+++ DomainNode.java 10 Jan 2008 18:35:36 -0000 1.2
@@ -20,13 +20,10 @@
package com.netscape.management.client.topology;
import java.util.*;
-import java.net.*;
-import java.io.*;
-import java.awt.*;
-import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.tree.*;
+import java.awt.Component;
import java.text.MessageFormat;
import com.netscape.management.client.*;
import com.netscape.management.client.util.*;
Index: TopTopologyNode.java
===================================================================
RCS file: /cvs/dirsec/console/src/com/netscape/management/client/topology/TopTopologyNode.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- TopTopologyNode.java 18 Jul 2005 00:34:19 -0000 1.1.1.1
+++ TopTopologyNode.java 10 Jan 2008 18:35:36 -0000 1.2
@@ -20,7 +20,6 @@
package com.netscape.management.client.topology;
import java.util.*;
-import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.tree.*;
@@ -42,7 +41,7 @@
}
/**
- * initialize the top toplogy node
+ * initialize the top topology node
*/
public void reload() {
super.reload();
16 years, 3 months
[Fedora-directory-commits] console build.properties, 1.14, 1.15 idm-console-framework.spec, 1.3, 1.4
by Doctor Conrad
Author: rmeggins
Update of /cvs/dirsec/console
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv5629/console
Modified Files:
build.properties idm-console-framework.spec
Log Message:
Resolves: bug 428226
Description: Review Request: idm-console-framework: Core console package used by Fedora Directory Server and other IDM projects
Fix Description: bump version to 1.1.1
Added LICENSE to %doc in spec file
Fix some minor problems to allow compilation with the IcedTea Java
Index: build.properties
===================================================================
RCS file: /cvs/dirsec/console/build.properties,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- build.properties 1 Aug 2007 21:29:55 -0000 1.14
+++ build.properties 10 Jan 2008 18:35:35 -0000 1.15
@@ -23,7 +23,7 @@
console.root=.
console.version=11
-console.dotversion=1.1.0
+console.dotversion=1.1.1
console.dotgenversion=1.1
mcc.core=idm-console-mcc
Index: idm-console-framework.spec
===================================================================
RCS file: /cvs/dirsec/console/idm-console-framework.spec,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- idm-console-framework.spec 19 Dec 2007 20:10:27 -0000 1.3
+++ idm-console-framework.spec 10 Jan 2008 18:35:35 -0000 1.4
@@ -1,13 +1,13 @@
%define major_version 1.1
-%define minor_version 0
+%define minor_version 1
Name: idm-console-framework
Version: %{major_version}.%{minor_version}
-Release: 2%{?dist}
+Release: 1%{?dist}
Summary: Identity Management Console Framework
Group: System Environment/Libraries
-License: LGPL
+License: LGPLv2
URL: http://directory.fedoraproject.org
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -15,9 +15,11 @@
Source: http://directory.fedoraproject.org/sources/%{name}-%{version}.tar.bz2
Requires: ldapjdk
Requires: jss
+BuildRequires: java-1.7.0-icedtea
BuildRequires: ant >= 1.6.2
BuildRequires: ldapjdk
BuildRequires: jss
+BuildRequires: java-1.7.0-icedtea-devel
%description
A Java Management Console framework used for remote server management.
@@ -55,6 +57,7 @@
%files
%defattr(-,root,root,-)
+%doc LICENSE
%{_javadir}/idm-console-base-%{version}.jar
%{_javadir}/idm-console-base-%{major_version}.jar
%{_javadir}/idm-console-base.jar
@@ -72,6 +75,12 @@
%{_javadir}/idm-console-nmclf_en.jar
%changelog
+* Wed Jan 9 2008 Rich Megginson <rmeggins(a)redhat.com> 1.1.1-1
+- fix rpmlint issues
+- changed license from LGPL to LGPLv2
+- added explicit requires for java-1.7.0-icedtea
+- added LICENSE for doc
+
* Wed Dec 19 2007 Rich Megginson <rmeggins(a)redhat.com> 1.1.0-2
- for the fedora ds 1.1 release
16 years, 3 months
[Fedora-directory-commits] console/src/com/netscape/management/client/security CertRequestWizard.java, 1.3, 1.4
by Doctor Conrad
Author: rmeggins
Update of /cvs/dirsec/console/src/com/netscape/management/client/security
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv5629/console/src/com/netscape/management/client/security
Modified Files:
CertRequestWizard.java
Log Message:
Resolves: bug 428226
Description: Review Request: idm-console-framework: Core console package used by Fedora Directory Server and other IDM projects
Fix Description: bump version to 1.1.1
Added LICENSE to %doc in spec file
Fix some minor problems to allow compilation with the IcedTea Java
Index: CertRequestWizard.java
===================================================================
RCS file: /cvs/dirsec/console/src/com/netscape/management/client/security/CertRequestWizard.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CertRequestWizard.java 8 Feb 2006 22:13:18 -0000 1.3
+++ CertRequestWizard.java 10 Jan 2008 18:35:36 -0000 1.4
@@ -25,7 +25,9 @@
import java.util.zip.*;
import java.util.jar.*;
import java.net.*;
-import java.io.*;
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.InputStream;
import javax.swing.*;
import javax.swing.event.*;
import com.netscape.management.client.console.*;
16 years, 3 months