* [PATCH] io_uring: fail poll arm on queue proc failure
@ 2020-08-11 15:52 Jens Axboe
2020-08-12 8:39 ` Stefano Garzarella
0 siblings, 1 reply; 3+ messages in thread
From: Jens Axboe @ 2020-08-11 15:52 UTC (permalink / raw)
To: io-uring
Check the ipt.error value, it must have been either cleared to zero or
set to another error than the default -EINVAL if we don't go through the
waitqueue proc addition. Just give up on poll at that point and return
failure, this will fallback to async work.
io_poll_add() doesn't suffer from this failure case, as it returns the
error value directly.
Cc: [email protected] # v5.7+
Reported-by: [email protected]
Signed-off-by: Jens Axboe <[email protected]>
---
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 99582cf5106b..8a2afd8c33c9 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -4883,7 +4883,7 @@ static bool io_arm_poll_handler(struct io_kiocb *req)
ret = __io_arm_poll_handler(req, &apoll->poll, &ipt, mask,
io_async_wake);
- if (ret) {
+ if (ret || ipt.error) {
io_poll_remove_double(req, apoll->double_poll);
spin_unlock_irq(&ctx->completion_lock);
kfree(apoll->double_poll);
--
Jens Axboe
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] io_uring: fail poll arm on queue proc failure
2020-08-11 15:52 [PATCH] io_uring: fail poll arm on queue proc failure Jens Axboe
@ 2020-08-12 8:39 ` Stefano Garzarella
2020-08-12 14:30 ` Jens Axboe
0 siblings, 1 reply; 3+ messages in thread
From: Stefano Garzarella @ 2020-08-12 8:39 UTC (permalink / raw)
To: Jens Axboe; +Cc: io-uring
On Tue, Aug 11, 2020 at 09:52:55AM -0600, Jens Axboe wrote:
> Check the ipt.error value, it must have been either cleared to zero or
> set to another error than the default -EINVAL if we don't go through the
> waitqueue proc addition. Just give up on poll at that point and return
> failure, this will fallback to async work.
>
> io_poll_add() doesn't suffer from this failure case, as it returns the
> error value directly.
>
> Cc: [email protected] # v5.7+
> Reported-by: [email protected]
> Signed-off-by: Jens Axboe <[email protected]>
LGTM:
Reviewed-by: Stefano Garzarella <[email protected]>
Stefano
>
> ---
>
> diff --git a/fs/io_uring.c b/fs/io_uring.c
> index 99582cf5106b..8a2afd8c33c9 100644
> --- a/fs/io_uring.c
> +++ b/fs/io_uring.c
> @@ -4883,7 +4883,7 @@ static bool io_arm_poll_handler(struct io_kiocb *req)
>
> ret = __io_arm_poll_handler(req, &apoll->poll, &ipt, mask,
> io_async_wake);
> - if (ret) {
> + if (ret || ipt.error) {
> io_poll_remove_double(req, apoll->double_poll);
> spin_unlock_irq(&ctx->completion_lock);
> kfree(apoll->double_poll);
> --
> Jens Axboe
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] io_uring: fail poll arm on queue proc failure
2020-08-12 8:39 ` Stefano Garzarella
@ 2020-08-12 14:30 ` Jens Axboe
0 siblings, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2020-08-12 14:30 UTC (permalink / raw)
To: Stefano Garzarella; +Cc: io-uring
On 8/12/20 2:39 AM, Stefano Garzarella wrote:
> On Tue, Aug 11, 2020 at 09:52:55AM -0600, Jens Axboe wrote:
>> Check the ipt.error value, it must have been either cleared to zero or
>> set to another error than the default -EINVAL if we don't go through the
>> waitqueue proc addition. Just give up on poll at that point and return
>> failure, this will fallback to async work.
>>
>> io_poll_add() doesn't suffer from this failure case, as it returns the
>> error value directly.
>>
>> Cc: [email protected] # v5.7+
>> Reported-by: [email protected]
>> Signed-off-by: Jens Axboe <[email protected]>
>
> LGTM:
> Reviewed-by: Stefano Garzarella <[email protected]>
Thanks for the review, added.
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-08-12 14:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-11 15:52 [PATCH] io_uring: fail poll arm on queue proc failure Jens Axboe
2020-08-12 8:39 ` Stefano Garzarella
2020-08-12 14:30 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox