s3: Avoid a potential 100% CPU loop in winbindd
commit5fa2370882af9fe14cec2cbbee8246ff71df03fd
authorVolker Lendecke <vl@samba.org>
Fri, 29 Apr 2011 11:00:14 +0000 (29 13:00 +0200)
committerKarolin Seeger <kseeger@samba.org>
Sun, 15 May 2011 18:16:06 +0000 (15 20:16 +0200)
tree67c54a47c04b5b79938cd90b83fed60eef27a8f6
parent37c56f44044c0765af7c49e172fd5bd8b8e67fd0
s3: Avoid a potential 100% CPU loop in winbindd

In the clustering case if ctdb is unhappy, winbindd_reinit_after_fork fails.
This can lead to an endless loop depending on the scheduling of the parent vs
child. Parent forks, child is immediately scheduled and exits. Parent gets
SIGCHLD, parent is then scheduled before it sends the request out to the child.
Parent tries to fork again immediately.

The code before this patch did not really take into account that
reinit_after_fork can fail. The code now sends the result of
winbindd_reinit_after_fork to the parent and the parent only considers the
child alive when it got NT_STATUS_OK.

This was seen in 3.4 winbind. winbind has changed significantly since then, so
it might be possible that this does not happen anymore in exactly this way. But
passing up the status of reinit_after_fork and only consider the child alive
when that's ok is the correct thing to do anyway.

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Fri Apr 29 17:58:19 CEST 2011 on sn-devel-104
(cherry picked from commit df099e66240c7670c9f7b7dcccb1c38216bac3ec)
(cherry picked from commit 59d1c3a296cede628b46edb74693e08e7f388c38)
source3/winbindd/winbindd_dual.c