From owner-svn-src-stable-7@FreeBSD.ORG Sun Nov 28 10:05:27 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 34907106564A; Sun, 28 Nov 2010 10:05:27 +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 06F018FC1C; Sun, 28 Nov 2010 10:05:27 +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 oASA5QSR095892; Sun, 28 Nov 2010 10:05:26 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oASA5Qmg095890; Sun, 28 Nov 2010 10:05:26 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201011281005.oASA5Qmg095890@svn.freebsd.org> From: Martin Matuska Date: Sun, 28 Nov 2010 10:05:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215993 - stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Nov 2010 10:05:27 -0000 Author: mm Date: Sun Nov 28 10:05:26 2010 New Revision: 215993 URL: http://svn.freebsd.org/changeset/base/215993 Log: MFC r213634, r213673: MFC r213634: Change FAPPEND to IO_APPEND as this is a ioflag and not a fflag. This corrects writing to append-only files on ZFS. MFC r213673 (pjd): Provide internal ioflags() function that converts ioflag provided by FreeBSD's VFS to OpenSolaris-specific ioflag expected by ZFS. Use it for read and write operations. PR: kern/149495 [1], kern/151082 [2] Submitted by: Daniel Zhelev [1], Michael Naef [2] Reviewed by: mm (r213673) Approved by: delphij (mentor) Modified: stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Nov 28 09:52:06 2010 (r215992) +++ stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Nov 28 10:05:26 2010 (r215993) @@ -660,7 +660,7 @@ zfs_prefault_write(ssize_t n, struct uio * IN: vp - vnode of file to be written to. * uio - structure supplying write location, range info, * and data buffer. - * ioflag - IO_APPEND flag set if in append mode. + * ioflag - FAPPEND flag set if in append mode. * cr - credentials of caller. * ct - caller context (NFS/CIFS fem monitor only) * @@ -726,7 +726,7 @@ zfs_write(vnode_t *vp, uio_t *uio, int i /* * If in append mode, set the io offset pointer to eof. */ - if (ioflag & IO_APPEND) { + if (ioflag & FAPPEND) { /* * Range lock for a file append: * The value for the start of range will be determined by @@ -3887,6 +3887,21 @@ zfs_setsecattr(vnode_t *vp, vsecattr_t * #endif /* TODO */ static int +ioflags(int ioflags) +{ + int flags = 0; + + if (ioflags & IO_APPEND) + flags |= FAPPEND; + if (ioflags & IO_NDELAY) + flags |= FNONBLOCK; + if (ioflags & IO_SYNC) + flags |= (FSYNC | FDSYNC | FRSYNC); + + return (flags); +} + +static int zfs_freebsd_open(ap) struct vop_open_args /* { struct vnode *a_vp; @@ -3944,7 +3959,8 @@ zfs_freebsd_read(ap) } */ *ap; { - return (zfs_read(ap->a_vp, ap->a_uio, ap->a_ioflag, ap->a_cred, NULL)); + return (zfs_read(ap->a_vp, ap->a_uio, ioflags(ap->a_ioflag), + ap->a_cred, NULL)); } static int @@ -3957,7 +3973,8 @@ zfs_freebsd_write(ap) } */ *ap; { - return (zfs_write(ap->a_vp, ap->a_uio, ap->a_ioflag, ap->a_cred, NULL)); + return (zfs_write(ap->a_vp, ap->a_uio, ioflags(ap->a_ioflag), + ap->a_cred, NULL)); } static int