Skip to contentSkip to conversation

io_uring: fail poll arm on queue proc failure

PATCH In review Jens Axboe 2 participants 3 messages Aug 11, 2020 – Aug 12, 2020

Subsystems (2)
lore
Share & tools
lore

Jens Axboe

author maintainer
#0 lore raw

PATCH 1/1 io_uring: fail poll arm on queue proc failure

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.

---

fs/io_uring.c +1 -1
index 99582cf5106b..8a2afd8c33c9 100644
@@ -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);
Signature · 1 line
Jens Axboe
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Jens Axboe

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.

LGTM:

Stefano

Quoted 19 lines

---

fs/io_uring.c +1 -1
index 99582cf5106b..8a2afd8c33c9 100644
@@ -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);
Signature · 1 line
Jens Axboe
author maintainer
#2 lore raw
Quoted 9 lines · Stefano Garzarella
Quoted 8 lines · Jens Axboe

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.

Quoted 6 lines
Quoted 3 lines

LGTM:

Thanks for the review, added.

Signature · 1 line
Jens Axboe