Blame SOURCES/0076-Ticket-48338-SimplePagedResults-abandon-could-happen.patch

246821
From 62d2b0026e895448b9dff76f2565012340afdfcd Mon Sep 17 00:00:00 2001
246821
From: Noriko Hosoi <nhosoi@redhat.com>
246821
Date: Wed, 18 Nov 2015 11:44:35 -0800
246821
Subject: [PATCH] Ticket #48338 - SimplePagedResults -- abandon could happen
246821
 between the abandon check and sending results
246821
246821
Description: commit 390b8bd9076e8976facc0858e60985d6b4fac05c introduced
246821
a self deadlock (see also bz1282607: 389-ds-base-1.2.11.15-67.el6_7 hang)
246821
246821
First phase of the following approach:
246821
  Fix design by Ludwig Krispenz and Rich Megginson (Thanks!)
246821
  Investigate the connection params used in the pblock access one by one and.
246821
  - for fields not used, either remove the access or just leave it as is
246821
  - With a big ASSERT to flag cases if the field is ever used, and a plan to
246821
    deprecate and remove the field.
246821
  - for fields with atomic access, like c_isreplication_session remove the mutex
246821
  - for filelds requiring copying, define them directly in the pblock and when
246821
    the pblock is created, populate them from the connection, the pblock access
246821
    would no longer need the c_mutex.
246821
Removing PR_Lock(c_mutex) from slapi_pblock_get(SLAPI_CONN_CLIENTNETADDR) since
246821
acquiring the lock is not necessary for the atomic reads.  This change solves
246821
the self deadlock.
246821
246821
https://fedorahosted.org/389/ticket/48338#comment:11
246821
246821
Reviewed by nkinder@redhat.com and mreynolds@redhat.com (Thank you, Nathan and Mark!)
246821
246821
(cherry picked from commit 79ca67d1fc5d50d8a9ae6b686b9564f3960f8592)
246821
(cherry picked from commit 36245abd78f7abfed8219a5ac4a4cf50c1c0237c)
246821
---
246821
 ldap/servers/slapd/pblock.c | 6 ++----
246821
 1 file changed, 2 insertions(+), 4 deletions(-)
246821
246821
diff --git a/ldap/servers/slapd/pblock.c b/ldap/servers/slapd/pblock.c
246821
index bf57a33..f2017be 100644
246821
--- a/ldap/servers/slapd/pblock.c
246821
+++ b/ldap/servers/slapd/pblock.c
246821
@@ -223,14 +223,12 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
246821
 			memset( value, 0, sizeof( PRNetAddr ));
246821
 			break;
246821
 		}
246821
-		PR_Lock( pblock->pb_conn->c_mutex );
246821
+		/* For fields with atomic access, remove the PR_Lock(c_mutex) */
246821
 		if ( pblock->pb_conn->cin_addr == NULL ) {
246821
 			memset( value, 0, sizeof( PRNetAddr ));
246821
 		} else {
246821
-			(*(PRNetAddr *)value) =
246821
-			    *(pblock->pb_conn->cin_addr);
246821
+			(*(PRNetAddr *)value) = *(pblock->pb_conn->cin_addr);
246821
 		}
246821
-		PR_Unlock( pblock->pb_conn->c_mutex );
246821
 		break;
246821
 	case SLAPI_CONN_SERVERNETADDR:
246821
 		if (pblock->pb_conn == NULL)
246821
-- 
246821
2.4.3
246821