[SCM] Samba Shared Repository - branch master
updated - release-4-0-0alpha7-557-gd380c49
Stefan (metze) Metzmacher
metze at samba.org
Fri Mar 20 09:14:19 GMT 2009
Hi Tridge,
> > > fixed a logic bug in the tevent nesting code
> > >
> > > The event nesting code never triggered as nesting.level was never
> > > greater than 1. The main event loop needs to increase the nesting
> > > level by 1.
> >
> > That was desired, why do you want to be called if there's no nesting?
> > you do if (unixuid_nesting_level == 0) return; anyway.
>
> The code as it was previously would only call the hook if we had two
> levels of nesting. ie. it would call it when we had this:
>
> - main loop
> - call to event_loop_once
> - call to event_loop_once
> - calls hook
tevent_loop_wait() calls tevent_loop_once() internally,
see the tevent_common_loop_once() function.
so for samba it was:
level 1: tevent_loop_wait() (internally also tevent_loop_once())
level 2: tevent_loop_once() -> calling the hook with level == 2.
level 3: tevent_loop_once() -> callling the hook with level == 3.
...
for smbtorture it was:
level 1: tevent_loop_once()
level 2: tevent_loop_once() -> calling the hook with level == 2.
level 3: tevent_loop_once() -> calling the hook with level == 3.
Currently we call the hook for each level, but the above was my first
design. Now we have the question if we want to call the hook at
level > 1, or if we want to call it always and let the hook decide if it
makes level 1 a noop.
> It was just a simple off by 1 error, as the check was for > 1, which
> meant it only triggered when the nesting was 2 or greater. It started
> at zero.
>
> > If we change it to call the hook at level 0, we should change that in
> > tevent_loop_once() and not in tevent_loop_wait().
>
> no, because then we'll get the hook code called in top level code that
> calls event_loop_once, such as the smbtorture code.
>
> > > I also added a paranoia check to the nesting setup call. The API as
> > > currently written cannot support multiple nesting hooks, so we need to
> > > abort if multiple hooks are tried.
> >
> > I think we should have global in vfs_unixid.c which remembers that we
> > already set the hook and not reset it on each tree connect.
>
> The point of that paranoia check was not for the existing vfs code, it
> was for future uses of that API. The API is now a public part of
> tevent, and may be used by other libraries or modules. The first time
> we used a library like that we would have had silent corruption.
>
> It would be perfectly possible to re-do the implementation of this
> function so that it can cope with multiple pieces of code on the same
> event context that need a hook (we could have a linked list of
> hooks). By having this paranoia check we will know when we need to
> re-do the implementation when we first hit this situation.
I think we can keep it simple and let the application add a wrapper
that dispatches multiple hooks.
metze
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
Url : http://lists.samba.org/archive/samba-technical/attachments/20090320/1050d514/signature.bin
More information about the samba-technical
mailing list