[PATCH] Add winbind request profiling

Stefan Metzmacher metze at samba.org
Thu Jun 21 14:32:09 UTC 2018


Hi Volker,

if it's ok for you that I squash the attached patch, I'll
add this to my tevent impersonation tree and make it part of
a combined tevent 0.9.37. I'll also take the torture test,
but will defer reviewing the winbindd changes. They can be reviewed
by someone else if I don't find the time tomorrow and go in
once 0.9.37 is in master.

Thanks!
metze

Am 20.06.2018 um 16:01 schrieb Volker Lendecke via samba-technical:
> Hi!
> 
> Attached find a patchset that allows profiling of tevent_req. The
> first application of this is in the winbind parent, see the last
> commit for a sample output.
> 
> Review appreciated!
> 
> Thanks, Volker
> 

-------------- next part --------------
From b16a3474a3bbd110b320663f397f343f5c06208e Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Thu, 21 Jun 2018 15:48:09 +0200
Subject: [PATCH] SQUASH try harder to get profile parent Signed-off-by: Stefan
 Metzmacher <metze at samba.org>

---
 lib/tevent/tevent.h     |  4 ++--
 lib/tevent/tevent_req.c | 12 +++++++++++-
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/lib/tevent/tevent.h b/lib/tevent/tevent.h
index 76622830d6af..af1fead6c9fc 100644
--- a/lib/tevent/tevent.h
+++ b/lib/tevent/tevent.h
@@ -1356,8 +1356,8 @@ void tevent_req_received(struct tevent_req *req);
  * tevent_req. subreqs are chained by walking up the talloc_parent
  * hierarchy at a subreq's tevent_req_create. This means to get the
  * profiling chain right the subreq that needs to be profiled as part
- * of this tevent_req's profile must be a talloc child of the requests
- * state variable.
+ * of this tevent_req's profile would typically be a talloc child of the requests
+ * state variable. But a grandchild is also possible.
  *
  * @param[in] req The request to do tracing for
  *
diff --git a/lib/tevent/tevent_req.c b/lib/tevent/tevent_req.c
index 5b57fea814ea..3d1eeb91a4af 100644
--- a/lib/tevent/tevent_req.c
+++ b/lib/tevent/tevent_req.c
@@ -65,6 +65,7 @@ struct tevent_req *_tevent_req_create(TALLOC_CTX *mem_ctx,
 				    const char *location)
 {
 	struct tevent_req *req;
+	void *parent_ptr;
 	struct tevent_req *parent;
 	void **ppdata = (void **)pdata;
 	void *data;
@@ -104,7 +105,16 @@ struct tevent_req *_tevent_req_create(TALLOC_CTX *mem_ctx,
 
 	talloc_set_destructor(req, tevent_req_destructor);
 
-	parent = talloc_get_type(talloc_parent(mem_ctx), struct tevent_req);
+	parent_ptr = talloc_parent(mem_ctx);
+	parent = talloc_get_type(parent_ptr, struct tevent_req);
+	if (parent_ptr != parent) {
+		/*
+		 * Try to catch the cases of requests with multiple
+		 * subrequests.
+		 */
+		parent_ptr = talloc_parent(parent_ptr);
+		parent = talloc_get_type(parent_ptr, struct tevent_req);
+	}
 	if ((parent != NULL) && (parent->internal.profile != NULL)) {
 		bool ok = tevent_req_set_profile(req);
 
-- 
2.17.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20180621/2e825ed4/signature.sig>


More information about the samba-technical mailing list