From: Kurt Zeilenga Date: Tue, 15 Jun 2004 21:13:40 +0000 (+0000) Subject: Partial fix for ITS#3188. X-Git-Tag: OPENDLAP_REL_ENG_2_2_MP~270 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7537d3d843e693cf0c0bf52af98ec968524ac058;p=openldap Partial fix for ITS#3188. As Howard noted, additional fixes may be needed in other update routines. --- diff --git a/servers/slapd/back-bdb/cache.c b/servers/slapd/back-bdb/cache.c index e1fcc9812e..ab8a71feea 100644 --- a/servers/slapd/back-bdb/cache.c +++ b/servers/slapd/back-bdb/cache.c @@ -794,19 +794,20 @@ bdb_cache_modify( DB_LOCK *lock ) { EntryInfo *ei = BEI(e); - + int rc = 0; /* Get write lock on data */ - bdb_cache_entry_db_relock( env, locker, ei, 1, 0, lock ); + rc = bdb_cache_entry_db_relock( env, locker, ei, 1, 0, lock ); /* If we've done repeated mods on a cached entry, then e_attrs * is no longer contiguous with the entry, and must be freed. */ - if ( (void *)e->e_attrs != (void *)(e+1) ) { - attrs_free( e->e_attrs ); + if ( ! rc ) { + if ( (void *)e->e_attrs != (void *)(e+1) ) { + attrs_free( e->e_attrs ); + } + e->e_attrs = newAttrs; } - e->e_attrs = newAttrs; - - return 0; + return rc; } /* diff --git a/servers/slapd/back-bdb/modify.c b/servers/slapd/back-bdb/modify.c index bc3e7ab48c..c8d65d789f 100644 --- a/servers/slapd/back-bdb/modify.c +++ b/servers/slapd/back-bdb/modify.c @@ -659,7 +659,12 @@ retry: /* transaction retry */ goto return_results; } } else { - bdb_cache_modify( e, dummy.e_attrs, bdb->bi_dbenv, locker, &lock ); + rc = bdb_cache_modify( e, dummy.e_attrs, bdb->bi_dbenv, locker, &lock ); + switch( rc ) { + case DB_LOCK_DEADLOCK: + case DB_LOCK_NOTGRANTED: + goto retry; + } if ( LDAP_STAILQ_EMPTY( &op->o_bd->be_syncinfo )) { if ( ctxcsn_added ) {