[389-commits] ldap/servers

Mark Reynolds mreynolds at fedoraproject.org
Fri Jun 13 20:28:18 UTC 2014


 ldap/servers/slapd/back-ldbm/seq.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

New commits:
commit 958b4edfd966e3871d2f10f721e314f9362ce4e3
Author: Mark Reynolds <mreynolds at redhat.com>
Date:   Fri Jun 13 13:48:50 2014 -0400

    Ticket 47602 - txn commit being performed too early
    
    Bug Description:  The transaction is committed too early, and this leads to
                      a deadlock when accessing the retro changelog.
    
    Fix Description:  Move the commit after we are done using the txn(id2entry, etc).
    
    https://fedorahosted.org/389/ticket/47602
    
    Reviewed by: nhosoi(Thanks!)

diff --git a/ldap/servers/slapd/back-ldbm/seq.c b/ldap/servers/slapd/back-ldbm/seq.c
index 29b3f6a..1874239 100644
--- a/ldap/servers/slapd/back-ldbm/seq.c
+++ b/ldap/servers/slapd/back-ldbm/seq.c
@@ -236,9 +236,6 @@ retry:
 		dbc->c_close(dbc);
 
 		if ((0 == return_value) || (DB_NOTFOUND == return_value)) {
-			if (txn.back_txn_txn) {
-				dblayer_read_txn_commit(be, &txn);
-			}
 			/* Now check that the key we eventually settled on was an equality key ! */
 			if (key.data && *((char*)key.data) == EQ_PREFIX) {
 				/* Retrieve the idlist for this key */
@@ -255,6 +252,7 @@ retry:
 							if ((key.data != little_buffer) && (key.data != &keystring)) {
 								slapi_ch_free(&(key.data));
 							}
+							dblayer_read_txn_abort(be, &txn);
 							goto retry;
 						} else {
 							continue;
@@ -321,6 +319,14 @@ retry:
 		}
 		idl_free( &idl );
 	}
+	/* if success finally commit the transaction, otherwise abort if DB_NOTFOUND */
+	if(txn.back_txn_txn){
+		if (return_value == 0) {
+			dblayer_read_txn_commit(be, &txn);
+		} else if (DB_NOTFOUND == return_value){
+			dblayer_read_txn_abort(be, &txn);
+		}
+	}
 
 	dblayer_release_index_file( be, ai, db );
 




More information about the 389-commits mailing list