summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/modules/vfs_aio_fork.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/source3/modules/vfs_aio_fork.c b/source3/modules/vfs_aio_fork.c
index 30d4b93ee7..fa3db933a3 100644
--- a/source3/modules/vfs_aio_fork.c
+++ b/source3/modules/vfs_aio_fork.c
@@ -101,6 +101,8 @@ struct aio_child {
bool dont_delete; /* Marked as in use since last cleanup */
bool cancelled;
bool read_cmd;
+ bool called_from_suspend;
+ bool completion_done;
};
struct aio_child_list {
@@ -432,6 +434,10 @@ static void handle_aio_completion(struct event_context *event_ctx,
child->retval.size);
}
+ if (child->called_from_suspend) {
+ child->completion_done = true;
+ return;
+ }
aio_ex = (struct aio_extra *)child->aiocb->aio_sigevent.sigev_value.sival_ptr;
smbd_aio_complete_aio_ex(aio_ex);
TALLOC_FREE(aio_ex);
@@ -850,7 +856,9 @@ static int aio_fork_suspend(struct vfs_handle_struct *handle,
handle_aio_completion,
child);
- while (1) {
+ child->called_from_suspend = true;
+
+ while (!child->completion_done) {
if (tevent_loop_once(ev) == -1) {
goto out;
}
@@ -859,12 +867,6 @@ static int aio_fork_suspend(struct vfs_handle_struct *handle,
errno = EAGAIN;
goto out;
}
-
- /* We set child->aiocb to NULL in our hooked
- * AIO_RETURN(). */
- if (child->aiocb == NULL) {
- break;
- }
}
}
}