[SCM] Samba Shared Repository - branch master updated
Volker Lendecke
vlendec at samba.org
Sat Mar 31 07:26:03 MDT 2012
The branch, master has been updated
via 0aacdbf s3-aio-fork: Fix a segfault in vfs_aio_fork
via 7f7c2d7 s3-aio-fork: Fix aio_suspend event hierarchy
via aef8698 s3-aio-fork: Fix an alignment warning on OS/X
from 7d3c26e Make sure we claim that a DACL or SACL is present if the SD says so
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 0aacdbfada46329e0ad9dacfa90041a1c7dbf3e8
Author: Volker Lendecke <vl at samba.org>
Date: Sat Mar 31 13:37:20 2012 +0200
s3-aio-fork: Fix a segfault in vfs_aio_fork
aio_suspend does not signal the main process with a signal, it just waits. The
aio_fork module does not use the signal at all, it directly calls back into the
main smbd by calling smbd_aio_complete_aio_ex. This is an abstraction
violation, but the alternative would have been to use signals where they are
not needed. However, in wait_for_aio_completion this bites us: With aio_fork we
call handle_aio_completed twice on the same aio_ex struct: Once from the call
to handle_aio_completion within the aio_fork module and once from the code in
wait_for_aio_completion.
This patch fixes it in a pretty bad way by introducing flag variables and more
state. But the mid-term plan is to replace the posix aio calls from the vfs and
do pread_send/recv and pwrite_send/recv at the vfs layer, so this will
significantly change anyway.
Thanks to Kirill Malkin <kirill.malkin at starboardstorage.com> for reporting this
crash!
Autobuild-User: Volker Lendecke <vl at samba.org>
Autobuild-Date: Sat Mar 31 15:25:55 CEST 2012 on sn-devel-104
commit 7f7c2d721d1e336a86b29fecc81f5c0e28d105dc
Author: Volker Lendecke <vl at samba.org>
Date: Sat Mar 31 13:34:42 2012 +0200
s3-aio-fork: Fix aio_suspend event hierarchy
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.
commit aef86982b845072d8624294f5c557eb315740467
Author: Volker Lendecke <vl at samba.org>
Date: Sat Mar 31 10:37:15 2012 +0200
s3-aio-fork: Fix an alignment warning on OS/X
-----------------------------------------------------------------------
Summary of changes:
source3/modules/vfs_aio_fork.c | 36 ++++++++++++++++++------------------
1 files changed, 18 insertions(+), 18 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/modules/vfs_aio_fork.c b/source3/modules/vfs_aio_fork.c
index 27f7116..fa3db93 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 {
@@ -165,7 +167,7 @@ static ssize_t read_fd(int fd, void *ptr, size_t nbytes, int *recvfd)
errno = EINVAL;
return -1;
}
- *recvfd = *((int *) CMSG_DATA(cmptr));
+ memcpy(recvfd, CMSG_DATA(cmptr), sizeof(*recvfd));
} else {
*recvfd = -1; /* descriptor was not passed */
}
@@ -203,7 +205,7 @@ static ssize_t write_fd(int fd, void *ptr, size_t nbytes, int sendfd)
cmptr->cmsg_len = CMSG_LEN(sizeof(int));
cmptr->cmsg_level = SOL_SOCKET;
cmptr->cmsg_type = SCM_RIGHTS;
- *((int *) CMSG_DATA(cmptr)) = sendfd;
+ memcpy(CMSG_DATA(cmptr), &sendfd, sizeof(sendfd));
#else
ZERO_STRUCT(msg);
msg.msg_accrights = (caddr_t) &sendfd;
@@ -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);
@@ -827,6 +833,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,18 +849,16 @@ 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);
+ event = event_add_fd(ev,
+ frame,
+ child->sockfd,
+ EVENT_FD_READ,
+ handle_aio_completion,
+ child);
- child->sock_event = event_add_fd(ev,
- child,
- child->sockfd,
- EVENT_FD_READ,
- handle_aio_completion,
- child);
+ child->called_from_suspend = true;
- while (1) {
+ while (!child->completion_done) {
if (tevent_loop_once(ev) == -1) {
goto out;
}
@@ -861,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;
- }
}
}
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list