liburing icon indicating copy to clipboard operation
liburing copied to clipboard

Handle EINTR from io_uring_enter[2]

Open mattysweeps opened this issue 9 months ago • 2 comments

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);

mattysweeps avatar Mar 05 '25 00:03 mattysweeps

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

mattysweeps avatar Mar 05 '25 00:03 mattysweeps

ublksrv etc should just use DEFER_TASKRUN here and avoid this in the first place, imho.

axboe avatar May 21 '25 15:05 axboe