Skip to contentSkip to conversation

io-cancel: add check for -ECANCELED

PATCH In review Hao Xu 2 participants 4 messages Oct 19, 2021 – Oct 29, 2021 io_uring

lore
Share & tools
lore

Hao Xu

author
#0 lore raw

PATCH 1/1 io-cancel: add check for -ECANCELED

The req to be async cancelled will most likely return -ECANCELED after cancellation with the new async bybrid optimization applied. And -EINTR is impossible to be returned anymore since we won't be in INTERRUPTABLE sleep when reading, so remove it.

---
 test/io-cancel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
test/io-cancel.c +1 -1
index b5b443dc467b..c761e126be0c 100644
@@ -341,7 +341,7 @@ static int test_cancel_req_across_fork(void)
 				fprintf(stderr, "wait_cqe=%d\n", ret);
 				return 1;
 			}
-			if ((cqe->user_data == 1 && cqe->res != -EINTR) ||
+			if ((cqe->user_data == 1 && cqe->res != -ECANCELED) ||
 			    (cqe->user_data == 2 && cqe->res != -EALREADY && cqe->res)) {
 				fprintf(stderr, "%i %i\n", (int)cqe->user_data, cqe->res);
 				exit(1);
Signature · 1 line
2.24.4
author
#1 lore raw

ping this one since test/io-cancel will be broken
if the async hybrid logic merges to 5.16

Quoted 24 lines · Hao Xu

The req to be async cancelled will most likely return -ECANCELED after cancellation with the new async bybrid optimization applied. And -EINTR is impossible to be returned anymore since we won't be in INTERRUPTABLE sleep when reading, so remove it.

---
  test/io-cancel.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
test/io-cancel.c +1 -1
index b5b443dc467b..c761e126be0c 100644
@@ -341,7 +341,7 @@ static int test_cancel_req_across_fork(void)
  				fprintf(stderr, "wait_cqe=%d\n", ret);
  				return 1;
  			}
-			if ((cqe->user_data == 1 && cqe->res != -EINTR) ||
+			if ((cqe->user_data == 1 && cqe->res != -ECANCELED) ||
  			    (cqe->user_data == 2 && cqe->res != -EALREADY && cqe->res)) {
  				fprintf(stderr, "%i %i\n", (int)cqe->user_data, cqe->res);
  				exit(1);
#2 lore raw
Quoted 13 lines · Hao Xu

ping this one since test/io-cancel will be broken
if the async hybrid logic merges to 5.16

Quoted 10 lines · Hao Xu

The req to be async cancelled will most likely return -ECANCELED after cancellation with the new async bybrid optimization applied. And -EINTR is impossible to be returned anymore since we won't be in INTERRUPTABLE sleep when reading, so remove it.

---
  test/io-cancel.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 10 lines

test/io-cancel.c static int test_cancel_req_across_fork(void) · line 344

Quoted 10 lines
test/io-cancel.c +1 -1
index b5b443dc467b..c761e126be0c 100644
@@ -341,7 +341,7 @@ static int test_cancel_req_across_fork(void)
                   fprintf(stderr, "wait_cqe=%d\n", ret);
                   return 1;
               }
-            if ((cqe->user_data == 1 && cqe->res != -EINTR) ||
+            if ((cqe->user_data == 1 && cqe->res != -ECANCELED) ||

cqe->res != -ECANCELED && cqe->res != -EINTR?

First backward compatibility, and in case internals or the test changes.

Quoted 5 lines
Quoted 4 lines
test/io-cancel.c +0 -0
                   (cqe->user_data == 2 && cqe->res != -EALREADY && cqe->res)) {
                   fprintf(stderr, "%i %i\n", (int)cqe->user_data, cqe->res);
                   exit(1);
Signature · 1 line
Pavel Begunkov
author
#3 lore raw
Quoted 27 lines · Pavel Begunkov
Quoted 13 lines · Hao Xu

ping this one since test/io-cancel will be broken
if the async hybrid logic merges to 5.16

Quoted 10 lines · Hao Xu

The req to be async cancelled will most likely return -ECANCELED after cancellation with the new async bybrid optimization applied. And -EINTR is impossible to be returned anymore since we won't be in INTERRUPTABLE sleep when reading, so remove it.

---
  test/io-cancel.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 10 lines

test/io-cancel.c static int test_cancel_req_across_fork(void) · line 344

Quoted 10 lines
test/io-cancel.c +1 -1
index b5b443dc467b..c761e126be0c 100644
@@ -341,7 +341,7 @@ static int test_cancel_req_across_fork(void)
                   fprintf(stderr, "wait_cqe=%d\n", ret);
                   return 1;
               }
-            if ((cqe->user_data == 1 && cqe->res != -EINTR) ||
+            if ((cqe->user_data == 1 && cqe->res != -ECANCELED) ||

cqe->res != -ECANCELED && cqe->res != -EINTR?

Quoted 2 lines

First backward compatibility, and in case internals or the test changes.

Ah, I see. Thanks Pavel.

Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
test/io-cancel.c +0 -0
                   (cqe->user_data == 2 && cqe->res != -EALREADY && cqe->res)) {
                   fprintf(stderr, "%i %i\n", (int)cqe->user_data, cqe->res);
                   exit(1);