From 0451280ae2a22bc85004b54b0e2f111a13cfedf6 Mon Sep 17 00:00:00 2001
From: Quanah Gibson-Mount <quanah@openldap.org>
Date: Thu, 15 Apr 2010 20:21:40 +0000
Subject: [PATCH] ITS#6484

---
 CHANGES                         |  1 +
 servers/slapd/overlays/pcache.c | 15 +++++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/CHANGES b/CHANGES
index da0d9ed813..1341ec7b91 100644
--- a/CHANGES
+++ b/CHANGES
@@ -13,6 +13,7 @@ OpenLDAP 2.4.22 Engineering
 	Fixed slapd-bdb contextCSN updates from updatedn (ITS#6469)
 	Fixed slapo-collect REP_ENTRY flag handling (ITS#5340,ITS#6423)
 	Fixed slapo-dynlist REP_ENTRY flag handling (ITS#5340,ITS#6423)
+	Fixed slapo-pcache to release its own entries (ITS#6484)
 	Fixed slapo-rwm olcRwmMap handling (ITS#6436)
 	Fixed slapo-rwm REP_ENTRY flag handling (ITS#5340,ITS#6423)
 	Fixed slapo-syncprov memory leak (ITS#6459)
diff --git a/servers/slapd/overlays/pcache.c b/servers/slapd/overlays/pcache.c
index 74229c06a2..699954357f 100644
--- a/servers/slapd/overlays/pcache.c
+++ b/servers/slapd/overlays/pcache.c
@@ -5219,6 +5219,20 @@ pcache_op_extended( Operation *op, SlapReply *rs )
 	return SLAP_CB_CONTINUE;
 }
 
+static int
+pcache_entry_release( Operation  *op, Entry *e, int rw )
+{
+	slap_overinst	*on = (slap_overinst *)op->o_bd->bd_info;
+	cache_manager	*cm = on->on_bi.bi_private;
+	BackendDB *db = op->o_bd;
+	int rc;
+
+	op->o_bd = &cm->db;
+	rc = be_entry_release_rw( op, e, rw );
+	op->o_bd = db;
+	return rc;
+}
+
 #ifdef PCACHE_MONITOR
 
 static int
@@ -5605,6 +5619,7 @@ pcache_initialize()
 #endif /* PCACHE_CONTROL_PRIVDB */
 	pcache.on_bi.bi_extended = pcache_op_extended;
 
+	pcache.on_bi.bi_entry_release_rw = pcache_entry_release;
 	pcache.on_bi.bi_chk_controls = pcache_chk_controls;
 
 	pcache.on_bi.bi_cf_ocs = pcocs;
-- 
GitLab