[sheepdog] [PATCH v2 1/3] sheep: make {register, unregister}_event thread safe

Liu Yuan namei.unix at gmail.com
Tue Dec 17 07:50:19 CET 2013


On Tue, Dec 17, 2013 at 03:42:29PM +0900, Hitoshi Mitake wrote:
> At Tue, 17 Dec 2013 14:31:56 +0800,
> Liu Yuan wrote:
> > 
> > This allow us to call even handling functions in worker thread
> > 
> > Signed-off-by: Liu Yuan <namei.unix at gmail.com>
> > ---
> 
> I think this change is dangerous. This permits worker threads to
> unregister events even if these events are processed in the main
> thread. Making a new work queue and delegate it to register/unregister
> events would be safer.

This scheme is not pratical for async request.

This is just internal API, which are supported to be called by programmers
and check it is correct.

Basically, this apis are not fully thread-safe. We assume that fd is only
manipulated by a single entity, e.g, request->local_req_fd will be only
interested by that request user, so register and unregister are only called
by one user.

What this patch does is to allow us to register/unregister the event in the
worker thread, not attemping to allow several users to manipulate the same
event.

Thanks
Yuan



More information about the sheepdog mailing list