vfs_aio.c is still not safe

David Xu davidxu at freebsd.org
Tue Jan 24 16:17:18 PST 2006


Even with recently change to vfs_aio.c, the kernel AIO code is
still not safe to be used. The problem is a AIO daemon thread
may be blocked on sockets, pipe, and fifo if peer does not
transfer any data, the problem can be accumulated and all
daemon threads will be blocked if such user process increases.
I don't know who hacked socket code to support some level of
callback, it seems work, but in fact, it may only work for
first AIO request, if user queued multiple requests, same problem
will happen, I tried to workaround this problem by using
non-blocking I/O, but with current file ops, there is no such
support, I can not change O_NONBLOCK on fly because userland
and kernel have race, PR: kernel/41331 is a well explained
problem, userland will hit the race.

So possible solution could be:
1) disable AIO support for none disk file.
2) someone implement callbacks for pipe, fifo, and add
   non-blocking feature to fo_read/fo_write.

The former is simple, the later needs some effort, however
with superio kqueue, the AIO support for socket and pipe is
less important, I prefer 1) to make the AIO code usable.

David Xu






More information about the freebsd-arch mailing list