Move cache_return_entry_w() out of ldbm_back_add when the add is successful.
This change breaks back-bdb2, it needs equvalent changes of those in back-ldbm.
}
if ( (*be->be_add)( be, conn, op, e ) == 0 ) {
replog( be, LDAP_REQ_ADD, e->e_dn, e, 0 );
+ be_entry_release_w( be, e );
}
} else {
XSRCS = version.c
-SRCS = idl.c add.c search.c cache.c dbcache.c dn2id.c id2entry.c \
+SRCS = idl.c add.c search.c cache.c dbcache.c dn2id.c entry.c id2entry.c \
index.c id2children.c nextid.c abandon.c compare.c group.c \
modify.c modrdn.c delete.c init.c config.c bind.c attr.c \
filterindex.c unbind.c kerberos.c close.c alias.c
-OBJS = idl.o add.o search.o cache.o dbcache.o dn2id.o id2entry.o \
+OBJS = idl.o add.o search.o cache.o dbcache.o dn2id.o entry.o id2entry.o \
index.o id2children.o nextid.o abandon.o compare.o group.o \
modify.o modrdn.o delete.o init.o config.o bind.o attr.o \
filterindex.o unbind.o kerberos.o close.o alias.o
ldap_pvt_thread_mutex_unlock(&li->li_root_mutex);
}
- /* free entry and writer lock */
- cache_return_entry_w( &li->li_cache, e );
+ if ( rc ) {
+ /* free entry and writer lock */
+ cache_return_entry_w( &li->li_cache, e );
+ }
return( rc );
}
bi->bi_op_delete = ldbm_back_delete;
bi->bi_op_abandon = ldbm_back_abandon;
+ bi->bi_entry_release_rw = ldbm_back_entry_release_rw;
#ifdef SLAPD_ACLGROUPS
bi->bi_acl_group = ldbm_back_group;
#endif
#define dn2entry_r(be, dn, m) dn2entry_rw((be), (dn), (m), 0)
#define dn2entry_w(be, dn, m) dn2entry_rw((be), (dn), (m), 1)
+/*
+ * entry.c
+ */
+int ldbm_back_entry_release_rw LDAP_P(( Backend *be, Entry *e, int rw ));
+
/*
* filterindex.c
*/
return result == 0;
}
+int
+be_entry_release_rw( Backend *be, Entry *e, int rw )
+{
+ int rc;
+
+ if ( be->be_release ) {
+ /* free and release entry from backend */
+ return be->be_release( be, e, rw );
+ } else {
+ /* free entry */
+ entry_free( e );
+ return 0;
+ }
+}
+
int
backend_unbind(
Connection *conn,
int be_isroot LDAP_P(( Backend *be, char *ndn ));
int be_isroot_pw LDAP_P(( Backend *be, char *ndn, struct berval *cred ));
char* be_root_dn LDAP_P(( Backend *be ));
+int be_entry_release_rw LDAP_P(( Backend *be, Entry *e, int rw ));
+#define be_entry_release_r( be, e ) be_entry_release_rw( be, e, 0 )
+#define be_entry_release_w( be, e ) be_entry_release_rw( be, e, 1 )
+
extern int backend_unbind LDAP_P((Connection *conn, Operation *op));
#define be_modrdn bd_info->bi_op_modrdn
#define be_search bd_info->bi_op_search
+#define be_release bd_info->bi_entry_release_rw
#define be_group bd_info->bi_acl_group
/* these should be renamed from be_ to bd_ */
int msgid));
/* Auxilary Functions */
+ int (*bi_entry_release_rw) LDAP_P((BackendDB *bd, Entry *e, int rw));
#ifdef SLAPD_ACLGROUPS
int (*bi_acl_group) LDAP_P((Backend *bd,
Entry *e, char *bdn, char *edn,