From 60ffb019934f71cd0066d2c7248c9fbaeff16f00 Mon Sep 17 00:00:00 2001 From: Jason Evans Date: Thu, 20 Jan 2000 01:59:58 +0000 Subject: [PATCH] Don't tsleep() while at splbio(). Correctly return EINPROGRESS from aio_error() even when an aio request is still in the socket queue. Submitted by: Adrian Chadd --- sys/kern/vfs_aio.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c index fa953cdaac0e..175b50ff9f46 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -1543,12 +1543,12 @@ aio_suspend(struct proc *p, struct aio_suspend_args *uap) } } } + splx(s); ki->kaio_flags |= KAIO_WAKEUP; error = tsleep(p, PRIBIO | PCATCH, "aiospn", timo); - splx(s); - if (error == EINTR) { + if (error == ERESTART || error == EINTR) { zfree(aiol_zone, ijoblist); zfree(aiol_zone, ujoblist); return EINTR; @@ -1614,6 +1614,16 @@ aio_error(struct proc *p, struct aio_error_args *uap) return 0; } } + + for (cb = TAILQ_FIRST(&ki->kaio_sockqueue); cb; cb = TAILQ_NEXT(cb, + plist)) { + if (((intptr_t)cb->uaiocb._aiocb_private.kernelinfo) == + jobref) { + p->p_retval[0] = EINPROGRESS; + splx(s); + return 0; + } + } splx(s); s = splbio();