git: cc65a412ae22 - main - filesystems: return error from vn_rlimit_fsize() instead of EFBIG
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 24 Sep 2022 16:42:31 UTC
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=cc65a412ae226136e6207bdc8db4722dab99982f commit cc65a412ae226136e6207bdc8db4722dab99982f Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2022-09-18 14:44:49 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2022-09-24 16:41:14 +0000 filesystems: return error from vn_rlimit_fsize() instead of EFBIG Reviewed by: asomers, jah, markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D36625 --- sys/fs/ext2fs/ext2_vnops.c | 5 +++-- sys/fs/fuse/fuse_io.c | 10 ++++++---- sys/fs/msdosfs/msdosfs_vnops.c | 5 +++-- sys/fs/nfsclient/nfs_clbio.c | 5 +++-- sys/fs/smbfs/smbfs_io.c | 5 +++-- sys/fs/tmpfs/tmpfs_vnops.c | 6 ++++-- sys/kern/vfs_vnops.c | 2 -- sys/ufs/ffs/ffs_vnops.c | 5 +++-- 8 files changed, 25 insertions(+), 18 deletions(-) diff --git a/sys/fs/ext2fs/ext2_vnops.c b/sys/fs/ext2fs/ext2_vnops.c index b629ddefcd1a..5948cbd052e3 100644 --- a/sys/fs/ext2fs/ext2_vnops.c +++ b/sys/fs/ext2fs/ext2_vnops.c @@ -2207,8 +2207,9 @@ ext2_write(struct vop_write_args *ap) * Maybe this should be above the vnode op call, but so long as * file servers have no limits, I don't think it matters. */ - if (vn_rlimit_fsize(vp, uio, uio->uio_td)) - return (EFBIG); + error = vn_rlimit_fsize(vp, uio, uio->uio_td); + if (error != 0) + return (error); resid = uio->uio_resid; osize = ip->i_size; diff --git a/sys/fs/fuse/fuse_io.c b/sys/fs/fuse/fuse_io.c index 9ef4badfcdff..252fabb1c7d6 100644 --- a/sys/fs/fuse/fuse_io.c +++ b/sys/fs/fuse/fuse_io.c @@ -338,8 +338,9 @@ fuse_write_directbackend(struct vnode *vp, struct uio *uio, if (ioflag & IO_APPEND) uio_setoffset(uio, filesize); - if (vn_rlimit_fsize(vp, uio, uio->uio_td)) - return (EFBIG); + err = vn_rlimit_fsize(vp, uio, uio->uio_td); + if (err != 0) + return (err); fdisp_init(&fdi, 0); @@ -493,8 +494,9 @@ fuse_write_biobackend(struct vnode *vp, struct uio *uio, if (ioflag & IO_APPEND) uio_setoffset(uio, filesize); - if (vn_rlimit_fsize(vp, uio, uio->uio_td)) - return (EFBIG); + err = vn_rlimit_fsize(vp, uio, uio->uio_td); + if (err != 0) + return (err); do { bool direct_append, extending; diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c index f5a07cd5f492..8573db682698 100644 --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -663,8 +663,9 @@ msdosfs_write(struct vop_write_args *ap) /* * If they've exceeded their filesize limit, tell them about it. */ - if (vn_rlimit_fsize(vp, uio, uio->uio_td)) - return (EFBIG); + error = vn_rlimit_fsize(vp, uio, uio->uio_td); + if (error != 0) + return (error); /* * If the offset we are starting the write at is beyond the end of diff --git a/sys/fs/nfsclient/nfs_clbio.c b/sys/fs/nfsclient/nfs_clbio.c index c89d6796ea00..54943bcdf68b 100644 --- a/sys/fs/nfsclient/nfs_clbio.c +++ b/sys/fs/nfsclient/nfs_clbio.c @@ -1034,8 +1034,9 @@ ncl_write(struct vop_write_args *ap) * Maybe this should be above the vnode op call, but so long as * file servers have no limits, i don't think it matters */ - if (vn_rlimit_fsize(vp, uio, td)) - return (EFBIG); + error = vn_rlimit_fsize(vp, uio, td); + if (error != 0) + return (error); save2 = curthread_pflags2_set(TDP2_SBPAGES); biosize = vp->v_bufobj.bo_bsize; diff --git a/sys/fs/smbfs/smbfs_io.c b/sys/fs/smbfs/smbfs_io.c index dd12d1276438..f92fe50ccd99 100644 --- a/sys/fs/smbfs/smbfs_io.c +++ b/sys/fs/smbfs/smbfs_io.c @@ -285,8 +285,9 @@ smbfs_writevnode(struct vnode *vp, struct uio *uiop, if (uiop->uio_resid == 0) return 0; - if (vn_rlimit_fsize(vp, uiop, td)) - return (EFBIG); + error = vn_rlimit_fsize(vp, uiop, td); + if (error != 0) + return (error); scred = smbfs_malloc_scred(); smb_makescred(scred, td, cred); diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index 8077689caeac..079936946270 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -658,8 +658,10 @@ tmpfs_write(struct vop_write_args *v) if (uio->uio_offset + uio->uio_resid > VFS_TO_TMPFS(vp->v_mount)->tm_maxfilesize) return (EFBIG); - if (vn_rlimit_fsize(vp, uio, uio->uio_td)) - return (EFBIG); + error = vn_rlimit_fsize(vp, uio, uio->uio_td); + if (error != 0) + return (error); + if (uio->uio_offset + uio->uio_resid > node->tn_size) { error = tmpfs_reg_resize(vp, uio->uio_offset + uio->uio_resid, FALSE); diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 04e8cb0037a2..1d2c4f332473 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -3220,8 +3220,6 @@ vn_generic_copy_file_range(struct vnode *invp, off_t *inoffp, io.uio_offset = *outoffp; io.uio_resid = len; error = vn_rlimit_fsize(outvp, &io, fsize_td); - if (error != 0) - error = EFBIG; } if (VOP_PATHCONF(outvp, _PC_MIN_HOLE_SIZE, &holeout) != 0) holeout = 0; diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index 8b4b523dbfc8..833177aa4a2b 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -894,8 +894,9 @@ ffs_write( * Maybe this should be above the vnode op call, but so long as * file servers have no limits, I don't think it matters. */ - if (vn_rlimit_fsize(vp, uio, uio->uio_td)) - return (EFBIG); + error = vn_rlimit_fsize(vp, uio, uio->uio_td); + if (error != 0) + return (error); resid = uio->uio_resid; osize = ip->i_size;