axboe / liburing

Library providing helpers for the Linux kernel io_uring support
MIT License
2.89k stars 407 forks source link

Weird result when doing multishot read on STDIN #1257

Closed noteflakes closed 1 month ago

noteflakes commented 1 month ago

This is related to #1185.

I'm setting up a buffer ring, then doing io_uring_prep_read_multishot on fd 0. When data is available, a CQE is received. The data is received correctly in the first available buffer in the buffer ring, however, cqe->flags is 0, and does not have IORING_CQE_F_BUFFER set, nor the buffer id in the upper word, even if it is non-zero.

I can detect the absence of IORING_CQE_F_MORE and switch automatically to reissuing single shot read ops, but the first read is cloberred because I have no way of knowing in which buffer it is.

I hope this is clear enough.

axboe commented 1 month ago

What kernel are you running?

axboe commented 1 month ago

Oh I see it, must be a recent(ish) kernel. I'll post the fix. If you want me to include you in the Reported-by: tag in the commit, please post what name and email you'd like me to use to properly attribute the bug report to you.

noteflakes commented 1 month ago

Sorry I'm on 6.8.0.

My name: Sharon Rosner email: sharon@noteflakes.com

Thanks!

axboe commented 1 month ago

Thanks! Commit is here:

https://git.kernel.dk/cgit/linux/commit/?h=io_uring-6.12&id=c9d952b9103b600ddafc5d1c0e2f2dbd30f0b805

and should go upstream within a week and then make its way back to the stable kernels. 6.8 doesn't have a current stable series, so might be worthwhile to update to 6.10-stable once the commit has been queued up for that series.