]> git.sur5r.net Git - openldap/commitdiff
More for ITS#3188
authorHoward Chu <hyc@openldap.org>
Wed, 16 Jun 2004 03:29:02 +0000 (03:29 +0000)
committerHoward Chu <hyc@openldap.org>
Wed, 16 Jun 2004 03:29:02 +0000 (03:29 +0000)
servers/slapd/back-bdb/cache.c
servers/slapd/back-bdb/delete.c
servers/slapd/back-bdb/modrdn.c

index ab8a71feea1a7bce826bbbe5e519a6815c38c9f5..6002a9b83d94c87d935f6c1d9c7d496315d94ec2 100644 (file)
@@ -794,7 +794,7 @@ bdb_cache_modify(
        DB_LOCK *lock )
 {
        EntryInfo *ei = BEI(e);
-       int rc = 0;     
+       int rc;
        /* Get write lock on data */
        rc = bdb_cache_entry_db_relock( env, locker, ei, 1, 0, lock );
 
@@ -825,10 +825,11 @@ bdb_cache_modrdn(
 {
        EntryInfo *ei = BEI(e), *pei;
        struct berval rdn;
-       int rc = 0;
+       int rc;
 
        /* 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 ( rc ) return rc;
 
        /* If we've done repeated mods on a cached entry, then e_attrs
         * is no longer contiguous with the entry, and must be freed.
@@ -911,7 +912,13 @@ bdb_cache_delete(
        bdb_cache_entryinfo_lock( ei );
 
        /* Get write lock on the 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 ( rc ) {
+               /* couldn't lock, undo and give up */
+               ei->bei_state ^= CACHE_ENTRY_DELETED;
+               bdb_cache_entryinfo_unlock( ei );
+               return rc;
+       }
 
        /* set cache write lock */
        ldap_pvt_thread_rdwr_wlock( &cache->c_rwlock );
index 84758b89f858cbbab08a8e468ac94c7818d859e8..cdd614bb4c8d578026aadbcb331b196a0ab00d0e 100644 (file)
@@ -545,8 +545,13 @@ retry:     /* transaction retry */
                        goto return_results;
                }
        } else {
-               bdb_cache_delete( &bdb->bi_cache, e, bdb->bi_dbenv,
+               rc = bdb_cache_delete( &bdb->bi_cache, e, 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 ) {
index ed817dedb8072cbb008e94ab40458543b115928a..749f6571deefbf33906fd52d3e7475a4218ae1e9 100644 (file)
@@ -1017,8 +1017,13 @@ retry:   /* transaction retry */
                }
 
        } else {
-               bdb_cache_modrdn( save, &op->orr_nnewrdn, e, neip,
+               rc = bdb_cache_modrdn( save, &op->orr_nnewrdn, e, neip,
                        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 ) {