s3-aio-fork: Fix aio_suspend event hierarchy
authorVolker Lendecke <vl@samba.org>
Sat, 31 Mar 2012 11:34:42 +0000 (13:34 +0200)
committerVolker Lendecke <vl@samba.org>
Sat, 31 Mar 2012 11:51:17 +0000 (13:51 +0200)
We end up here multiple times. There's no real point putting the events into
the child struct, at the end of this routine we need to free them anyway.

source3/modules/vfs_aio_fork.c

index 16a1301c5e3c8a7e5ba12d32ece527e948e8315c..30d4b93ee7f27e814022c4fb7c136773e853cdfa 100644 (file)
@@ -827,6 +827,8 @@ static int aio_fork_suspend(struct vfs_handle_struct *handle,
                 */
 
                for (child = children->children; child != NULL; child = child->next) {
+                       struct tevent_fd *event;
+
                        if (child->aiocb == NULL) {
                                continue;
                        }
@@ -841,16 +843,12 @@ static int aio_fork_suspend(struct vfs_handle_struct *handle,
                                continue;
                        }
 
-                       /* We're never using this event on the
-                        * main event context again... */
-                       TALLOC_FREE(child->sock_event);
-
-                       child->sock_event = event_add_fd(ev,
-                                               child,
-                                               child->sockfd,
-                                               EVENT_FD_READ,
-                                               handle_aio_completion,
-                                               child);
+                       event = event_add_fd(ev,
+                                            frame,
+                                            child->sockfd,
+                                            EVENT_FD_READ,
+                                            handle_aio_completion,
+                                            child);
 
                        while (1) {
                                if (tevent_loop_once(ev) == -1) {