andykimpe / rpms / 389-ds-base

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