Skip to content

Commit 4d572d9

Browse files
avikivityAl Viro
authored andcommitted
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 <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent 94aefd3 commit 4d572d9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/eventfd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,11 @@ static __poll_t eventfd_poll_mask(struct file *file, __poll_t eventmask)
156156
count = READ_ONCE(ctx->count);
157157

158158
if (count > 0)
159-
events |= EPOLLIN;
159+
events |= (EPOLLIN & eventmask);
160160
if (count == ULLONG_MAX)
161161
events |= EPOLLERR;
162162
if (ULLONG_MAX - 1 > count)
163-
events |= EPOLLOUT;
163+
events |= (EPOLLOUT & eventmask);
164164

165165
return events;
166166
}

0 commit comments

Comments
 (0)