Blame SOURCES/0069-Ticket-48311-nunc-stans-Attempt-to-release-connectio.patch

246821
From 68cdd9df5c923cca591dfe7d22207d7d31ef4928 Mon Sep 17 00:00:00 2001
246821
From: Mark Reynolds <mreynolds@redhat.com>
246821
Date: Fri, 23 Oct 2015 15:17:44 -0400
246821
Subject: [PATCH 69/75] Ticket 48311 - nunc-stans: Attempt to release
246821
 connection that   is not acquired
246821
246821
Bug Description:  ns_connection_post_io_or_closing() was not aquiring the
246821
                  connection in the optimized build, which led to the connection
246821
                  ref count getting out sequence.
246821
246821
Fix Description   Do not call connection_acquire_nolock() inside a PR_ASSERT call.
246821
246821
                  Also changed other PR_ASSERTs to only be called if DEBUG is set
246821
246821
https://fedorahosted.org/389/ticket/48311
246821
246821
Reviewed by: nhosoi(Thanks!)
246821
246821
(cherry picked from commit 97946bd212c5094a490d6a3429e0d5763ccd39ce)
246821
(cherry picked from commit a8d30b356f312b24132f4ced324a67601b7cfb9b)
246821
---
246821
 ldap/servers/slapd/daemon.c | 14 +++++++++++++-
246821
 1 file changed, 13 insertions(+), 1 deletion(-)
246821
246821
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
246821
index ba73da3..82099bc 100644
246821
--- a/ldap/servers/slapd/daemon.c
246821
+++ b/ldap/servers/slapd/daemon.c
246821
@@ -1836,7 +1836,11 @@ ns_handle_closure(struct ns_job_t *job)
246821
 	int do_yield = 0;
246821
 
246821
 	/* this function must be called from the event loop thread */
246821
+#ifdef DEBUG
246821
 	PR_ASSERT(0 == NS_JOB_IS_THREAD(ns_job_get_type(job)));
246821
+#else
246821
+	NS_JOB_IS_THREAD(ns_job_get_type(job));
246821
+#endif
246821
 	PR_Lock(c->c_mutex);
246821
 	connection_release_nolock_ext(c, 1); /* release ref acquired for event framework */
246821
 	PR_ASSERT(c->c_ns_close_jobs == 1); /* should be exactly 1 active close job - this one */
246821
@@ -1889,7 +1893,11 @@ ns_connection_post_io_or_closing(Connection *conn)
246821
 		/* process event normally - wait for I/O until idletimeout */
246821
 		tv.tv_sec = conn->c_idletimeout;
246821
 		tv.tv_usec = 0;
246821
-		PR_ASSERT(0 == connection_acquire_nolock(conn)); /* event framework now has a reference */
246821
+#ifdef DEBUG
246821
+		PR_ASSERT(0 == connection_acquire_nolock(conn));
246821
+#else
246821
+		connection_acquire_nolock(conn); /* event framework now has a reference */
246821
+#endif
246821
 		ns_add_io_timeout_job(conn->c_tp, conn->c_prfd, &tv,
246821
 				      NS_JOB_READ|NS_JOB_PRESERVE_FD,
246821
 				      ns_handle_pr_read_ready, conn, NULL);
246821
@@ -1911,7 +1919,11 @@ ns_handle_pr_read_ready(struct ns_job_t *job)
246821
 	Connection *c = (Connection *)ns_job_get_data(job);
246821
 
246821
 	/* this function must be called from the event loop thread */
246821
+#ifdef DEBUG
246821
 	PR_ASSERT(0 == NS_JOB_IS_THREAD(ns_job_get_type(job)));
246821
+#else
246821
+	NS_JOB_IS_THREAD(ns_job_get_type(job));
246821
+#endif
246821
 
246821
 	PR_Lock(c->c_mutex);
246821
 	LDAPDebug2Args(LDAP_DEBUG_CONNS, "activity on conn %" NSPRIu64 " for fd=%d\n",
246821
-- 
246821
2.4.3
246821