Bug #164793 addressed the problem that VOP_WRITE, with a range that crossed the RLIMIT_FSIZE limit, did not write all the way up to that limit, as required by POSIX. Rather, it would write nothing and return EFBIG. VOP_COPY_FILE_RANGE has the same problem. While POSIX does not specify copy_file_range, I think its behavior should match. Do you all agree?
I think yes it should be done. Would you handle this?
Sure, I can take it.
Created attachment 236825 [details] Test program Attached test program. To use, cd to the file system under test and run. It will call copy_file_range across the RLIMIT_FSIZE boundary and verify that the write gets truncated rather than failing.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=52360ca32ff90b605ac7481fd79e6a251e8b5116 commit 52360ca32ff90b605ac7481fd79e6a251e8b5116 Author: Alan Somers <asomers@FreeBSD.org> AuthorDate: 2022-09-25 22:53:36 +0000 Commit: Alan Somers <asomers@FreeBSD.org> CommitDate: 2022-09-26 21:22:29 +0000 copy_file_range: truncate write if it would exceed RLIMIT_FSIZE PR: 266611 MFC after: 2 weeks Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D36706 sys/fs/fuse/fuse_vnops.c | 15 +++-- sys/fs/nfsclient/nfs_clvnops.c | 8 ++- sys/kern/vfs_vnops.c | 14 ++-- tests/sys/fs/fusefs/copy_file_range.cc | 113 +++++++++++++++++++++++++-------- 4 files changed, 115 insertions(+), 35 deletions(-)
Fixed in main. No MFC to stable/12 , because stable/12 lacks copy_file_range.
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=0733dd8a9353a1b9796ffeca0120c5c3642df48b commit 0733dd8a9353a1b9796ffeca0120c5c3642df48b Author: Alan Somers <asomers@FreeBSD.org> AuthorDate: 2022-09-25 22:53:36 +0000 Commit: Alan Somers <asomers@FreeBSD.org> CommitDate: 2022-10-12 04:49:39 +0000 copy_file_range: truncate write if it would exceed RLIMIT_FSIZE PR: 266611 Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D36706 (cherry picked from commit 52360ca32ff90b605ac7481fd79e6a251e8b5116) sys/fs/fuse/fuse_vnops.c | 15 +++-- sys/fs/nfsclient/nfs_clvnops.c | 8 ++- sys/kern/vfs_vnops.c | 14 ++-- tests/sys/fs/fusefs/copy_file_range.cc | 113 +++++++++++++++++++++++++-------- 4 files changed, 115 insertions(+), 35 deletions(-)