Author: kib
Date: Thu Jul 28 12:06:40 2016
New Revision: 303434
URL: https://svnweb.freebsd.org/changeset/base/303434

Log:
  MFC r303154:
  Declare aio requests on files from local filesystems safe.
  
  Approved by:  re (gjb)

Modified:
  stable/11/sys/kern/vfs_aio.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/vfs_aio.c
==============================================================================
--- stable/11/sys/kern/vfs_aio.c        Thu Jul 28 11:51:20 2016        
(r303433)
+++ stable/11/sys/kern/vfs_aio.c        Thu Jul 28 12:06:40 2016        
(r303434)
@@ -1664,7 +1664,10 @@ aio_queue_file(struct file *fp, struct k
        struct aioliojob *lj;
        struct kaioinfo *ki;
        struct kaiocb *job2;
+       struct vnode *vp;
+       struct mount *mp;
        int error, opcode;
+       bool safe;
 
        lj = job->lio;
        ki = job->userproc->p_aioinfo;
@@ -1685,7 +1688,16 @@ aio_queue_file(struct file *fp, struct k
                goto done;
 #endif
 queueit:
-       if (!enable_aio_unsafe)
+       safe = false;
+       if (fp->f_type == DTYPE_VNODE) {
+               vp = fp->f_vnode;
+               if (vp->v_type == VREG || vp->v_type == VDIR) {
+                       mp = fp->f_vnode->v_mount;
+                       if (mp == NULL || (mp->mnt_flag & MNT_LOCAL) != 0)
+                               safe = true;
+               }
+       }
+       if (!(safe || enable_aio_unsafe))
                return (EOPNOTSUPP);
 
        if (opcode == LIO_SYNC) {
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to