From owner-svn-src-stable-8@FreeBSD.ORG Mon Jan 3 19:23:44 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 214AF10656F0; Mon, 3 Jan 2011 19:23:44 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0EB7A8FC14; Mon, 3 Jan 2011 19:23:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p03JNhoE002828; Mon, 3 Jan 2011 19:23:43 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p03JNhNZ002826; Mon, 3 Jan 2011 19:23:43 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201101031923.p03JNhNZ002826@svn.freebsd.org> From: Martin Matuska Date: Mon, 3 Jan 2011 19:23:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r216927 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jan 2011 19:23:44 -0000 Author: mm Date: Mon Jan 3 19:23:43 2011 New Revision: 216927 URL: http://svn.freebsd.org/changeset/base/216927 Log: MFC r207745 (trasz): Enforce RLIMIT_FSIZE in ZFS. Note: original implementation without vn_rlimit_fsize (pre-r207662) Reviewed by: trasz Approved by: pjd Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Jan 3 18:34:28 2011 (r216926) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Jan 3 19:23:43 2011 (r216927) @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -4362,6 +4363,17 @@ zfs_freebsd_write(ap) } */ *ap; { + if (ap->a_vp->v_type == VREG && ap->a_uio->uio_td != NULL) { + PROC_LOCK(ap->a_uio->uio_td->td_proc); + if (ap->a_uio->uio_offset + ap->a_uio->uio_resid > + lim_cur(ap->a_uio->uio_td->td_proc, RLIMIT_FSIZE)) { + psignal(ap->a_uio->uio_td->td_proc, SIGXFSZ); + PROC_UNLOCK(ap->a_uio->uio_td->td_proc); + return (EFBIG); + } + PROC_UNLOCK(ap->a_uio->uio_td->td_proc); + } + return (zfs_write(ap->a_vp, ap->a_uio, ioflags(ap->a_ioflag), ap->a_cred, NULL)); }