Re: [PATCH v2] io_uring: fix nr_segs calculation in io_import_kbuf

From: Jens Axboe
Date: Wed Dec 17 2025 - 09:48:50 EST



On Wed, 17 Dec 2025 14:26:32 +0800, huang-jl wrote:
> io_import_kbuf() calculates nr_segs incorrectly when iov_offset is
> non-zero after iov_iter_advance(). It doesn't account for the partial
> consumption of the first bvec.
>
> The problem comes when meet the following conditions:
> 1. Use UBLK_F_AUTO_BUF_REG feature of ublk.
> 2. The kernel will help to register the buffer, into the io uring.
> 3. Later, the ublk server try to send IO request using the registered
> buffer in the io uring, to read/write to fuse-based filesystem, with
> O_DIRECT.
>
> [...]

Applied, thanks!

[1/1] io_uring: fix nr_segs calculation in io_import_kbuf
commit: 114ea9bbaf7681c4d363e13b7916e6fef6a4963a

Best regards,
--
Jens Axboe