io_uring: fix manual setup of iov_iter for fixed buffers
Subsystems (2)
PATCH 1/1 io_uring: fix manual setup of iov_iter for fixed buffers
Commit bd11b3a391e3 ("io_uring: don't use iov_iter_advance() for fixed buffers") introduced an optimization to avoid using the slow iov_iter_advance by manually populating the iov_iter iterator in some cases.
However, the computation of the iterator count field was erroneous: The first bvec was always accounted for an extent of page size even if the bvec length was smaller.
In consequence, some I/O operations on fixed buffers were unable to operate on the full extent of the buffer, consistently skipping some bytes at the end of it.
--- fs/io_uring.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
fs/io_uring.c +1 -3
@@ -1097,10 +1097,8 @@ static int io_import_fixed(struct io_ring_ctx *ctx, int rw, iter->bvec = bvec + seg_skip; iter->nr_segs -= seg_skip; - iter->count -= (seg_skip <<PAGE_SHIFT ); + iter->count -= bvec->bv_len + offset; iter->iov_offset = offset & ~PAGE_MASK ; -if (iter->iov_offset) - iter->count -= iter->iov_offset; } }
Signature · 4 lines
2.12.0 http://bsc.es/disclaimer
Quoted 5 lines · Aleix Roca Nonell
Commit
bd11b3a391e3("io_uring: don't useiov_iter_advance()for fixed buffers") introduced an optimization to avoid using the slowiov_iter_advanceby manually populating theiov_iteriterator in some cases.
Quoted 7 lines
However, the computation of the iterator count field was erroneous: The first bvec was always accounted for an extent of page size even if the bvec length was smaller.
In consequence, some I/O operations on fixed buffers were unable to operate on the full extent of the buffer, consistently skipping some bytes at the end of it.
Applied, thanks.
Signature · 1 line
Jens Axboe