summaryrefslogtreecommitdiff
path: root/source3/modules/vfs_aio_fork.c
diff options
context:
space:
mode:
authorChristian Ambach <christian.ambach@de.ibm.com>2011-01-13 16:04:36 +0100
committerVolker Lendecke <vlendec@samba.org>2011-01-14 09:57:18 +0100
commit70b4c08c813af5d45e3b4af0503f851f52744381 (patch)
tree53575677863bbb631836b94a8ac915fc10d3f239 /source3/modules/vfs_aio_fork.c
parentfa07208cee41b51d68144e2fe14d274fdb8f4873 (diff)
downloadsamba-70b4c08c813af5d45e3b4af0503f851f52744381.tar.gz
samba-70b4c08c813af5d45e3b4af0503f851f52744381.tar.bz2
samba-70b4c08c813af5d45e3b4af0503f851f52744381.zip
s3:vfs aio_fork children do not go away
on RHEL 5.5, recvmsg() does not return when it is reading from the socket and the process on the other side closes its connection. This left aio children around that should have gone already and were just wasting system resources. This patch makes the child go away by writing invalid data to it so that the child exits. Pair-Programmed-With: Volker Lendecke <vl@samba.org> Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Fri Jan 14 09:57:18 CET 2011 on sn-devel-104
Diffstat (limited to 'source3/modules/vfs_aio_fork.c')
-rw-r--r--source3/modules/vfs_aio_fork.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/source3/modules/vfs_aio_fork.c b/source3/modules/vfs_aio_fork.c
index fc5b7f1941..0d515130ee 100644
--- a/source3/modules/vfs_aio_fork.c
+++ b/source3/modules/vfs_aio_fork.c
@@ -422,7 +422,18 @@ static void handle_aio_completion(struct event_context *event_ctx,
static int aio_child_destructor(struct aio_child *child)
{
+ char c=0;
+
SMB_ASSERT((child->aiocb == NULL) || child->cancelled);
+
+ DEBUG(10, ("aio_child_destructor: removing child %d on fd %d\n",
+ child->pid, child->sockfd));
+
+ /*
+ * closing the sockfd makes the child not return from recvmsg() on RHEL
+ * 5.5 so instead force the child to exit by writing bad data to it
+ */
+ write(child->sockfd, &c, sizeof(c));
close(child->sockfd);
DLIST_REMOVE(child->list->children, child);
return 0;
@@ -486,7 +497,8 @@ static NTSTATUS create_aio_child(struct smbd_server_connection *sconn,
aio_child_loop(result->sockfd, result->map);
}
- DEBUG(10, ("Child %d created\n", result->pid));
+ DEBUG(10, ("Child %d created with sockfd %d\n",
+ result->pid, fdpair[0]));
result->sockfd = fdpair[0];
close(fdpair[1]);