forked from Minki/linux
eventfd: only return events requested in poll_mask()
The ->poll_mask() operation has a mask of events that the caller is interested in, but we're returning all events regardless. Change to return only the events the caller is interested in. This fixes aio IO_CMD_POLL returning immediately when called with POLLIN on an eventfd, since an eventfd is almost always ready for a write. Signed-off-by: Avi Kivity <avi@scylladb.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
94aefd32f4
commit
4d572d9f46
@ -156,11 +156,11 @@ static __poll_t eventfd_poll_mask(struct file *file, __poll_t eventmask)
|
|||||||
count = READ_ONCE(ctx->count);
|
count = READ_ONCE(ctx->count);
|
||||||
|
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
events |= EPOLLIN;
|
events |= (EPOLLIN & eventmask);
|
||||||
if (count == ULLONG_MAX)
|
if (count == ULLONG_MAX)
|
||||||
events |= EPOLLERR;
|
events |= EPOLLERR;
|
||||||
if (ULLONG_MAX - 1 > count)
|
if (ULLONG_MAX - 1 > count)
|
||||||
events |= EPOLLOUT;
|
events |= (EPOLLOUT & eventmask);
|
||||||
|
|
||||||
return events;
|
return events;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user