The Samba-Bugzilla – Attachment 6515 Details for
Bug 8197
winbind does not properly detect when a DC connection is dead
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
git-am fix for 3.6.0
0001-Fix-bug-8197-winbind-does-not-properly-detect-when-a.patch (text/plain), 2.68 KB, created by
Jeremy Allison
on 2011-06-03 17:28:34 UTC
(
hide
)
Description:
git-am fix for 3.6.0
Filename:
MIME Type:
Creator:
Jeremy Allison
Created:
2011-06-03 17:28:34 UTC
Size:
2.68 KB
patch
obsolete
>From 5b518666160f09b58a7e6ae11ff20c96ce29714c Mon Sep 17 00:00:00 2001 >From: Jeremy Allison <jra@samba.org> >Date: Fri, 3 Jun 2011 10:22:44 -0700 >Subject: [PATCH] Fix bug #8197 - winbind does not properly detect when a DC connection is dead. > >Only waiting for writability doesn't get fd errors back with poll. >So always begin by selecting for readability, and if we get it then >see if bytes were available to read or it really is an error condition. > >If bytes were available, remove the select on read as we know we >will retrieve the error when we've finished writing and start >reading the reply (or the write will timeout or fail). > >Metze and Volker please check. >--- > lib/async_req/async_sock.c | 38 ++++++++++++++++++++++++++++++++------ > 1 files changed, 32 insertions(+), 6 deletions(-) > >diff --git a/lib/async_req/async_sock.c b/lib/async_req/async_sock.c >index 86053d9..dfb1a1c 100644 >--- a/lib/async_req/async_sock.c >+++ b/lib/async_req/async_sock.c >@@ -386,6 +386,7 @@ struct writev_state { > int count; > size_t total_size; > uint16_t flags; >+ bool err_on_readability; > }; > > static void writev_trigger(struct tevent_req *req, void *private_data); >@@ -413,10 +414,8 @@ struct tevent_req *writev_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, > if (state->iov == NULL) { > goto fail; > } >- state->flags = TEVENT_FD_WRITE; >- if (err_on_readability) { >- state->flags |= TEVENT_FD_READ; >- } >+ state->flags = TEVENT_FD_WRITE|TEVENT_FD_READ; >+ state->err_on_readability = err_on_readability; > > if (queue == NULL) { > struct tevent_fd *fde; >@@ -462,8 +461,35 @@ static void writev_handler(struct tevent_context *ev, struct tevent_fd *fde, > to_write = 0; > > if ((state->flags & TEVENT_FD_READ) && (flags & TEVENT_FD_READ)) { >- tevent_req_error(req, EPIPE); >- return; >+ int ret, value; >+ >+ if (state->err_on_readability) { >+ /* Readable and the caller wants an error on read. */ >+ tevent_req_error(req, EPIPE); >+ return; >+ } >+ >+ /* Might be an error. Check if there are bytes to read */ >+ ret = ioctl(state->fd, FIONREAD, &value); >+ /* FIXME - should we also check >+ for ret == 0 and value == 0 here ? */ >+ if (ret == -1) { >+ /* There's an error. */ >+ tevent_req_error(req, EPIPE); >+ return; >+ } >+ /* A request for TEVENT_FD_READ will succeed from now and >+ forevermore until the bytes are read so if there was >+ an error we'll wait until we do read, then get it in >+ the read callback function. Until then, remove TEVENT_FD_READ >+ from the flags we're waiting for. */ >+ state->flags &= ~TEVENT_FD_READ; >+ TEVENT_FD_NOT_READABLE(fde); >+ >+ /* If not writable, we're done. */ >+ if (!(flags & TEVENT_FD_WRITE)) { >+ return; >+ } > } > > for (i=0; i<state->count; i++) { >-- >1.7.3.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
metze
:
review+
Actions:
View
Attachments on
bug 8197
:
6510
| 6515 |
6528
|
6537
|
6538