EXPERIMENTAL: tevent_kqueue support

Stefan (metze) Metzmacher metze at samba.org
Fri Mar 1 12:13:31 MST 2013


Hi Jeremy,

>> my code is in this branch
>>
>> https://gitweb.samba.org/?p=metze/samba/wip.git;a=shortlog;h=refs/heads/master3-tevent2
>> with some more unfinished patches in
>> https://gitweb.samba.org/?p=metze/samba/wip.git;a=shortlog;h=refs/heads/master4-tevent2
>>
>> Please review them, but don't push them yet.
>>
>> I found some more bugs in the poll backend
>> and want to write some more tests and review myself again
>> (even if commit already have my review, I squashed some changes)

Ok, found a few more things.

My attempt for EBADF was wrong, instead of returning an error in epoll
and poll
we should ignore this and disable the event. Some tests
fail without this (samba3.base.negnowait) because
it can happen because smbXcli_conn_disconnect() closes
the sockets, but doesn't free the tevent_fd structure before,
which is hidden in writev_send/recv and read_smb_send/recv.
With epoll the kernel removes the registered event on close,
for poll we have to disable the event when we get POLLNVAL.

Then I added ENOENT handling to EPOLL_CTL_DEL,
which made it possible to pass autobuild with temporary
disabled poll fallback.

The second problem I added an optimization to
tevent_common_add_timer() and noticed much later that
source3/lib/events.c also uses it but without calling
tevent_common_loop_timer_delay(). Because of this
ev->last_zero_timer wasn't updated after running a timer event.

Because released versions of Samba (4.0.0 - 4.0.3) could end up
building against a system libtevent, but source3/lib/events.c
used lib/tevent/tevent_internal.h, it's not possible to
add this new behavior to tevent_common_add_timer(),
that's why I added tevent_common_add_timer_v2() for usage
in the select, poll and epoll backends. I also added
last_zero_timer as the last element of struct tevent_context
in order to avoid problems, when source3/lib/events.c may
use the wrong definition of struct tevent_context.

The final goal should be to avoid source3/lib/events.c,
the remaining blocker is nmbd. I started some patches
to convert more nmbd code to tevent, but it needs more work.
The patches are in this branch.
https://gitweb.samba.org/?p=metze/samba/wip.git;a=shortlog;h=refs/heads/master4-tevent2

The patches which just need review are under
https://gitweb.samba.org/?p=metze/samba/wip.git;a=shortlog;h=refs/heads/master3-tevent2
I'm currently do autobuilds to see if it is stable now.
Also with the following hacks on top:
(without epoll)
https://gitweb.samba.org/?p=metze/samba/wip.git;a=commitdiff;h=a0f5077d0f28be42b97421cdea1219aee08aac71
(without poll fallback)
https://gitweb.samba.org/?p=metze/samba/wip.git;a=commitdiff;h=7a74e6f9bffab04a24a90a2dc2e5d84a8960827a
(and with random fallback)
https://gitweb.samba.org/?p=metze/samba/wip.git;a=commitdiff;h=6dc95cd2d4ea5a10566e8ea43d6aa9ac46b1590f

Similar patches already passed autobuilds in all 4 combinations.

I've now reviewed the master3-tevent branch
(commit 83ce1f9d9504156ea1b8e2a4f5655a48b5bcd1f1),
please review and push.

@Amitay: The following commit I told you about
https://gitweb.samba.org/?p=metze/samba/wip.git;a=commitdiff;h=435154d29dbb8ff5a27250650f00c27d4c7aabf2
is replaced by
https://gitweb.samba.org/?p=metze/samba/wip.git;a=commitdiff;h=b6e2886168b4033474d3821947ac41c2d9e2d698
and
https://gitweb.samba.org/?p=metze/samba/wip.git;a=commitdiff;h=1ff186062de976472991d0eb254455c33cd2ce25

metze

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20130301/fb60ff63/attachment.pgp>


More information about the samba-technical mailing list