Skip to content

Commit

Permalink
io_uring: fix manual setup of iov_iter for fixed buffers
Browse files Browse the repository at this point in the history
Commit bd11b3a ("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.

Fixes: bd11b3a ("io_uring: don't use iov_iter_advance() for fixed buffers")
Cc: [email protected]
Signed-off-by: Aleix Roca Nonell <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
aleixrocks authored and axboe committed Aug 15, 2019
1 parent ae78ca3 commit 99c79f6
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions fs/io_uring.c
Original file line number Diff line number Diff line change
@@ -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;
}
}

0 comments on commit 99c79f6

Please sign in to comment.