Skip to content

Commit fa8f70e

Browse files
committed
linux/uio: remove "skip" offset for UIO_ITER
For UIO_ITER, we are just wrapping a kernel iterator. It will take care of its own offsets if necessary. We don't need to do anything, and if we do try to do anything with it (like advancing the iterator by the skip in zfs_uio_advance) we're just confusing the kernel iterator, ending up at the wrong position or worse, off the end of the memory region. Sponsored-by: https://despairlabs.com/sponsor/ Reviewed-by: Tony Hutter <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Reviewed-by: Tino Reichardt <[email protected]> Reviewed-by: Brian Atkinson <[email protected]> Signed-off-by: Rob Norris <[email protected]> Closes openzfs#17298 (cherry picked from commit 2ee5b51)
1 parent ff7d051 commit fa8f70e

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

include/os/linux/spl/sys/uio.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ zfs_uio_bvec_init(zfs_uio_t *uio, struct bio *bio, struct request *rq)
151151
#if defined(HAVE_VFS_IOV_ITER)
152152
static inline void
153153
zfs_uio_iov_iter_init(zfs_uio_t *uio, struct iov_iter *iter, offset_t offset,
154-
ssize_t resid, size_t skip)
154+
ssize_t resid)
155155
{
156156
uio->uio_iter = iter;
157157
uio->uio_iovcnt = iter->nr_segs;
@@ -161,7 +161,7 @@ zfs_uio_iov_iter_init(zfs_uio_t *uio, struct iov_iter *iter, offset_t offset,
161161
uio->uio_fmode = 0;
162162
uio->uio_extflg = 0;
163163
uio->uio_resid = resid;
164-
uio->uio_skip = skip;
164+
uio->uio_skip = 0;
165165
}
166166
#endif
167167

module/os/linux/zfs/zfs_uio.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,6 @@ zfs_uiomove_iter(void *p, size_t n, zfs_uio_rw_t rw, zfs_uio_t *uio,
268268
{
269269
size_t cnt = MIN(n, uio->uio_resid);
270270

271-
if (uio->uio_skip)
272-
iov_iter_advance(uio->uio_iter, uio->uio_skip);
273-
274271
if (rw == UIO_READ)
275272
cnt = copy_to_iter(p, cnt, uio->uio_iter);
276273
else

module/os/linux/zfs/zpl_file.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,8 @@ zpl_uio_init(zfs_uio_t *uio, struct kiocb *kiocb, struct iov_iter *to,
227227
loff_t pos, ssize_t count, size_t skip)
228228
{
229229
#if defined(HAVE_VFS_IOV_ITER)
230-
zfs_uio_iov_iter_init(uio, to, pos, count, skip);
230+
(void) skip;
231+
zfs_uio_iov_iter_init(uio, to, pos, count);
231232
#else
232233
zfs_uio_iovec_init(uio, zfs_uio_iter_iov(to), to->nr_segs, pos,
233234
zfs_uio_iov_iter_type(to) & ITER_KVEC ?

0 commit comments

Comments
 (0)