On 3/4/24 12:43 PM, Bart Van Assche wrote:
I'm also wondering why "ignore" is the right fix. The USB gadget driver sees that it has asynchronous I/O (kiocb::ki_complete != NULL) and then tries to set a cancellation function. What is the expected behavior when the I/O is owned by io_uring? Should it perhaps call into io_uring to set a cancellation function with io_uring? Or is the concept of cancellation functions indeed specific to legacy AIO, and nothing should be done with io_uring I/O?
As far as I know no Linux user space interface for submitting I/O supports cancellation of read or write requests other than the AIO io_cancel() system call.
Not true, see previous reply (on both points in this email). The kernel in general does not support cancelation of regular file/storage IO that has submitted. That includes aio. There are many reasons for this.
For anything but that, you can most certainly cancel inflight IO with io_uring, be it to a socket, pipe, whatever.
The problem here isn't that only aio supports cancelations, it's that the code to do so is a bad hack.