mirror_zfs/module/os/linux/zfs
Brian Atkinson 0e21e473a7 Update pin_user_pages() calls for Direct I/O
Originally #16856 updated Linux Direct I/O requests to use the new
pin_user_pages API. However, it was an oversight that this PR only
handled iov_iter's of type ITER_IOVEC and ITER_UBUF. Other iov_iter
types may try and use the pin_user_pages API if it is available. This
can lead to panics as the iov_iter is not being iterated over correctly
in zfs_uio_pin_user_pages().

Unfortunately, generic iov_iter API's that call pin_user_page_fast() are
protected as GPL only. Rather than update zfs_uio_pin_user_pages() to
account for all iov_iter types, we can simply just call
zfs_uio_get_dio_page_iov_iter() if the iov_iter type is not ITER_IOVEC
or ITER_UBUF. zfs_uio_get_dio_page_iov_iter() calls the
iov_iter_get_pages() calls that can handle any iov_iter type.

In the future it might be worth using the exposed iov_iter iterator
functions that are included in the header iov_iter.h since v6.7. These
functions allow for any iov_iter type to be iterated over and advanced
while applying a step function during iteration. This could possibly be
leveraged in zfs_uio_pin_user_pages().

A new ZFS test case was added to test that a ITER_BVEC is handled
correctly using this new code path. This test case was provided though
issue #16956.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ameer Hamza <ahamza@ixsystems.com>
Signed-off-by: Brian Atkinson <batkinson@lanl.gov>
Closes #16956 
Closes #17006
2025-02-25 22:33:25 +05:00
..
abd_os.c Remove unnecessary CSTYLED escapes on top-level macro invocations 2024-12-06 09:05:02 -08:00
arc_os.c set zfs_arc_shrinker_limit to 0 by default 2024-12-29 11:53:45 -08:00
mmp_os.c Cleanup: 64-bit kernel module parameters should use fixed width types 2022-10-13 10:03:29 -07:00
policy.c config: remove HAVE_HAS_CAPABILITY 2024-09-18 11:23:51 -07:00
qat_compress.c Intel QAT 1.7 compatibility 2023-09-07 14:38:17 -07:00
qat_crypt.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
qat.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
spa_misc_os.c Selectable block allocators 2023-09-01 18:00:30 -07:00
trace.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
vdev_disk.c flush: only detect lack of flush support in one place 2024-12-16 10:26:30 -08:00
vdev_file.c Use <fcntl.h> instead of <sys/fcntl.h> 2024-11-07 11:33:51 -08:00
vdev_label_os.c RAID-Z expansion feature 2023-11-08 10:19:41 -08:00
vdev_raidz.c Make the vfs.zfs.vdev.raidz_impl sysctl cross-platform 2025-02-25 22:32:11 +05:00
zfs_acl.c Fix an uninitialized data access (#16511) 2024-09-10 09:08:45 -07:00
zfs_ctldir.c Fix inconsistent mount options for ZFS root 2024-10-21 13:02:07 -07:00
zfs_debug.c Remove unnecessary CSTYLED escapes on top-level macro invocations 2024-12-06 09:05:02 -08:00
zfs_dir.c snapdir: add 'disabled' value to make .zfs inaccessible 2024-10-02 09:12:02 -07:00
zfs_file_os.c zfs_file: rename zfs_file_fallocate to zfs_file_deallocate 2024-09-18 11:35:04 -07:00
zfs_ioctl_os.c linux: log a scary warning when used with an experimental kernel 2024-09-23 10:44:54 -07:00
zfs_racct.c Adding Direct IO Support 2024-09-14 13:47:59 -07:00
zfs_sysfs.c Introduce kmem_scnprintf() 2022-10-29 13:05:11 -07:00
zfs_uio.c Update pin_user_pages() calls for Direct I/O 2025-02-25 22:33:25 +05:00
zfs_vfsops.c Add missing zfs_exit() when snapdir is disabled (#16912) 2025-01-02 17:04:10 -08:00
zfs_vnops_os.c Remove unnecessary CSTYLED escapes on top-level macro invocations 2024-12-06 09:05:02 -08:00
zfs_znode_os.c Remove unnecessary CSTYLED escapes on top-level macro invocations 2024-12-06 09:05:02 -08:00
zio_crypt.c Remove unnecessary CSTYLED escapes on top-level macro invocations 2024-12-06 09:05:02 -08:00
zpl_ctldir.c snapdir: add 'disabled' value to make .zfs inaccessible 2024-10-02 09:12:02 -07:00
zpl_export.c Support for longnames for files/directories (Linux part) 2024-10-01 13:40:27 -07:00
zpl_file_range.c config: remove HAVE_VFS_COPY_FILE_RANGE 2024-09-18 11:23:50 -07:00
zpl_file.c Removing old code outside of 4.18 kernsls 2024-12-16 10:26:49 -08:00
zpl_inode.c Support for longnames for files/directories (Linux part) 2024-10-01 13:40:27 -07:00
zpl_super.c Linux: Fix zfs_prune panics 2024-12-02 18:14:26 -08:00
zpl_xattr.c Allocate zap_attribute_t from kmem instead of stack 2024-10-01 13:39:08 -07:00
zvol_os.c Remove unnecessary CSTYLED escapes on top-level macro invocations 2024-12-06 09:05:02 -08:00