Author: jmcd Date: 2005-05-31 18:36:38 +0000 (Tue, 31 May 2005) New Revision: 7148
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=7148 Log: Fix #2736: winbind race condition with detecting idle clients winbind idle connection closing logic is getting invoked under high loads for clients which may already have commands in the pipe. This race condition causes clients to fail with NSS_STATUS_UNAVAIL sometimes. We now retry several times hoping (still not guaranteed, though) it will work. Modified: branches/SAMBA_3_0/source/nsswitch/wb_common.c Changeset: Modified: branches/SAMBA_3_0/source/nsswitch/wb_common.c =================================================================== --- branches/SAMBA_3_0/source/nsswitch/wb_common.c 2005-05-31 18:13:25 UTC (rev 7147) +++ branches/SAMBA_3_0/source/nsswitch/wb_common.c 2005-05-31 18:36:38 UTC (rev 7148) @@ -588,12 +588,18 @@ struct winbindd_request *request, struct winbindd_response *response) { - NSS_STATUS status; + NSS_STATUS status = NSS_STATUS_UNAVAIL; + int count = 0; - status = winbindd_send_request(req_type, request); - if (status != NSS_STATUS_SUCCESS) - return(status); - return winbindd_get_response(response); + while ((status == NSS_STATUS_UNAVAIL) && (count < 10)) { + status = winbindd_send_request(req_type, request); + if (status != NSS_STATUS_SUCCESS) + return(status); + status = winbindd_get_response(response); + count += 1; + } + + return status; } /************************************************************************* @@ -606,7 +612,7 @@ BOOL winbind_off( void ) { - static char *s = CONST_DISCARD(char *, WINBINDD_DONT_ENV "=1"); + static char *s = CONST_DISCARD(char *, WINBINDD_DONT_ENV "=1"); return putenv(s) != -1; }