io_uring: change arm poll return values
The rules for __io_arm_poll_handler()'s result parsing are complicated, as the first step don't pass return a mask but pass back a positive return code and fill ipt->result_mask. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/529e29e9f97f2e6e383ccd44234d8b576a83a921.1655990418.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
5204aa8c43
commit
063a007996
|
@ -34,6 +34,8 @@ struct io_poll_table {
|
||||||
struct io_kiocb *req;
|
struct io_kiocb *req;
|
||||||
int nr_entries;
|
int nr_entries;
|
||||||
int error;
|
int error;
|
||||||
|
/* output value, set only if arm poll returns >0 */
|
||||||
|
__poll_t result_mask;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define IO_POLL_CANCEL_FLAG BIT(31)
|
#define IO_POLL_CANCEL_FLAG BIT(31)
|
||||||
|
@ -462,8 +464,9 @@ static int __io_arm_poll_handler(struct io_kiocb *req,
|
||||||
if (mask &&
|
if (mask &&
|
||||||
((poll->events & (EPOLLET|EPOLLONESHOT)) == (EPOLLET|EPOLLONESHOT))) {
|
((poll->events & (EPOLLET|EPOLLONESHOT)) == (EPOLLET|EPOLLONESHOT))) {
|
||||||
io_poll_remove_entries(req);
|
io_poll_remove_entries(req);
|
||||||
|
ipt->result_mask = mask;
|
||||||
/* no one else has access to the req, forget about the ref */
|
/* no one else has access to the req, forget about the ref */
|
||||||
return mask;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mask && unlikely(ipt->error || !ipt->nr_entries)) {
|
if (!mask && unlikely(ipt->error || !ipt->nr_entries)) {
|
||||||
|
@ -813,7 +816,7 @@ int io_poll_add(struct io_kiocb *req, unsigned int issue_flags)
|
||||||
|
|
||||||
ret = __io_arm_poll_handler(req, poll, &ipt, poll->events);
|
ret = __io_arm_poll_handler(req, poll, &ipt, poll->events);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
io_req_set_res(req, ret, 0);
|
io_req_set_res(req, ipt.result_mask, 0);
|
||||||
return IOU_OK;
|
return IOU_OK;
|
||||||
}
|
}
|
||||||
if (ipt.error) {
|
if (ipt.error) {
|
||||||
|
|
Loading…
Reference in New Issue