From e59610a64977946af99f8aae12ba45a5200e8b6e Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Sun, 22 Sep 2024 21:02:29 -0500 Subject: [PATCH] io_uring: handle INTR error from write It is possible to get an EINTR error from io_uring when copying cqes. xev already handles EINTR automatically when it occurs during io_uring_enter, but doesn't handle it if an individual cqe copy has this error. Automatically rearm the completion when the result is EINTR. --- src/backend/io_uring.zig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/backend/io_uring.zig b/src/backend/io_uring.zig index e9e2d02..8ec9c81 100644 --- a/src/backend/io_uring.zig +++ b/src/backend/io_uring.zig @@ -744,6 +744,8 @@ pub const Completion = struct { @intCast(res) else switch (@as(posix.E, @enumFromInt(-res))) { .CANCELED => error.Canceled, + // If a write is interrupted, we retry it automatically. + .INTR => return .rearm, else => |errno| posix.unexpectedErrno(errno), }, },