From nobody Sat Oct 08 00:39:04 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MkmWs0Shmz4fG0G; Sat, 8 Oct 2022 00:39:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MkmWr6gVFz3nxP; Sat, 8 Oct 2022 00:39:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665189544; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wlo6XE5bjLvxNjfHW2wTtuvjV0UXu0F/C8mkWeJtADs=; b=xLnHAKmdrNYgiXkj3N4ix9ZANSn+MkDLB+4ohUtj1gryTFb+QwZy9v+3HVp21pL4FqnuKa 0tvZTNWZ6N1ULPH1rmD7qNCL+KLSeSscSSe073nl4zrHVePSTfNumM6PE6l9swDaaVlgW+ CvzimAmZmXQIuSfLlOJXDwJe+oLw81+eOwV1INn1DUusCUxnC0RVOydrxbJC/fYQVtkI3M 2zxQ3N/G85nGJmCBatwEbt1pO84wUr0Sdm4PQp8YZRG3HZRhpDRSRInYAFclqtL7C+9zdp 7oyEBg+c2cZPhmwPZtvA+6DtSMUnhnG3tpYWOsuKzsWsqx+KjHHT2UeUWmhJNA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MkmWr5Q6qzmYJ; Sat, 8 Oct 2022 00:39:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2980d4Er034250; Sat, 8 Oct 2022 00:39:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2980d4Ee034249; Sat, 8 Oct 2022 00:39:04 GMT (envelope-from git) Date: Sat, 8 Oct 2022 00:39:04 GMT Message-Id: <202210080039.2980d4Ee034249@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 2e46b4dab6e9 - stable/13 - filesystems: return error from vn_rlimit_fsize() instead of EFBIG List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2e46b4dab6e9c74d9607b17879b301fb69ba0be2 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665189544; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wlo6XE5bjLvxNjfHW2wTtuvjV0UXu0F/C8mkWeJtADs=; b=H8LfkZbCtxkAp7XLi3yN3xqwnnf2AV7Dxz7/PCg6Co9LJXs5C3qQkmjnj1kWivX/oJC73A uLaavpBYRDdH2p8YCggHmwXwvIMY6ufqCX/04YjI8Gd3wd4aDibHSFdS9QIU4R6w42aYRI 1LPgrdcnLM4Z1XKHsZ0yiQCqKQeU4PXwYgNdzMJGkO7gZgzwZCm7/F8tIUxesbIuhlUTCV 3bTS+0wqhh94Kib8oft6H8a91XRfpdkaXkPn8it3L0ztQyiYFLDD8KAc5IWQlQLFBGWq0P 047QUsv8aM3T/90/r/gTpti0fBFycAnYiI5X8DikjcQ6b0gHkviD+SKoFqi46w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1665189544; a=rsa-sha256; cv=none; b=ay0YSjqEf2kBO9qXiAxfjPB4M3OdvnHtTWIh2vvWk2KJa904WMWyEUa30axuS8v7YXe60L AHS0X2hK4pgPKQuRL3B7Kx5VqoAi3OZDCoQICFpjblaiLtzAXLHf6LXLwMW2T49HVhEPmB WBZt3trhcajsVg60NcWi4UiHtaEKfYZwddILHsP+1JkD7x40HZNx9LjFH4lmZfQb1g0YtX bx1TMQlxXdO2DOby8SMRTHD0l62OKW+dma1o3uGDVg0LTbf+LfWUYHZFMXnAUoyb7SeQz4 YQKBYEjxielI5/yZMejsbjV568ja5NEbGQTeqxk01eTu2KGiTaXjGju4SM5Ijg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2e46b4dab6e9c74d9607b17879b301fb69ba0be2 commit 2e46b4dab6e9c74d9607b17879b301fb69ba0be2 Author: Konstantin Belousov AuthorDate: 2022-09-18 14:44:49 +0000 Commit: Konstantin Belousov CommitDate: 2022-10-08 00:29:35 +0000 filesystems: return error from vn_rlimit_fsize() instead of EFBIG (cherry picked from commit cc65a412ae226136e6207bdc8db4722dab99982f) --- 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 724690403809..51119ed8d52f 100644 --- a/sys/fs/ext2fs/ext2_vnops.c +++ b/sys/fs/ext2fs/ext2_vnops.c @@ -2212,8 +2212,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 c70eca17ec29..179ee9e94f43 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 58f7f2876523..86af14784f5b 100644 --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -667,8 +667,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 326a5132990d..c1133cdaa1db 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -665,8 +665,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 b82db887b241..3089aca3468f 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -3195,8 +3195,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 1dc712f1d52a..a37b0f6e679c 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -893,8 +893,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;