Page MenuHomeFreeBSD

copy_file_range: truncate write if it would exceed RLIMIT_FSIZE
ClosedPublic

Authored by asomers on Sep 25 2022, 11:17 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 3 2024, 12:33 AM
Unknown Object (File)
Jan 12 2024, 9:05 AM
Unknown Object (File)
Dec 20 2023, 7:15 AM
Unknown Object (File)
Oct 27 2023, 7:02 PM
Unknown Object (File)
Aug 30 2023, 2:47 AM
Unknown Object (File)
Aug 30 2023, 2:46 AM
Unknown Object (File)
Aug 30 2023, 2:44 AM
Unknown Object (File)
Aug 30 2023, 2:41 AM
Subscribers

Details

Summary

copy_file_range: truncate write if it would exceed RLIMIT_FSIZE

PR: 266611
MFC after: 2 weeks

Test Plan

test case added for fusefs. Manual testing for UFS, ZFS, tmpfs, msdosfs, and nfs.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Use of vn_rlimit_fsizex() requires finishing VOP with vn_rlimit_fsizex_res().
It is strange for nfs to obey new behavior for vop copy_range, but not for write (I did not converted nfs).

In D36706#833361, @kib wrote:

Use of vn_rlimit_fsizex() requires finishing VOP with vn_rlimit_fsizex_res().

That's only so the caller will see the correct value of uio_resid, right? For VOP_COPY_FILE_RANGE, the caller does not provide a struct uio. Instead, it's only necessary to return the number of bytes copied in *ap->a_lenp , AFAICT.

It is strange for nfs to obey new behavior for vop copy_range, but not for write (I did not converted nfs).

I could try to fix that one too.

In D36706#833361, @kib wrote:

Use of vn_rlimit_fsizex() requires finishing VOP with vn_rlimit_fsizex_res().

That's only so the caller will see the correct value of uio_resid, right? For VOP_COPY_FILE_RANGE, the caller does not provide a struct uio. Instead, it's only necessary to return the number of bytes copied in *ap->a_lenp , AFAICT.

Right now yes, but I considered it the current implementation detail. At least please add a comment explaining why _res() is not called, but I consider it fragile.

  • Add comments about vn_rlimit_fsizex_res
This revision is now accepted and ready to land.Sep 26 2022, 11:01 AM