diff options
author | bubulle <bubulle@alioth.debian.org> | 2012-12-12 21:11:47 +0000 |
---|---|---|
committer | bubulle <bubulle@alioth.debian.org> | 2012-12-12 21:11:47 +0000 |
commit | 63f07bb10f08040c39530bdc6aaea46c7c0ac9dd (patch) | |
tree | 72e23ab4ded614b11b21fb13aea9f8eb58727a65 /source3/modules/vfs_aio_pthread.c | |
parent | 2cf876031f5616a1de04777c978d7847887b45ac (diff) | |
download | samba-63f07bb10f08040c39530bdc6aaea46c7c0ac9dd.tar.gz |
Load samba-3.6.10 into branches/samba/upstream.upstream/3.6.10
git-svn-id: svn://svn.debian.org/svn/pkg-samba/branches/samba/upstream@4179 fc4039ab-9d04-0410-8cac-899223bdd6b0
Diffstat (limited to 'source3/modules/vfs_aio_pthread.c')
-rw-r--r-- | source3/modules/vfs_aio_pthread.c | 58 |
1 files changed, 41 insertions, 17 deletions
diff --git a/source3/modules/vfs_aio_pthread.c b/source3/modules/vfs_aio_pthread.c index ceef822d00..662781126e 100644 --- a/source3/modules/vfs_aio_pthread.c +++ b/source3/modules/vfs_aio_pthread.c @@ -74,6 +74,7 @@ static bool init_aio_threadpool(struct vfs_handle_struct *handle) struct fd_event *sock_event = NULL; int ret = 0; int num_threads; + int fd; if (pool) { return true; @@ -85,9 +86,14 @@ static bool init_aio_threadpool(struct vfs_handle_struct *handle) errno = ret; return false; } + + fd = pthreadpool_signal_fd(pool); + + set_blocking(fd, false); + sock_event = tevent_add_fd(server_event_context(), NULL, - pthreadpool_signal_fd(pool), + fd, TEVENT_FD_READ, aio_pthread_handle_completion, NULL); @@ -290,25 +296,43 @@ static void aio_pthread_handle_completion(struct event_context *event_ctx, return; } - ret = pthreadpool_finished_job(pool, &jobid); - if (ret) { - smb_panic("aio_pthread_handle_completion"); - return; - } + while (true) { + ret = pthreadpool_finished_job(pool, &jobid); - pd = find_private_data_by_jobid(jobid); - if (pd == NULL) { - DEBUG(1, ("aio_pthread_handle_completion cannot find jobid %d\n", - jobid)); - return; - } + if (ret == EINTR || ret == EAGAIN) { + return; + } +#ifdef EWOULDBLOCK + if (ret == EWOULDBLOCK) { + return; + } +#endif - aio_ex = (struct aio_extra *)pd->aiocb->aio_sigevent.sigev_value.sival_ptr; - smbd_aio_complete_aio_ex(aio_ex); + if (ret == ECANCELED) { + return; + } - DEBUG(10,("aio_pthread_handle_completion: jobid %d completed\n", - jobid )); - TALLOC_FREE(aio_ex); + if (ret) { + smb_panic("aio_pthread_handle_completion"); + return; + } + + pd = find_private_data_by_jobid(jobid); + if (pd == NULL) { + DEBUG(1, ("aio_pthread_handle_completion cannot find " + "jobid %d\n", jobid)); + return; + } + + aio_ex = (struct aio_extra *) + pd->aiocb->aio_sigevent.sigev_value.sival_ptr; + + smbd_aio_complete_aio_ex(aio_ex); + + DEBUG(10,("aio_pthread_handle_completion: jobid %d " + "completed\n", jobid )); + TALLOC_FREE(aio_ex); + } } /************************************************************************ |