liburing
liburing copied to clipboard
Handle EINTR from io_uring_enter[2]
Per the io_uring_enter man page:
EINTR The operation was interrupted by a delivery of a signal before it could complete; see signal(7). Can happen while waiting for events with IORING_ENTER_GETEVENTS.
I've had this occur when testing ublk and have PRs to ublksrv, but I was wondering if this is something liburing could handle.
- https://github.com/ublk-org/ublksrv/pull/79
- https://github.com/ublk-org/ublksrv/pull/104
__io_uring_submit could handle this with a small do while:
do {
ret = __sys_io_uring_enter(ring->enter_ring_fd, submitted,
wait_nr, flags, NULL);
} while (ret == -EINTR);
Actually there are a few places which call __sys_io_uring_enter or __sys_io_uring_enter2, so maybe it makes more sense to add the do-while loop to __sys_io_uring_enter2 itself
ublksrv etc should just use DEFER_TASKRUN here and avoid this in the first place, imho.