summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2021-02-11 23:08:15 +0000
committerJens Axboe <axboe@kernel.dk>2021-02-11 16:43:47 -0700
commit989d7cb34fe0661ef0ecf87dabc7e2d4423fbd60 (patch)
tree4f2ef9939b0961b4266a417effc4bdf18c06d1ce
parentc7143a4550cb904f858de1b2b829068d1d9a5581 (diff)
downloadliburing-989d7cb34fe0661ef0ecf87dabc7e2d4423fbd60.tar.gz
liburing-989d7cb34fe0661ef0ecf87dabc7e2d4423fbd60.tar.bz2
test/sq-poll-share: don't ignore wait errors
Check io_uring_wait_cqe() result, it's not safe to poke into cqe on error. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--test/sq-poll-share.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/test/sq-poll-share.c b/test/sq-poll-share.c
index 0f25389..02b008e 100644
--- a/test/sq-poll-share.c
+++ b/test/sq-poll-share.c
@@ -60,7 +60,14 @@ static int wait_io(struct io_uring *ring, int nr_ios)
struct io_uring_cqe *cqe;
while (nr_ios) {
- io_uring_wait_cqe(ring, &cqe);
+ int ret = io_uring_wait_cqe(ring, &cqe);
+
+ if (ret == -EAGAIN) {
+ continue;
+ } else if (ret) {
+ fprintf(stderr, "io_uring_wait_cqe failed %i\n", ret);
+ return 1;
+ }
if (cqe->res != BS) {
fprintf(stderr, "Unexpected ret %d\n", cqe->res);
return 1;