aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvi Kivity <avi@scylladb.com>2018-06-08 15:12:32 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2018-06-14 20:07:38 -0400
commit4d572d9f46507be8cfe326aa5bc3698babcbdfa7 (patch)
treedc24bf35b539ea641b700344820c84462751bfd7
parent94aefd32f431a2c15f9d2c5f8f19dece73a77b52 (diff)
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>
-rw-r--r--fs/eventfd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/eventfd.c b/fs/eventfd.c
index 61c9514da5e9..ceb1031f1cac 100644
--- a/fs/eventfd.c
+++ b/fs/eventfd.c
@@ -156,11 +156,11 @@ static __poll_t eventfd_poll_mask(struct file *file, __poll_t eventmask)
156 count = READ_ONCE(ctx->count); 156 count = READ_ONCE(ctx->count);
157 157
158 if (count > 0) 158 if (count > 0)
159 events |= EPOLLIN; 159 events |= (EPOLLIN & eventmask);
160 if (count == ULLONG_MAX) 160 if (count == ULLONG_MAX)
161 events |= EPOLLERR; 161 events |= EPOLLERR;
162 if (ULLONG_MAX - 1 > count) 162 if (ULLONG_MAX - 1 > count)
163 events |= EPOLLOUT; 163 events |= (EPOLLOUT & eventmask);
164 164
165 return events; 165 return events;
166} 166}