mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 21:08:36 +00:00
io_uring: don't assume completions order (2)
In my first [try](https://github.com/ziglang/zig/pull/20224) to fix 20212 I didn't reproduce bug on required kernel (6.9.2) and wrongly concluded that first two completions have different order on newer kernel. On my current kernel (6.5.0) order of completions is: send1, recv, send2. On 6.9.2 order is send1, send2, recv. This fix allows second two completions to arrive in any order. Tested on both kernels. Fixes: #20212
This commit is contained in:
parent
e03026507f
commit
b8890f8ee1
@ -3524,12 +3524,7 @@ test "accept/connect/send_zc/recv" {
|
||||
_ = try ring.recv(0xffffffff, socket_test_harness.server, .{ .buffer = buffer_recv[0..] }, 0);
|
||||
try testing.expectEqual(@as(u32, 2), try ring.submit());
|
||||
|
||||
var cqe_send, const cqe_recv = brk: {
|
||||
const cqe1 = try ring.copy_cqe();
|
||||
const cqe2 = try ring.copy_cqe();
|
||||
break :brk if (cqe1.user_data == 0xeeeeeeee) .{ cqe1, cqe2 } else .{ cqe2, cqe1 };
|
||||
};
|
||||
|
||||
var cqe_send = try ring.copy_cqe();
|
||||
// First completion of zero-copy send.
|
||||
// IORING_CQE_F_MORE, means that there
|
||||
// will be a second completion event / notification for the
|
||||
@ -3541,6 +3536,12 @@ test "accept/connect/send_zc/recv" {
|
||||
.flags = linux.IORING_CQE_F_MORE,
|
||||
}, cqe_send);
|
||||
|
||||
cqe_send, const cqe_recv = brk: {
|
||||
const cqe1 = try ring.copy_cqe();
|
||||
const cqe2 = try ring.copy_cqe();
|
||||
break :brk if (cqe1.user_data == 0xeeeeeeee) .{ cqe1, cqe2 } else .{ cqe2, cqe1 };
|
||||
};
|
||||
|
||||
try testing.expectEqual(linux.io_uring_cqe{
|
||||
.user_data = 0xffffffff,
|
||||
.res = buffer_recv.len,
|
||||
@ -3550,7 +3551,6 @@ test "accept/connect/send_zc/recv" {
|
||||
|
||||
// Second completion of zero-copy send.
|
||||
// IORING_CQE_F_NOTIF in flags signals that kernel is done with send_buffer
|
||||
cqe_send = try ring.copy_cqe();
|
||||
try testing.expectEqual(linux.io_uring_cqe{
|
||||
.user_data = 0xeeeeeeee,
|
||||
.res = 0,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user