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 <[email protected]> [1], Michael Naef 
<[email protected]> [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
_______________________________________________
[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