svn commit: r216927 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

Kostik Belousov kostikbel at gmail.com
Mon Jan 3 20:21:50 UTC 2011


On Mon, Jan 03, 2011 at 07:23:43PM +0000, Martin Matuska wrote:
> 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)
>   
Can we merge vn_rlimit_fsize() and stop duplicating this code ?

>   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 <sys/systm.h>
>  #include <sys/sysmacros.h>
>  #include <sys/resource.h>
> +#include <sys/resourcevar.h>
>  #include <sys/vfs.h>
>  #include <sys/vnode.h>
>  #include <sys/file.h>
> @@ -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));
>  }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20110103/a91a11e6/attachment.pgp


More information about the svn-src-all mailing list