Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F138104170
D7151.id18211.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D7151.id18211.diff
View Options
Index: lib/libc/sys/aio_fsync.2
===================================================================
--- lib/libc/sys/aio_fsync.2
+++ lib/libc/sys/aio_fsync.2
@@ -80,10 +80,10 @@
.Bl -tag -width Er
.It Bq Er EAGAIN
The request was not queued because of system resource limitations.
-.It Bq Er ENOSYS
-The
-.Fn aio_fsync
-system call is not supported.
+.It Bq Er EOPNOTSUPP
+The descriptor associated with
+.Fa iocb->aio_fildes
+is unsafe and asynchronous I/O operations on unsafe descriptors are disabled.
.It Bq Er EINVAL
A value of the
.Fa op
Index: lib/libc/sys/aio_mlock.2
===================================================================
--- lib/libc/sys/aio_mlock.2
+++ lib/libc/sys/aio_mlock.2
@@ -92,10 +92,6 @@
.Bl -tag -width Er
.It Bq Er EAGAIN
The request was not queued because of system resource limitations.
-.It Bq Er ENOSYS
-The
-.Fn aio_mlock
-system call is not supported.
.El
.Pp
If the request is successfully enqueued, but subsequently cancelled
Index: lib/libc/sys/aio_read.2
===================================================================
--- lib/libc/sys/aio_read.2
+++ lib/libc/sys/aio_read.2
@@ -115,10 +115,10 @@
.Bl -tag -width Er
.It Bq Er EAGAIN
The request was not queued because of system resource limitations.
-.It Bq Er ENOSYS
-The
-.Fn aio_read
-system call is not supported.
+.It Bq Er EOPNOTSUPP
+The descriptor associated with
+.Fa iocb->aio_fildes
+is unsafe and asynchronous I/O operations on unsafe descriptors are disabled.
.El
.Pp
The following conditions may be synchronously detected when the
Index: lib/libc/sys/aio_write.2
===================================================================
--- lib/libc/sys/aio_write.2
+++ lib/libc/sys/aio_write.2
@@ -119,10 +119,10 @@
.Bl -tag -width Er
.It Bq Er EAGAIN
The request was not queued because of system resource limitations.
-.It Bq Er ENOSYS
-The
-.Fn aio_write
-system call is not supported.
+.It Bq Er EOPNOTSUPP
+The descriptor associated with
+.Fa iocb->aio_fildes
+is unsafe and asynchronous I/O operations on unsafe descriptors are disabled.
.El
.Pp
The following conditions may be synchronously detected when the
Index: share/man/man4/aio.4
===================================================================
--- share/man/man4/aio.4
+++ share/man/man4/aio.4
@@ -37,17 +37,23 @@
The
.Nm
facility provides system calls for asynchronous I/O.
-However, asynchronous I/O operations are only enabled for certain file
-types by default.
-Asynchronous I/O operations for other file types may block an AIO daemon
-indefinitely resulting in process and/or system hangs.
-Asynchronous I/O operations can be enabled for all file types by setting
+Asynchronous I/O operations are not completed synchronously by the
+calling thread.
+Instead, the calling thread invokes one system call to request an
+asynchronous I/O operation.
+The status of a completed request is retrieved later via a separate
+system call.
+.Pp
+Asynchronous I/O operations on some file descriptor types may block an
+AIO daemon indefinitely resulting in process and/or system hangs.
+Operations on these file descriptor types are disabled by default, but
+can be enabled by setting
the
.Va vfs.aio.enable_unsafe
sysctl node to a non-zero value.
.Pp
Asynchronous I/O operations on sockets and raw disk devices do not block
-indefinitely and are enabled by default.
+indefinitely and are always enabled.
.Pp
The
.Nm
Index: sys/kern/vfs_aio.c
===================================================================
--- sys/kern/vfs_aio.c
+++ sys/kern/vfs_aio.c
@@ -53,6 +53,7 @@
#include <sys/syscall.h>
#include <sys/sysent.h>
#include <sys/sysctl.h>
+#include <sys/syslog.h>
#include <sys/sx.h>
#include <sys/taskqueue.h>
#include <sys/vnode.h>
@@ -110,6 +111,11 @@
SYSCTL_INT(_vfs_aio, OID_AUTO, enable_unsafe, CTLFLAG_RW, &enable_aio_unsafe, 0,
"Permit asynchronous IO on all file types, not just known-safe types");
+static unsigned int unsafe_warningcnt = 1;
+SYSCTL_UINT(_vfs_aio, OID_AUTO, unsafe_warningcnt, CTLFLAG_RW,
+ &unsafe_warningcnt, 0,
+ "Warnings that will be triggered upon failed IO requests on unsafe files");
+
static int max_aio_procs = MAX_AIO_PROCS;
SYSCTL_INT(_vfs_aio, OID_AUTO, max_aio_procs, CTLFLAG_RW, &max_aio_procs, 0,
"Maximum number of kernel processes to use for handling async IO ");
@@ -1685,8 +1691,16 @@
goto done;
#endif
queueit:
- if (!enable_aio_unsafe)
+ if (!enable_aio_unsafe) {
+ if (unsafe_warningcnt > 0) {
+ unsafe_warningcnt--;
+ log(LOG_INFO,
+ "pid %d (%s) is attempting to use unsafe AIO requests%s\n",
+ curproc->p_pid, curproc->p_comm,
+ unsafe_warningcnt ? "" : " - not logging anymore");
+ }
return (EOPNOTSUPP);
+ }
if (opcode == LIO_SYNC) {
AIO_LOCK(ki);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 29, 10:24 PM (2 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26361990
Default Alt Text
D7151.id18211.diff (4 KB)
Attached To
Mode
D7151: Add more documentation regarding unsafe AIO requests.
Attached
Detach File
Event Timeline
Log In to Comment