From: Kurt Zeilenga Date: Tue, 12 Sep 2000 21:16:03 +0000 (+0000) Subject: Catch nextid failures. X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~2040 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f7ba5a68c4a0babfa283ab41a2265f0b4c63636b;p=openldap Catch nextid failures. --- diff --git a/servers/slapd/back-ldbm/add.c b/servers/slapd/back-ldbm/add.c index 1577c74bed..1b36200c88 100644 --- a/servers/slapd/back-ldbm/add.c +++ b/servers/slapd/back-ldbm/add.c @@ -191,6 +191,26 @@ ldbm_back_add( e->e_id = next_id( be ); + if( e->e_id == NOID ) { + if( p != NULL) { + /* free parent and writer lock */ + cache_return_entry_w( &li->li_cache, p ); + } + + if ( rootlock ) { + /* release root lock */ + ldap_pvt_thread_mutex_unlock(&li->li_root_mutex); + } + + Debug( LDAP_DEBUG_ANY, "ldbm_add: next_id failed\n", + 0, 0, 0 ); + + send_ldap_result( conn, op, LDAP_OTHER, + NULL, "next_id add failed", NULL, NULL ); + + return( -1 ); + } + /* * Try to add the entry to the cache, assign it a new dnid. */ diff --git a/servers/slapd/back-ldbm/nextid.c b/servers/slapd/back-ldbm/nextid.c index c92cbaab78..2ea984a852 100644 --- a/servers/slapd/back-ldbm/nextid.c +++ b/servers/slapd/back-ldbm/nextid.c @@ -123,5 +123,4 @@ next_id( Backend *be ) ldap_pvt_thread_mutex_unlock( &li->li_nextid_mutex ); return id; - }