The Samba-Bugzilla – Attachment 5287 Details for
Bug 7105
Make the blocking lock and brl lock database scale better in a cluster.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
git-am format patch #4 for 3.5.x.
0004-s3-events-make-the-old-timed-events-compatible-with-.patch (text/plain), 2.14 KB, created by
Jeremy Allison
on 2010-02-06 00:30:18 UTC
(
hide
)
Description:
git-am format patch #4 for 3.5.x.
Filename:
MIME Type:
Creator:
Jeremy Allison
Created:
2010-02-06 00:30:18 UTC
Size:
2.14 KB
patch
obsolete
>From 5dbf175c75bd6139f3238f36665000641f7f7f79 Mon Sep 17 00:00:00 2001 >From: Andrew Tridgell <tridge@samba.org> >Date: Fri, 5 Feb 2010 19:14:45 -0800 >Subject: [PATCH 4/4] s3-events: make the old timed events compatible with tevent > >tevent ensures that a timed event is only called once. The old events >code relied on the called handler removing the event itself. If the >handler removed the event after calling a function which invoked the >event loop then the timed event could loop forever. > >This change makes the two timed event systems more compatible, by >allowing the handler to free the te if it wants to, but ensuring it is >off the linked list of events before the handler is called, and >ensuring it is freed even if the handler doesn't free it. >--- > source3/lib/events.c | 21 +++++++++++++++++++-- > 1 files changed, 19 insertions(+), 2 deletions(-) > >diff --git a/source3/lib/events.c b/source3/lib/events.c >index 7a06ad0..75aa250 100644 >--- a/source3/lib/events.c >+++ b/source3/lib/events.c >@@ -105,12 +105,29 @@ bool run_events(struct tevent_context *ev, > > if ((ev->timer_events != NULL) > && (timeval_compare(&now, &ev->timer_events->next_event) >= 0)) { >+ /* this older events system did not auto-free timed >+ events on running them, and had a race condition >+ where the event could be called twice if the >+ talloc_free of the te happened after the callback >+ made a call which invoked the event loop. To avoid >+ this while still allowing old code which frees the >+ te, we need to create a temporary context which >+ will be used to ensure the te is freed. We also >+ remove the te from the timed event list before we >+ call the handler, to ensure we can't loop */ >+ >+ struct tevent_timer *te = ev->timer_events; >+ TALLOC_CTX *tmp_ctx = talloc_new(ev); > > DEBUG(10, ("Running timed event \"%s\" %p\n", > ev->timer_events->handler_name, ev->timer_events)); > >- ev->timer_events->handler(ev, ev->timer_events, now, >- ev->timer_events->private_data); >+ DLIST_REMOVE(ev->timer_events, te); >+ talloc_steal(tmp_ctx, te); >+ >+ te->handler(ev, te, now, te->private_data); >+ >+ talloc_free(tmp_ctx); > return true; > } > >-- >1.6.3.3 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 7105
:
5284
|
5285
|
5286
| 5287