summaryrefslogtreecommitdiff
path: root/fs/io_uring.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2021-03-19 14:06:24 -0600
committerJens Axboe <axboe@kernel.dk>2021-04-11 17:41:59 -0600
commit464dca612bc6bceceafadfb4bf28f1a27ccc4632 (patch)
treeffe4350807f8f5fc6629da58e3d37e24e360ae39 /fs/io_uring.c
parent9532b99bd9ca3f8f2f17b38500a8901ac1e7baee (diff)
downloadlwn-464dca612bc6bceceafadfb4bf28f1a27ccc4632.tar.gz
lwn-464dca612bc6bceceafadfb4bf28f1a27ccc4632.zip
io_uring: mask in error/nval/hangup consistently for poll
Instead of masking these in as part of regular POLL_ADD prep, do it in io_init_poll_iocb(), and include NVAL as that's generally unmaskable, and RDHUP alongside the HUP that is already set. Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r--fs/io_uring.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index c791e4031fb2..5c000057a2ee 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -4977,7 +4977,9 @@ static void io_init_poll_iocb(struct io_poll_iocb *poll, __poll_t events,
poll->head = NULL;
poll->done = false;
poll->canceled = false;
- poll->events = events;
+#define IO_POLL_UNMASK (EPOLLERR|EPOLLHUP|EPOLLNVAL|EPOLLRDHUP)
+ /* mask in events that we always want/need */
+ poll->events = events | IO_POLL_UNMASK;
INIT_LIST_HEAD(&poll->wait.entry);
init_waitqueue_func_entry(&poll->wait, wake_func);
}
@@ -5339,8 +5341,7 @@ static int io_poll_add_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe
#ifdef __BIG_ENDIAN
events = swahw32(events);
#endif
- poll->events = demangle_poll(events) | EPOLLERR | EPOLLHUP |
- (events & EPOLLEXCLUSIVE);
+ poll->events = demangle_poll(events) | (events & EPOLLEXCLUSIVE);
return 0;
}