Skip to content

Commit

Permalink
test/socket-io-cmd: don't use CQE after io_uring_cqe_seen()
Browse files Browse the repository at this point in the history
Doesn't matter here as there's only one SQE inflight and no more
CQEs will get generated before this one is done, but it's bad
practice. CQEs should always be fully read before they are marked
as seen.

Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
axboe committed Apr 19, 2024
1 parent 1cbd4cf commit f428169
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/socket-io-cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@ static int receive_cqe(struct io_uring *ring)
err = io_uring_wait_cqe(ring, &cqe);
assert(err == 0);
assert(cqe->user_data == USERDATA);
err = cqe->res;
io_uring_cqe_seen(ring, cqe);

/* Return the result of the operation */
return cqe->res;
return err;
}

static ssize_t send_data(struct fds *s, char *str)
Expand Down

0 comments on commit f428169

Please sign in to comment.