[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-2324-g3014753

Volker Lendecke vlendec at samba.org
Mon Jun 15 15:27:35 GMT 2009


The branch, master has been updated
       via  3014753ebebd332710e7d5ad75c868f34f00dff6 (commit)
      from  ed5c270b750ce736155a4e02fc7d2c51fe6b8c2a (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 3014753ebebd332710e7d5ad75c868f34f00dff6
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Jun 15 15:43:19 2009 +0200

    Fix the posixtimedlock test
    
    The previous version depended on the fact that smb_raw_lock_send just queued
    stuff. This changed with ebf5523b6e2ae0.

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

Summary of changes:
 source4/torture/raw/samba3misc.c |   61 +++++++++++++++++++++++++++++++++-----
 1 files changed, 53 insertions(+), 8 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c
index c4c790c..4ec8acc 100644
--- a/source4/torture/raw/samba3misc.c
+++ b/source4/torture/raw/samba3misc.c
@@ -669,6 +669,35 @@ bool torture_samba3_caseinsensitive(struct torture_context *torture)
 	return ret;
 }
 
+static void close_locked_file(struct tevent_context *ev,
+			      struct tevent_timer *te,
+			      struct timeval now,
+			      void *private_data)
+{
+	int *pfd = (int *)private_data;
+
+	TALLOC_FREE(te);
+
+	if (*pfd != -1) {
+		close(*pfd);
+		*pfd = -1;
+	}
+}
+
+struct lock_result_state {
+	NTSTATUS status;
+	bool done;
+};
+
+static void receive_lock_result(struct smbcli_request *req)
+{
+	struct lock_result_state *state =
+		(struct lock_result_state *)req->async.private_data;
+
+	state->status = smbcli_request_simple_recv(req);
+	state->done = true;
+}
+
 /*
  * Check that Samba3 correctly deals with conflicting posix byte range locks
  * on an underlying file
@@ -695,6 +724,9 @@ bool torture_samba3_posixtimedlock(struct torture_context *tctx)
 	union smb_lock io;
 	struct smb_lock_entry lock_entry;
 	struct smbcli_request *req;
+	struct lock_result_state lock_result;
+
+	struct tevent_timer *te;
 
 	if (!torture_open_connection(&cli, tctx, 0)) {
 		ret = false;
@@ -799,17 +831,30 @@ bool torture_samba3_posixtimedlock(struct torture_context *tctx)
 		goto done;
 	}
 
-	/*
-	 * Ship the async timed request to the server
-	 */
-	event_loop_once(req->transport->socket->event.ctx);
-	msleep(500);
+	lock_result.done = false;
+	req->async.fn = receive_lock_result;
+	req->async.private_data = &lock_result;
 
-	close(fd);
+	te = tevent_add_timer(req->transport->socket->event.ctx,
+			      tctx, timeval_current_ofs(1, 0),
+			      close_locked_file, &fd);
+	if (te == NULL) {
+		torture_warning(tctx, "tevent_add_timer failed\n");
+		ret = false;
+		goto done;
+	}
 
-	status = smbcli_request_simple_recv(req);
+	while ((fd != -1) || (!lock_result.done)) {
+		if (tevent_loop_once(req->transport->socket->event.ctx)
+		    == -1) {
+			torture_warning(tctx, "tevent_loop_once failed: %s\n",
+					strerror(errno));
+			ret = false;
+			goto done;
+		}
+	}
 
-	CHECK_STATUS(status, NT_STATUS_OK);
+	CHECK_STATUS(lock_result.status, NT_STATUS_OK);
 
  done:
 	if (fnum != -1) {


-- 
Samba Shared Repository


More information about the samba-cvs mailing list