[SCM] Samba Shared Repository - branch v3-6-test updated

Karolin Seeger kseeger at samba.org
Tue Aug 30 13:05:47 MDT 2011


The branch, v3-6-test has been updated
       via  2f0a5b4 s3: Use sys_read in fork_domain_child
       via  11ab2d6 s3: Use sys_write in fork_domain_child
       via  b181fe9 s3: Fix a winbind race leading to 100% CPU
      from  e66a1f0 s3: Fix the build of vfs_aixacl2.c

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test


- Log -----------------------------------------------------------------
commit 2f0a5b477f58378c3505631d15b422057b037efe
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Aug 26 11:38:21 2011 +0200

    s3: Use sys_read in fork_domain_child
    
    I've seen
    
    [2011/08/26 01:44:10.872057,  1] winbindd/winbindd_dual.c:1336(fork_domain_child)
      fork_domain_child: Could not read child status: nread=-1, error=Interrupted system call
    
    on a customer box. Not good.
    (cherry picked from commit 964e809ce2069ad888e0fb12dfe51bac5a461508)
    
    The last 3 patches address bug #8409 (f7d97868 created a new race condition).

commit 11ab2d68023dbfd9089a7e2ec2d36ef4f1f7974e
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Aug 26 11:39:41 2011 +0200

    s3: Use sys_write in fork_domain_child
    
    Counterpart for last checkin. A lot less likely, but not impossible in a child.
    
    Autobuild-User: Volker Lendecke <vlendec at samba.org>
    Autobuild-Date: Fri Aug 26 13:14:27 CEST 2011 on sn-devel-104
    (cherry picked from commit e0e3d215b1902ecbeb3d469af9a196856711921e)

commit b181fe9ec50ff63074b217143b6daa5cddfb8853
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Aug 26 16:54:18 2011 +0200

    s3: Fix a winbind race leading to 100% CPU
    
    This fixes a race condition that leads to the winbindd_children list becoming
    corrupted. It happens when on a busy winbind SIGCHLD is a bit late.
    
    Imagine a winbind with multiple requests in the queue for a single child. Child
    dies, and before the SIGCHLD handler is called we find the socket to be dead.
    wb_child_request_done is called, receiving an error from wb_simple_trans_recv.
    It closes the socket. Then immediately the wb_child_request_trigger will do
    another fork_domain_child before the signal handler is called. This means that
    we do another fork_domain_child, we have child->sock==-1 at this point.
    fork_domain_child will do a DLIST_ADD(winbindd_children, child) a second time
    where the child is already part of that list. This corrupts the list. Then the
    signal handler kicks in, spinning in
    
    for (child = winbindd_children; child != NULL; child = child->next) {
    
    forever. Not good. This patch makes sure that both conditions (sock==-1 and not
    part of the list) for a winbindd_child struct match up.
    
    Autobuild-User: Volker Lendecke <vlendec at samba.org>
    Autobuild-Date: Fri Aug 26 18:51:24 CEST 2011 on sn-devel-104
    (cherry picked from commit ed058f4dc3e059967f3c0538bc220866e9c63588)

-----------------------------------------------------------------------

Summary of changes:
 source3/winbindd/winbindd_dual.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c
index 1078f8d..f4edf1d 100644
--- a/source3/winbindd/winbindd_dual.c
+++ b/source3/winbindd/winbindd_dual.c
@@ -43,6 +43,8 @@
 extern bool override_logfile;
 extern struct winbindd_methods cache_methods;
 
+static struct winbindd_child *winbindd_children = NULL;
+
 /* Read some data from a client connection */
 
 static NTSTATUS child_read_request(struct winbindd_cli_state *state)
@@ -171,6 +173,7 @@ static void wb_child_request_done(struct tevent_req *subreq)
 		 */
 		close(state->child->sock);
 		state->child->sock = -1;
+		DLIST_REMOVE(winbindd_children, state->child);
 		tevent_req_error(req, err);
 		return;
 	}
@@ -489,8 +492,6 @@ void setup_child(struct winbindd_domain *domain, struct winbindd_child *child,
 	SMB_ASSERT(child->binding_handle != NULL);
 }
 
-static struct winbindd_child *winbindd_children = NULL;
-
 void winbind_child_died(pid_t pid)
 {
 	struct winbindd_child *child;
@@ -1329,7 +1330,7 @@ static bool fork_domain_child(struct winbindd_child *child)
 
 		close(fdpair[0]);
 
-		nread = read(fdpair[1], &status, sizeof(status));
+		nread = sys_read(fdpair[1], &status, sizeof(status));
 		if (nread != sizeof(status)) {
 			DEBUG(1, ("fork_domain_child: Could not read child status: "
 				  "nread=%d, error=%s\n", (int)nread,
@@ -1360,7 +1361,7 @@ static bool fork_domain_child(struct winbindd_child *child)
 
 	status = winbindd_reinit_after_fork(child, child->logfilename);
 
-	nwritten = write(state.sock, &status, sizeof(status));
+	nwritten = sys_write(state.sock, &status, sizeof(status));
 	if (nwritten != sizeof(status)) {
 		DEBUG(1, ("fork_domain_child: Could not write status: "
 			  "nwritten=%d, error=%s\n", (int)nwritten,


-- 
Samba Shared Repository


More information about the samba-cvs mailing list