Blame SOURCES/0067-Ticket-48192-Individual-abandoned-simple-paged-resul.patch

a2f18f
From 6b1aeee584c74c47abf8f7190d4783c061607279 Mon Sep 17 00:00:00 2001
a2f18f
From: Noriko Hosoi <nhosoi@redhat.com>
a2f18f
Date: Thu, 1 Oct 2015 15:11:24 -0700
a2f18f
Subject: [PATCH 67/68] Ticket #48192 - Individual abandoned simple paged
a2f18f
 results request has no chance to be cleaned up
a2f18f
a2f18f
Description: If CONN_FLAG_PAGEDRESULTS_ABANDONED is set to pr_flags,
a2f18f
the search results in the pagedresults handle is supposed to have been
a2f18f
cleaned up.  But when there is a contention, there is a case that it
a2f18f
is reset with the already released search results.  This patch adds an
a2f18f
additional check for abandoned flag in pagedresults_set_search_result.
a2f18f
If the pagedresults handle shows it is abandoned, the search results
a2f18f
is not set to the handle unless it is for cleaning up with NULL.
a2f18f
a2f18f
https://fedorahosted.org/389/ticket/48192
a2f18f
a2f18f
Reviewed by rmeggins@redhat.com (Thanks, Rich!!)
a2f18f
a2f18f
(cherry picked from commit 6e453918e82af6c597390aebf92a8eb3283c3591)
a2f18f
(cherry picked from commit 96b9b6794e0a6bfa0d74c84f6c80131c4f820fa7)
a2f18f
---
a2f18f
 ldap/servers/slapd/pagedresults.c | 8 ++++++--
a2f18f
 1 file changed, 6 insertions(+), 2 deletions(-)
a2f18f
a2f18f
diff --git a/ldap/servers/slapd/pagedresults.c b/ldap/servers/slapd/pagedresults.c
a2f18f
index 6dd6432..87447c4 100644
a2f18f
--- a/ldap/servers/slapd/pagedresults.c
a2f18f
+++ b/ldap/servers/slapd/pagedresults.c
a2f18f
@@ -337,7 +337,7 @@ pagedresults_free_one_msgid_nolock( Connection *conn, ber_int_t msgid )
a2f18f
             for (i = 0; i < conn->c_pagedresults.prl_maxlen; i++) {
a2f18f
                 if (conn->c_pagedresults.prl_list[i].pr_msgid == msgid) {
a2f18f
                     PagedResults *prp = conn->c_pagedresults.prl_list + i;
a2f18f
-                    if (prp && prp->pr_current_be &&
a2f18f
+                    if (prp->pr_current_be &&
a2f18f
                         prp->pr_current_be->be_search_results_release &&
a2f18f
                         prp->pr_search_result_set) {
a2f18f
                         prp->pr_current_be->be_search_results_release(&(prp->pr_search_result_set));
a2f18f
@@ -429,7 +429,11 @@ pagedresults_set_search_result(Connection *conn, Operation *op, void *sr,
a2f18f
     if (conn && (index > -1)) {
a2f18f
         if (!locked) PR_Lock(conn->c_mutex);
a2f18f
         if (index < conn->c_pagedresults.prl_maxlen) {
a2f18f
-            conn->c_pagedresults.prl_list[index].pr_search_result_set = sr;
a2f18f
+            PagedResults *prp = conn->c_pagedresults.prl_list + index;
a2f18f
+            if (!(prp->pr_flags & CONN_FLAG_PAGEDRESULTS_ABANDONED) || !sr) {
a2f18f
+                /* If abandoned, don't set the search result unless it is NULL */
a2f18f
+                prp->pr_search_result_set = sr;
a2f18f
+            }
a2f18f
             rc = 0;
a2f18f
         }
a2f18f
         if (!locked) PR_Unlock(conn->c_mutex);
a2f18f
-- 
a2f18f
1.9.3
a2f18f