Skip to content

Commit 11446a4

Browse files
committed
Linux 6.5 fix: iter_iov() function now used to get old iov member
The iov_iter->iov member is now iov_iter->__iov and must be accessed via the accessor function iter_iov(). Create a wrapper that is conditionally compiled to use the access method appropriate for the target kernel version. Signed-off-by: Coleman Kane <[email protected]>
1 parent b22bab2 commit 11446a4

File tree

3 files changed

+32
-5
lines changed

3 files changed

+32
-5
lines changed

config/kernel-vfs-iov_iter.m4

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,14 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_IOV_ITER], [
9393
struct iov_iter iter = { 0 };
9494
__attribute__((unused)) enum iter_type i = iov_iter_type(&iter);
9595
])
96+
97+
ZFS_LINUX_TEST_SRC([iter_iov], [
98+
#include <linux/fs.h>
99+
#include <linux/uio.h>
100+
],[
101+
struct iov_iter iter = { 0 };
102+
__attribute__((unused)) const struct iovec *iov = iter_iov(&iter);
103+
])
96104
])
97105

98106
AC_DEFUN([ZFS_AC_KERNEL_VFS_IOV_ITER], [
@@ -201,4 +209,19 @@ AC_DEFUN([ZFS_AC_KERNEL_VFS_IOV_ITER], [
201209
AC_DEFINE(HAVE_VFS_IOV_ITER, 1,
202210
[All required iov_iter interfaces are available])
203211
])
212+
213+
dnl #
214+
dnl # Kernel 6.5 introduces the iter_iov() function that returns the
215+
dnl # __iov member of an iov_iter*. The iov member was renamed to this
216+
dnl # __iov member, and is intended to be accessed via the helper
217+
dnl # function now.
218+
dnl #
219+
AC_MSG_CHECKING([whether iter_iov() is available])
220+
ZFS_LINUX_TEST_RESULT([iter_iov], [
221+
AC_MSG_RESULT(yes)
222+
AC_DEFINE(HAVE_ITER_IOV, 1,
223+
[iter_iov() is available])
224+
],[
225+
AC_MSG_RESULT(no)
226+
])
204227
])

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,4 +173,10 @@ zfs_uio_iov_iter_init(zfs_uio_t *uio, struct iov_iter *iter, offset_t offset,
173173
}
174174
#endif
175175

176+
#if defined(HAVE_ITER_IOV)
177+
#define zfs_uio_iter_iov(iter) iter_iov((iter))
178+
#else
179+
#define zfs_uio_iter_iov(iter) (iter)->iov
180+
#endif
181+
176182
#endif /* SPL_UIO_H */

module/os/linux/zfs/zpl_file.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -300,17 +300,15 @@ zpl_uio_init(zfs_uio_t *uio, struct kiocb *kiocb, struct iov_iter *to,
300300
{
301301
#if defined(HAVE_VFS_IOV_ITER)
302302
zfs_uio_iov_iter_init(uio, to, pos, count, skip);
303-
#else
304-
#ifdef HAVE_IOV_ITER_TYPE
305-
zfs_uio_iovec_init(uio, to->iov, to->nr_segs, pos,
303+
#elif defined(HAVE_IOV_ITER_TYPE)
304+
zfs_uio_iovec_init(uio, zfs_uio_iter_iov(to), to->nr_segs, pos,
306305
iov_iter_type(to) & ITER_KVEC ? UIO_SYSSPACE : UIO_USERSPACE,
307306
count, skip);
308307
#else
309-
zfs_uio_iovec_init(uio, to->iov, to->nr_segs, pos,
308+
zfs_uio_iovec_init(uio, zfs_uio_iter_iov(to), to->nr_segs, pos,
310309
to->type & ITER_KVEC ? UIO_SYSSPACE : UIO_USERSPACE,
311310
count, skip);
312311
#endif
313-
#endif
314312
}
315313

316314
static ssize_t

0 commit comments

Comments
 (0)