Date: Sat, 8 Oct 2022 00:39:11 GMT From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 55b41282d698 - stable/13 - FFS: truncate write if it would exceed the fs max file size or RLIMIT_FSIZE Message-ID: <202210080039.2980dB9k034404@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=55b41282d698bed4b3bb75b74265992c2cf5f42b commit 55b41282d698bed4b3bb75b74265992c2cf5f42b Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2022-09-18 11:48:40 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2022-10-08 00:29:36 +0000 FFS: truncate write if it would exceed the fs max file size or RLIMIT_FSIZE PR: 164793 (cherry picked from commit 87525ef94007c792c6745db7938251a663ca5706) --- sys/ufs/ffs/ffs_vnops.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index a37b0f6e679c..bfba15a55872 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -838,7 +838,7 @@ ffs_write( struct buf *bp; ufs_lbn_t lbn; off_t osize; - ssize_t resid; + ssize_t resid, r; int seqcount; int blkoffset, error, flags, ioflag, size, xfersize; @@ -887,15 +887,17 @@ ffs_write( KASSERT(uio->uio_resid >= 0, ("ffs_write: uio->uio_resid < 0")); KASSERT(uio->uio_offset >= 0, ("ffs_write: uio->uio_offset < 0")); fs = ITOFS(ip); - if ((uoff_t)uio->uio_offset + uio->uio_resid > fs->fs_maxfilesize) - return (EFBIG); + /* * Maybe this should be above the vnode op call, but so long as * file servers have no limits, I don't think it matters. */ - error = vn_rlimit_fsize(vp, uio, uio->uio_td); - if (error != 0) + error = vn_rlimit_fsizex(vp, uio, fs->fs_maxfilesize, &r, + uio->uio_td); + if (error != 0) { + vn_rlimit_fsizex_res(uio, r); return (error); + } resid = uio->uio_resid; osize = ip->i_size; @@ -1035,6 +1037,7 @@ ffs_write( if (ffs_fsfail_cleanup(VFSTOUFS(vp->v_mount), error)) error = ENXIO; } + vn_rlimit_fsizex_res(uio, r); return (error); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202210080039.2980dB9k034404>