[PATCH] Don't send MSG_WINBIND_ONLINE to idmap_child() in any child process

boyang boyang at suse.de
Wed Jan 14 07:04:15 GMT 2009


Jeremy Allison wrote:
> On Tue, Jan 13, 2009 at 05:59:39PM +0800, boyang wrote:
>   
>> Hi, everyone:
>>      If the trusted domain cannot go online, fork_child_dc_connect()
>> will be invoked periodically to fork() one child process, trying to
>> connect to DC.  look, fork_child_dc_connect() ---> getdcs() --->
>> get_dc_name_via_netlogon() ---> cm_connect_netlogon() --->
>> init_dc_connection() ---> cm_open_connection ---> set_domain_online(),
>> here send MSG_WINBIND_ONLINE to idmap_child(). It causes
>> MSG_WINBIND_ONLINE being sent to idmap_child() periodically, which cause
>> idmap child to fork and connect to the primary domain'DC even primary
>> domain is already online. :-)  It is very expensive, we must not want to
>> do that....
>>
>> Please review the patches!
>>     
>
> Ok, I've reviewed this very carefully, and I think you're
> correct in this. I've broadened your patch slightly to add
> code to null out the pid on all children after fork, as no
> child should be sending messages to each other, it should
> always go through the parent. Can you check this patch (designed
> for 3-2-test) out and let me know if it works for you (should
> do - it's a simple change to your code).
>   
I am thinking if we can decrease attempts to connect to DC further.
Currently, both the parent and the child are trying to connect to DCs
periodically, if domain cannot be brought online. Why not we just try to
connect to DCs in parent, and if the parent can bring the DC online, it
sends MSG_WINBIND_ONLINE to child? And when domain in child process goes
offline, child sends MSG_WINBIND_OFFLINE to parent. This is not
difficult, we can add one global variable and set it to true in parent
process, then set it to false after fork. Then, all
set_domain_online_request() can be eliminated from fork_domain_child().

If we are in parent, set_domain_online() will sent ONLINE message to
child of the domain. set_domain_offline() just set domain offline, don't
set any message to child.

If we are in child, set_domain_online just set the domain online, don't
sent any messages to parent. set_domain_offline() set the domain offline
and sends OFFLINE message to parent.

Then, only parent tries to connect to DCs periodically.

With this, we can decrease the attempts to connect to DCs by half when
network is unreachable.

If this is worth to do, I'll do it. :-)
> Once I get confirmation I'll commit to all branhes under
> your name, thanks !
>
> Jeremy.
>
>   
-------------- next part --------------
A non-text attachment was scrubbed...
Name: boyang.vcf
Type: text/x-vcard
Size: 187 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20090114/4f32d082/boyang.vcf


More information about the samba-technical mailing list