]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Make vn_generic_copy_file_range() interruptible via a signal.
authorrmacklem <rmacklem@FreeBSD.org>
Fri, 9 Oct 2020 01:04:28 +0000 (01:04 +0000)
committerrmacklem <rmacklem@FreeBSD.org>
Fri, 9 Oct 2020 01:04:28 +0000 (01:04 +0000)
commit108a8db2793f75997e58b501a42527ae28f137af
treec032a2f9ac80dd58429470899df971b525b229bf
parent1baabc76994ec7404ad5672476c30dc0035749fc
Make vn_generic_copy_file_range() interruptible via a signal.

Without this patch, when vn_generic_copy_file_range() is
doing a large copy, it will remain in the function for a
considerable amount of time, delaying handling of any
outstanding signals until the copy completes.

This patch adds checks for signals that need to be
processed after each successful data copy cycle.
When sig_intr() returns non-zero, vn_generic_copy_file_range()
will return.
The check "if (len < savlen)" ensures that some data
has been copied, so that progress will be made.

Note that, since copy_file_range(2) is allowed to
return fewer bytes copied than requested, it
will never return EINTR/ERESTART when sig_intr()
returns non-zero.

Reviewed by: kib, asomers
Differential Revision: https://reviews.freebsd.org/D26620
sys/kern/vfs_vnops.c