man/io_uring_get_sqe.3: add note about SQE -> CQE user_data passing

Anyone reaping a request completion and expecting the cqe->user_data
field to be valid, MUST have ensured to set it before submitting the
SQE. If one of the sqe_set_data() helpers aren't called for this,
calling any of the cqe_get_data() helpers will return uninitialized
data as it was never set.

Link: https://github.com/axboe/liburing/issues/690
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Jens Axboe
2022-10-19 18:18:57 -07:00
parent f49874e782
commit ec6ced48bf
+15 -1
View File
@@ -32,10 +32,24 @@ prep functions such as
and submitted via
.BR io_uring_submit (3).
Note that the prep functions don't set the
.B user_data
field of the SQE, that is left to the caller. If the caller expects
.BR io_uring_cqe_get_data (3)
or
.BR io_uring_cqe_get_data64 (3)
to return valid data when reaping IO completions, either
.BR io_uring_sqe_set_data (3)
or
.BR io_uring_sqe_set_data64 (3)
.B MUST
have been called submitting the request.
.SH RETURN VALUE
.BR io_uring_get_sqe (3)
returns a pointer to the next submission queue event on success and NULL on
failure. If NULL is returned, the SQ ring is currently full and entries must
be submitted for processing before new ones can get allocated.
.SH SEE ALSO
.BR io_uring_submit (3)
.BR io_uring_submit (3),
.BR io_uring_sqe_set_data (3)