Re: [patch] eventfd - revised interface and cleanups

Davide Libenzi
2009-06-23T17:57:44Z

On Tue, 23 Jun 2009, Gregory Haskins wrote:

> I think the lack of a way to got from a file* to a ctx* (or back) might
> be a problem. I am not an expert, but if I understood the gist of what
> Al Viro (cc'd) was saying early on, an fd can change meaning out from
> under you without warning.
>
> With the code the way it is now, I would need to call both
> eventfd_fget() and eventfd_ctx_fdget() to fully acquire state (unless I
> am missing something). I would think that is a race and I am not
> guaranteed to get the same object. Can we also have a way to convert
> one reference to the other? I am thinking
>
> struct eventfd_ctx *eventfd_ctx_fget(struct file *)
>
> (or similar) would be sufficient.

You're right. That function was available in the previous patch, but then
I dropped it because I thought the eventfd code could be simplified. But
yes, it's needed.

- Davide