s3: Avoid a winbind 100% cpu loop

Stefan (metze) Metzmacher metze at samba.org
Wed Oct 19 00:48:03 MDT 2011


Hi Volker,

> - Log -----------------------------------------------------------------
> commit fbf17489844a5cfc6d1da8c431ce0194ed4c3f72
> Author: Volker Lendecke <vl at samba.org>
> Date:   Tue Oct 18 21:36:44 2011 +0200
> 
>     s3: Avoid a winbind 100% cpu loop
>     
>     When a DC goes down hard, winbind can end up in a 100% CPU loop. The next
>     (small) RPC request to the DC ends up as a trans2 request. If the connection
>     goes down, we end up trying to discard the request via the loop in
>     cli_state_notify_pending(). Because this is a trans2 request,
>     cli_smb_req_unset_pending will not kick in. Thus the pending array will always
>     remain at length 1.
>     
>     Autobuild-User: Volker Lendecke <vlendec at samba.org>
>     Autobuild-Date: Wed Oct 19 01:39:35 CEST 2011 on sn-devel-104
> 
> -----------------------------------------------------------------------
> 
> Summary of changes:
>  source3/libsmb/async_smb.c |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)
> 
> 
> Changeset truncated at 500 lines:
> 
> diff --git a/source3/libsmb/async_smb.c b/source3/libsmb/async_smb.c
> index efeb328..dce1b74 100644
> --- a/source3/libsmb/async_smb.c
> +++ b/source3/libsmb/async_smb.c
> @@ -287,6 +287,14 @@ static void cli_state_notify_pending(struct cli_state *cli, NTSTATUS status)
>  		req = cli->conn.pending[0];
>  		state = tevent_req_data(req, struct cli_smb_state);
>  
> +		if (NT_STATUS_EQUAL(status, NT_STATUS_PIPE_BROKEN)) {
> +			/*
> +			 * We're dead. No point waiting for trans2
> +			 * replies.
> +			 */
> +			state->mid = 0;
> +		}
> +
>  		cli_smb_req_unset_pending(req);

Good catch, thanks!

Is there a reason why you only use state->mid = 0; on PIPE_BROKEN?
As cli_state_notify_pending() calls cli_state_disconnect(), I think we
should
always use state->mid = 0; without looking at the status.

metze

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-cvs/attachments/20111019/63091634/attachment.pgp>


More information about the samba-cvs mailing list