Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Jul 2016 12:06:40 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r303434 - stable/11/sys/kern
Message-ID:  <201607281206.u6SC6eWI034195@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201607281206.u6SC6eWI034195>