liburing icon indicating copy to clipboard operation
liburing copied to clipboard

Multishot recv cancel get different completion result depending on the kernel

Open ianic opened this issue 2 years ago • 3 comments

While building a test case for Zig io_uring implementation I noticed that I'm getting different results depending on the Linux kernel.

In the test there is active multishot recv operation. When I cancel that operation I got two completions, one for cancel operation cqe_cancel and another for multishot recv operation cqe_recv. According to documentation I expected that cqe_cancel has res = 0 (success) and cqe_recv has res = -124 (canceled). And that is what I get on kernel 6.5.

On older kernels 6.0, 6.1, 6.2, 6.4 I got for cqe_cancel res = -2 (noent) and cqe_recv res = -105 (nobufs).

I'm now handling both cases as successful cancel operation.

I understand that this is not liburing's behavior, and not an issue of liburing. But still can be something which can surprise some users.

ianic avatar Nov 10 '23 22:11 ianic

Interesting, don't immediately recall any changes there that would explain it between eg 6.4 and 6.5. The 6.5 behavior sounds correct, the older one definitely not. I'll take a look.

axboe avatar Nov 20 '23 20:11 axboe

Are you using stable kernels or the Linus releases?

axboe avatar Nov 20 '23 20:11 axboe

I test it on Ubuntu: Linux thinkpad 6.5.7-060507-generic #202310102154 SMP PREEMPT_DYNAMIC Tue Oct 10 22:00:30 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

by installing different kernels using ubuntu-mainline-kernel.sh And then running on the kernels: v6.0.17-060017 v6.1.57-060157 v6.2.12-060212 v6.3.13-060313 v6.4.16-060416 and the default one v6.5.7-060507.

Hope that helps.

ianic avatar Nov 20 '23 21:11 ianic