aboutsummaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorAlan Cox <alc@FreeBSD.org>2002-04-14 03:04:19 +0000
committerAlan Cox <alc@FreeBSD.org>2002-04-14 03:04:19 +0000
commit00e731601d897d5db12908091da705bc0dad1e69 (patch)
treeaa5fb878a17051d60aa6913f6444c3fc5c285bf3 /sys/kern
parent5041f86c283f919e8da39a5ac122e6e057bc5a88 (diff)
downloadsrc-00e731601d897d5db12908091da705bc0dad1e69.tar.gz
src-00e731601d897d5db12908091da705bc0dad1e69.zip
o Use aiocblist::fd_file in the AIO threads rather than recomputing
the file * from the calling process's descriptor table. o Eliminate sharing of the calling process's descriptor table with the AIO threads.
Notes
Notes: svn path=/head/; revision=94633
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/vfs_aio.c48
1 files changed, 3 insertions, 45 deletions
diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c
index 46d28055daf1..3488227f8fb8 100644
--- a/sys/kern/vfs_aio.c
+++ b/sys/kern/vfs_aio.c
@@ -525,7 +525,6 @@ aio_proc_rundown(struct proc *p)
struct aio_liojob *lj, *ljn;
struct aiocblist *aiocbe, *aiocbn;
struct file *fp;
- struct filedesc *fdp;
struct socket *so;
ki = p->p_aioinfo;
@@ -544,24 +543,12 @@ aio_proc_rundown(struct proc *p)
* Move any aio ops that are waiting on socket I/O to the normal job
* queues so they are cleaned up with any others.
*/
- fdp = p->p_fd;
-
s = splnet();
for (aiocbe = TAILQ_FIRST(&ki->kaio_sockqueue); aiocbe; aiocbe =
aiocbn) {
aiocbn = TAILQ_NEXT(aiocbe, plist);
- fp = fdp->fd_ofiles[aiocbe->uaiocb.aio_fildes];
-
- /*
- * Under some circumstances, the aio_fildes and the file
- * structure don't match. This would leave aiocbe's in the
- * TAILQ associated with the socket and cause a panic later.
- *
- * Detect and fix.
- */
- if ((fp == NULL) || (fp != aiocbe->fd_file))
- fp = aiocbe->fd_file;
- if (fp) {
+ fp = aiocbe->fd_file;
+ if (fp != NULL) {
so = (struct socket *)fp->f_data;
TAILQ_REMOVE(&so->so_aiojobq, aiocbe, list);
if (TAILQ_EMPTY(&so->so_aiojobq)) {
@@ -683,14 +670,12 @@ aio_selectjob(struct aiothreadlist *aiop)
static void
aio_process(struct aiocblist *aiocbe)
{
- struct filedesc *fdp;
struct thread *td;
struct proc *mycp;
struct aiocb *cb;
struct file *fp;
struct uio auio;
struct iovec aiov;
- unsigned int fd;
int cnt;
int error;
int oublock_st, oublock_end;
@@ -699,16 +684,7 @@ aio_process(struct aiocblist *aiocbe)
td = curthread;
mycp = td->td_proc;
cb = &aiocbe->uaiocb;
-
- fdp = mycp->p_fd;
- fd = cb->aio_fildes;
- fp = fdp->fd_ofiles[fd];
-
- if ((fp == NULL) || (fp != aiocbe->fd_file)) {
- cb->_aiocb_private.error = EBADF;
- cb->_aiocb_private.status = -1;
- return;
- }
+ fp = aiocbe->fd_file;
aiov.iov_base = (void *)(uintptr_t)cb->aio_buf;
aiov.iov_len = cb->aio_nbytes;
@@ -888,17 +864,6 @@ aio_daemon(void *uproc)
if (tmpvm != myvm) {
vmspace_free(tmpvm);
}
-
- /*
- * Disassociate from previous clients file
- * descriptors, and associate to the new clients
- * descriptors. Note that the daemon doesn't
- * need to worry about its orginal descriptors,
- * because they were originally freed.
- */
- if (mycp->p_fd)
- fdfree(td);
- mycp->p_fd = fdshare(userp);
curcp = userp;
}
@@ -997,13 +962,6 @@ aio_daemon(void *uproc)
/* Remove our vmspace reference. */
vmspace_free(tmpvm);
- /*
- * Disassociate from the user process's file
- * descriptors.
- */
- if (mycp->p_fd)
- fdfree(td);
- mycp->p_fd = NULL;
curcp = mycp;
}