public inbox for [email protected]
 help / color / mirror / Atom feed
* IOSQE_BUFFER_SELECT buffer returned even in case of failure?
@ 2021-06-09 19:19 Olivier Langlois
  2021-06-10 18:42 ` Olivier Langlois
  0 siblings, 1 reply; 2+ messages in thread
From: Olivier Langlois @ 2021-06-09 19:19 UTC (permalink / raw)
  To: io-uring

the man page says the following:

    If succesful, the resulting CQE will have IORING_CQE_F_BUFFER set
in the flags part of the struct, and the upper IORING_CQE_BUFFER_SHIFT
bits will contain the ID of the selected buffers.

based on my understanding of the kernel code (it could wrong. testing
is still ongoing to be 100% sure), the buffer will be returned even if
the underlying syscall fails. (I have only checked io_read() for
IORING_OP_READ).

At the minimum, the man page should be clarified to better reflect the
code behavior. (and there is a missing 's' in succesful)

ideally, imho, I believe the code should be modified to do what the man
page says because:

1. doing otherwise is counter-intuitive and error-prone (I cannot think
of a single example of a syscall failing and still require the user to
free the allocated resources)

2. it is inefficient because the buffer is unneeded since there is no
data to transfer back to the user and the buffer will need to be
returned back to io_uring to avoid a leak.

Greetings,
Olivier



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-10 18:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-09 19:19 IOSQE_BUFFER_SELECT buffer returned even in case of failure? Olivier Langlois
2021-06-10 18:42 ` Olivier Langlois

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox