]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
io_uring/kbuf: support min length left for incremental buffers
authorMartin Michaelis <code@mgjm.de>
Thu, 23 Apr 2026 21:54:11 +0000 (15:54 -0600)
committerJens Axboe <axboe@kernel.dk>
Tue, 28 Apr 2026 22:08:56 +0000 (16:08 -0600)
commit7deba791ad495ce1d7921683f4f7d1190fa210d1
tree3261cbdee3b24de2f267dd1814c2491343206760
parent55ea968389172306341a6600a2acb759862d366a
io_uring/kbuf: support min length left for incremental buffers

Incrementally consumed buffer rings are generally fully consumed, but
it's quite possible that the application has a minimum size it needs to
meet to avoid truncation. Currently that minimum limit is 1 byte, but
this should be a setting that is the hands of the application. For
recvmsg multishot, a prime use case for incrementally consumed buffers,
the application may get spurious -EFAULT returned at the end of an
incrementally consumed buffer, as less space is available than the
headers need.

Grab a u32 field in struct io_uring_buf_reg, which the application can
use to inform the kernel of the minimum size that should be available
in an incrementally consumed buffer. If less than that is available,
the current buffer is fully processed and the next one will be picked.

Cc: stable@vger.kernel.org
Fixes: ae98dbf43d75 ("io_uring/kbuf: add support for incremental buffer consumption")
Link: https://github.com/axboe/liburing/issues/1433
Signed-off-by: Martin Michaelis <code@mgjm.de>
[axboe: write commit message, change io_buffer_list member name]
Reviewed-by: Gabriel Krisman Bertazi <krisman@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
include/uapi/linux/io_uring.h
io_uring/kbuf.c
io_uring/kbuf.h