Skip to content

Commit 2739b80

Browse files
Christoph HellwigAl Viro
authored andcommitted
aio: only return events requested in poll_mask() for IOCB_CMD_POLL
The ->poll_mask() operation has a mask of events that the caller is interested in, but not all implementations might take it into account. Mask the return value to only the requested events, similar to what the poll and epoll code does. Reported-by: Avi Kivity <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent 4d572d9 commit 2739b80

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/aio.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1661,7 +1661,7 @@ static int aio_poll_wake(struct wait_queue_entry *wait, unsigned mode, int sync,
16611661
if (mask && !(mask & req->events))
16621662
return 0;
16631663

1664-
mask = file->f_op->poll_mask(file, req->events);
1664+
mask = file->f_op->poll_mask(file, req->events) & req->events;
16651665
if (!mask)
16661666
return 0;
16671667

@@ -1719,7 +1719,7 @@ static ssize_t aio_poll(struct aio_kiocb *aiocb, struct iocb *iocb)
17191719

17201720
spin_lock_irq(&ctx->ctx_lock);
17211721
spin_lock(&req->head->lock);
1722-
mask = req->file->f_op->poll_mask(req->file, req->events);
1722+
mask = req->file->f_op->poll_mask(req->file, req->events) & req->events;
17231723
if (!mask) {
17241724
__add_wait_queue(req->head, &req->wait);
17251725
list_add_tail(&aiocb->ki_list, &ctx->active_reqs);

0 commit comments

Comments
 (0)