[SCM] Samba Shared Repository - branch v3-6-test updated

Karolin Seeger kseeger at samba.org
Tue Jun 7 01:14:37 MDT 2011


The branch, v3-6-test has been updated
       via  13eb6f4 WHATSNEW: Add another change since rc1.
       via  92248f6 Fix bug #8197 - winbind does not properly detect when a DC connection is dead.
       via  017f84a Add the same fix to the S3 event backend as the previous commit added to the tevent poll backend.
       via  4da2f8a Fix the poll() backend to correctly respond to POLLHUP|POLLERR returns on a fd selected for TEVENT_FD_WRITE only.
      from  df4a86e WHATSNEW: Update changes since 3.6.0rc1.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test


- Log -----------------------------------------------------------------
commit 13eb6f4cd91d0be1208523b47a4ac7c8d9bd91d5
Author: Karolin Seeger <kseeger at samba.org>
Date:   Tue Jun 7 09:15:38 2011 +0200

    WHATSNEW: Add another change since rc1.
    
    Karolin

commit 92248f6e51f1e46de8c1a1304b2d48914f21e841
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Jun 3 10:22:44 2011 -0700

    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.
    
    Autobuild-User: Jeremy Allison <jra at samba.org>
    Autobuild-Date: Mon Jun  6 21:53:16 CEST 2011 on sn-devel-104
    (cherry picked from commit 0efcc94fb834aeb03e8edc3034aa0cdeefdc0985)

commit 017f84a07dedf700c25da253ac7247633b616056
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Jun 3 12:55:19 2011 -0700

    Add the same fix to the S3 event backend as the previous commit added to the tevent poll backend.
    
    Metze please check !
    
    Autobuild-User: Jeremy Allison <jra at samba.org>
    Autobuild-Date: Sat Jun  4 00:27:37 CEST 2011 on sn-devel-104
    (cherry picked from commit 3c9b3b2befc524f21c59f46ea9be1602b4b1bfe8)

commit 4da2f8a8c578568d1e9a4770166c46240fce6664
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Jun 3 12:31:11 2011 -0700

    Fix the poll() backend to correctly respond to POLLHUP|POLLERR returns on a fd selected for TEVENT_FD_WRITE only.
    
    Don't trigger the write handler and remove the POLLOUT flag for this fd. Report errors on TEVENT_FD_READ requests only.
    Metze please check !
    
    Jeremy.
    
    Autobuild-User: Jeremy Allison <jra at samba.org>
    Autobuild-Date: Fri Jun  3 22:53:52 CEST 2011 on sn-devel-104
    (cherry picked from commit dbcdf3e39c359241b743a9455ae695e14a30caa9)

-----------------------------------------------------------------------

Summary of changes:
 WHATSNEW.txt               |    1 +
 lib/async_req/async_sock.c |   38 ++++++++++++++++++++++++++++++++------
 lib/tevent/tevent_poll.c   |   14 +++++++++++++-
 source3/lib/events.c       |   15 ++++++++++++++-
 4 files changed, 60 insertions(+), 8 deletions(-)


Changeset truncated at 500 lines:

diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 2827bbe..ec1d3fa 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -268,6 +268,7 @@ o   Jeremy Allison <jra at samba.org>
     * BUG 8163: Fix our asn.1 parser to handle negative numbers.
     * BUG 8191: Split the ACE flag mapping between nfs4 and Windows into two
       separate functions.
+    * BUG 8197: Winbind does not properly detect when a DC connection is dead.
 
 
 o   Christian Ambach <ambi at samba.org>
diff --git a/lib/async_req/async_sock.c b/lib/async_req/async_sock.c
index 7ea66f5..2c90b6d 100644
--- a/lib/async_req/async_sock.c
+++ b/lib/async_req/async_sock.c
@@ -385,6 +385,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);
@@ -412,10 +413,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;
@@ -461,8 +460,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++) {
diff --git a/lib/tevent/tevent_poll.c b/lib/tevent/tevent_poll.c
index 712255b..0b782e9 100644
--- a/lib/tevent/tevent_poll.c
+++ b/lib/tevent/tevent_poll.c
@@ -233,7 +233,19 @@ static int poll_event_loop_poll(struct tevent_context *ev,
 
 			pfd = &poll_ev->fds[pfd_idx];
 
-			if (pfd->revents & (POLLIN|POLLHUP|POLLERR)) {
+			if (pfd->revents & (POLLHUP|POLLERR)) {
+				/* If we only wait for TEVENT_FD_WRITE, we
+				   should not tell the event handler about it,
+				   and remove the writable flag, as we only
+				   report errors when waiting for read events
+				   to match the select behavior. */
+				if (!(fde->flags & TEVENT_FD_READ)) {
+					TEVENT_FD_NOT_WRITEABLE(fde);
+					continue;
+				}
+				flags |= TEVENT_FD_READ;
+			}
+			if (pfd->revents & POLLIN) {
 				flags |= TEVENT_FD_READ;
 			}
 			if (pfd->revents & POLLOUT) {
diff --git a/source3/lib/events.c b/source3/lib/events.c
index 9ff1488..fbe3db9 100644
--- a/source3/lib/events.c
+++ b/source3/lib/events.c
@@ -258,7 +258,20 @@ bool run_events_poll(struct tevent_context *ev, int pollrtn,
 			return false;
 		}
 
-		if (pfd->revents & (POLLIN|POLLHUP|POLLERR)) {
+		if (pfd->revents & (POLLHUP|POLLERR)) {
+			/* If we only wait for EVENT_FD_WRITE, we
+			   should not tell the event handler about it,
+			   and remove the writable flag, as we only
+			   report errors when waiting for read events
+			   to match the select behavior. */
+			if (!(fde->flags & EVENT_FD_READ)) {
+				EVENT_FD_NOT_WRITEABLE(fde);
+				continue;
+			}
+			flags |= EVENT_FD_READ;
+		}
+
+		if (pfd->revents & POLLIN) {
 			flags |= EVENT_FD_READ;
 		}
 		if (pfd->revents & POLLOUT) {


-- 
Samba Shared Repository


More information about the samba-cvs mailing list