]> git.sur5r.net Git - openldap/commitdiff
ITS#7904 writewait patch
authorHoward Chu <hyc@openldap.org>
Wed, 23 Jul 2014 20:06:23 +0000 (13:06 -0700)
committerHoward Chu <hyc@openldap.org>
Wed, 23 Jul 2014 20:12:51 +0000 (13:12 -0700)
Assigned ITS#, tweaking. This ITS includes
4f05d992f2146921dbc13d3477de9918f20172b9
716b35e191fb587b352922c76d65843449d870cb
be792fae2ccd4f39ee2b975bcc26a6e21dfc3586

servers/slapd/back-mdb/search.c

index a79871b74fc4aca899d162279bc472742be8eeee..c63db9c1640f89373f318f1f201471e582cda9d6 100644 (file)
@@ -690,12 +690,15 @@ dn2entry_retry:
                id = mdb_idl_first( candidates, &cursor );
        }
 
-       cb.sc_writewait = mdb_writewait;
-       cb.sc_private = &wwctx;
        wwctx.flag = 0;
-       wwctx.txn = ltid;
-       cb.sc_next = op->o_callback;
-       op->o_callback = &cb;
+       /* If we're running in our own read txn */
+       if (  moi == &opinfo ) {
+               cb.sc_writewait = mdb_writewait;
+               cb.sc_private = &wwctx;
+               wwctx.txn = ltid;
+               cb.sc_next = op->o_callback;
+               op->o_callback = &cb;
+       }
 
        while (id != NOID)
        {
@@ -1083,17 +1086,6 @@ loop_continue:
                        id = mdb_idl_next( candidates, &cursor );
                }
        }
-       /* remove our writewait callback */
-       {
-               slap_callback **scp = &op->o_callback;
-               while ( *scp ) {
-                       if ( *scp == &cb ) {
-                               *scp = cb.sc_next;
-                               cb.sc_private = NULL;
-                               break;
-                       }
-               }
-       }
 
 nochange:
        rs->sr_ctrls = NULL;