From nobody Sat Oct 08 00:39:13 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 4MkmX20Vf7z4fGJs; Sat, 8 Oct 2022 00:39:14 +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 4MkmX170kVz3pX0; Sat, 8 Oct 2022 00:39:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665189554; 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=OsvMYlp9mB7OUhUncRrSPU4V7995PbRLRwHbt1IXvHM=; b=HRGZr9gDkXosIx5qs5vsHvlAnV5qbPILk25mtSc3v4YWMnQb6aKOPtwSKbcA9vTYWRLium dAKr5so1YVPCuSLHnCSay8cdbIg0FUjpIS5CJdIgdLZNpJOIiI5c1OdmBSKryaASBguTe9 WhnnChziVaTh83INKWbftGqtZuyu4/qYWHlXaVL9NKa2kULorNQj3uLNQfAGaH21jB0fGQ ZuXN1oFz91asP9cSGrB5NclXQdWMT1BMCBLyO+LszMeNCKy20daYxXygo4fOvV663ibk5/ 40wICa/btPGfkT9JrEjoNJpIcSYExkrw8q7K16shI4aCYX6I/6+TNzQPbLYmng== 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 4MkmX166HTzmVS; Sat, 8 Oct 2022 00:39:13 +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 2980dDcH034463; Sat, 8 Oct 2022 00:39:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2980dDec034462; Sat, 8 Oct 2022 00:39:13 GMT (envelope-from git) Date: Sat, 8 Oct 2022 00:39:13 GMT Message-Id: <202210080039.2980dDec034462@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: 2bd3dbe3dd60 - stable/13 - tmpfs: truncate write if it would exceed the fs max file size or RLIMIT_FSIZE 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: 2bd3dbe3dd60aeb84ebc52f23f0f4205d3eb082d Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665189554; 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=OsvMYlp9mB7OUhUncRrSPU4V7995PbRLRwHbt1IXvHM=; b=Ez6JDCvP7H+5srn4tAl9IYx8Jzd3KeYHU67YVM+9PXdJ2sNGZWQD0Ettl6TSdHYNuRJyUb FLMPu3uP8ePJqHHDwALkojfRomtz9AMgKJ68UEyjQepb8N3U8pLWbOdMnbFM16yIklQxl3 lFan1c0chdjALnRsp6Qyw1aToqGWBRtyzhO98kp3JwZqo7PLKPirUtxffspxXvgffMh0Iz yqyfTnAqkxStdZgq/33vhhdVFiNBXx3tDtdBVdsz4PvpayQShmwCXF2/cOUqP6FmglW5kG klWg/U5iEX6ZMGxQ7xKpZ1GZaFjrvpt4oGDhkPcnnF2xx04CfeXuk5ZK69TjFA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1665189554; a=rsa-sha256; cv=none; b=W/OEtHMAg8sp94QcJ/DQNP0IYI6J0aVbmFLjYloIXXgRDN0rgFEAlFvpcadabKkCz1ROQx AFG4JJqT7hc1FYAL/pqOTwFAfauxjlzg6/JVqxdp64+t3Kxu2759DqYPIQ/Yul9sN0BHSK fOjPzNmr/Hx26FdvTgDX/pqOTYtby1OfMNLLZzYezUWcNfoibAziWfTiApTv3x/Kj2Fa/G c0ku9fAdt/VPGgeb93rcIcVRwIx0JHGGTfKQqk8s8nH6GSSCdnB8MTp4c2Idlrx+R7iQYE INFT+xYTOhqn9hX45hG7xe8CMyLxebR3/KMHlIjVuJr4mbKKQhn3C3yOyl+r7g== 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=2bd3dbe3dd60aeb84ebc52f23f0f4205d3eb082d commit 2bd3dbe3dd60aeb84ebc52f23f0f4205d3eb082d Author: Konstantin Belousov AuthorDate: 2022-09-18 13:27:28 +0000 Commit: Konstantin Belousov CommitDate: 2022-10-08 00:29:36 +0000 tmpfs: truncate write if it would exceed the fs max file size or RLIMIT_FSIZE PR: 164793 (cherry picked from commit 8bdb2695d69710b7f2e7cc20820aab8b3f4668a6) --- sys/fs/tmpfs/tmpfs_vnops.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index c1133cdaa1db..ab5a99b1be66 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -646,6 +646,7 @@ tmpfs_write(struct vop_write_args *v) struct uio *uio; struct tmpfs_node *node; off_t oldsize; + ssize_t r; int error, ioflag; mode_t newmode; @@ -662,12 +663,12 @@ tmpfs_write(struct vop_write_args *v) return (0); if (ioflag & IO_APPEND) uio->uio_offset = node->tn_size; - if (uio->uio_offset + uio->uio_resid > - VFS_TO_TMPFS(vp->v_mount)->tm_maxfilesize) - return (EFBIG); - error = vn_rlimit_fsize(vp, uio, uio->uio_td); - if (error != 0) + error = vn_rlimit_fsizex(vp, uio, VFS_TO_TMPFS(vp->v_mount)-> + tm_maxfilesize, &r, uio->uio_td); + if (error != 0) { + vn_rlimit_fsizex_res(uio, r); return (error); + } if (uio->uio_offset + uio->uio_resid > node->tn_size) { error = tmpfs_reg_resize(vp, uio->uio_offset + uio->uio_resid, @@ -694,6 +695,7 @@ out: MPASS(IMPLIES(error == 0, uio->uio_resid == 0)); MPASS(IMPLIES(error != 0, oldsize == node->tn_size)); + vn_rlimit_fsizex_res(uio, r); return (error); }