Author: kib
Date: Sun Aug 16 21:07:19 2020
New Revision: 364289
URL: https://svnweb.freebsd.org/changeset/base/364289

Log:
  VMIO reads: enable for UFS
  
  Move v_object creation earlier, so that VIRF_PGREAD is never set if
  v_object is NULL.  There is no much harm from instantiating v_object
  when later check for append-only flags disallows open.
  
  Reviewed by:  markj
  Tested by:    pho
  Sponsored by: The FreeBSD Foundation
  Differential revision:        https://reviews.freebsd.org/D25968

Modified:
  head/sys/ufs/ufs/ufs_vnops.c

Modified: head/sys/ufs/ufs/ufs_vnops.c
==============================================================================
--- head/sys/ufs/ufs/ufs_vnops.c        Sun Aug 16 21:05:56 2020        
(r364288)
+++ head/sys/ufs/ufs/ufs_vnops.c        Sun Aug 16 21:07:19 2020        
(r364289)
@@ -282,13 +282,20 @@ ufs_open(struct vop_open_args *ap)
                return (EOPNOTSUPP);
 
        ip = VTOI(vp);
+       vnode_create_vobject(vp, DIP(ip, i_size), ap->a_td);
+       if (vp->v_type == VREG && (vp->v_irflag & VIRF_PGREAD) == 0) {
+               VI_LOCK(vp);
+               vp->v_irflag |= VIRF_PGREAD;
+               VI_UNLOCK(vp);
+       }
+
        /*
         * Files marked append-only must be opened for appending.
         */
        if ((ip->i_flags & APPEND) &&
            (ap->a_mode & (FWRITE | O_APPEND)) == FWRITE)
                return (EPERM);
-       vnode_create_vobject(vp, DIP(ip, i_size), ap->a_td);
+
        return (0);
 }
 
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to