[PATCH] Fix epoll backend to allow separate read/write events on one fd.
jra at samba.org
Wed Feb 13 13:59:08 MST 2013
On Wed, Feb 13, 2013 at 09:40:53PM +0100, Stefan (metze) Metzmacher wrote:
> Hi Jeremy,
> > The tevent epoll backend has a bug in that it does
> > not allow separate read/write events to be added
> > using the same file descriptor.
> This is a known problem and it's reason why we use dup() in
But not all our internal uses do that. I agree, we should
and that would be preferable.
> I'd preferr that we don't allow more than one event handler per fd
> in general. A socket should be only used by one logical caller
> everything else is a bug.
> The tdgram_context and tstream_context abstractions only need one tevent_fd.
That's a nice comment, but unfortunately the current Samba
code depends on this behavior, so until you want to patch
*that* code instead of tevent, and document the restriction
in tevent then we need something to make it work :-).
Note we'd have to make this a hard restriction of tevent
to ensure we don't get dependencies creeping back in later.
> At least we should allow only one TEVENT_FD_READ handler and only one
> TEVENT_FD_WRITE handler
> for each fd.
That is what the patch does (read it, it isn't too bad :-).
> But I'd think it's better to avoid additional complexity in
> the epoll backend,
> which is already complex.
Personally I don't think the change is so bad (that's why
I wrote it :-). It allows exactly one reader, one writer
on an fd, and hides the multiplexing inside only the
functions that deal with manipulating the fde's. It's
split into a set of small patches that should be pretty
easy to review individually (all IMHO of course :-).
More information about the samba-technical