Author: mm
Date: Sun Nov 28 09:52:06 2010
New Revision: 215992
URL: http://svn.freebsd.org/changeset/base/215992

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 <[email protected]> [1], Michael Naef 
<[email protected]> [2]
  Reviewed by:  mm (r213673)
  Approved by:  delphij (mentor)

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 Sun Nov 
28 09:35:56 2010        (r215991)
+++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Nov 
28 09:52:06 2010        (r215992)
@@ -682,7 +682,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)
  *
@@ -749,7 +749,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
@@ -4176,6 +4176,21 @@ zfs_setsecattr(vnode_t *vp, vsecattr_t *
 }
 
 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_getpages(struct vnode *vp, vm_page_t *m, int count, int reqpage)
 {
        znode_t *zp = VTOZ(vp);
@@ -4322,7 +4337,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
@@ -4335,7 +4351,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
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to