mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 19:19:32 +03:00
dea8fabf73
ZFS implements copy_file_range(2) using block cloning when possible. This implementation must respect the RLIMIT_FSIZE limit. zfs_clone_range() already checks the limit, so it is safe to remove this check in zfs_freebsd_copy_file_range(). Moreover, the removed check produces false positives: the length passed to copy_file_range(2) may be larger than the input file size; as the man page notes, "for best performance, call copy_file_range() with the largest len value possible." In particular, some existing code passes SSIZE_MAX there. The check in zfs_clone_range() clamps the length to the input file's size before checking, but the removed check uses the caller supplied length, so something like $ echo a > /tmp/foo $ limits -f 1024 cat /tmp/foo > /tmp/bar fails because FreeBSD's cat(1) uses copy_file_range(2) in the manner described above. Reported-by: Philip Paeps <philip@FreeBSD.org> Signed-off-by: Mark Johnston <markj@FreeBSD.org> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Allan Jude <allan@klarasystems.com> Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de> Reviewed-by: Tony Hutter <hutter2@llnl.gov> |
||
---|---|---|
.. | ||
abd_os.c | ||
arc_os.c | ||
crypto_os.c | ||
dmu_os.c | ||
event_os.c | ||
hkdf.c | ||
kmod_core.c | ||
spa_os.c | ||
sysctl_os.c | ||
vdev_file.c | ||
vdev_geom.c | ||
vdev_label_os.c | ||
zfs_acl.c | ||
zfs_ctldir.c | ||
zfs_debug.c | ||
zfs_dir.c | ||
zfs_file_os.c | ||
zfs_ioctl_compat.c | ||
zfs_ioctl_os.c | ||
zfs_racct.c | ||
zfs_vfsops.c | ||
zfs_vnops_os.c | ||
zfs_znode.c | ||
zio_crypt.c | ||
zvol_os.c |