]> sourceware.org Git - systemtap.git/commitdiff
Fix PR15543 by fixing the 'servername' convenience variables in the rpc tapset.
authorDavid Smith <dsmith@redhat.com>
Tue, 28 May 2013 21:42:03 +0000 (16:42 -0500)
committerDavid Smith <dsmith@redhat.com>
Tue, 28 May 2013 21:42:03 +0000 (16:42 -0500)
* tapset/linux/rpc.stp: Handle kernel change that moves the 'cl_server'
  field of the 'rpc_clnt' structure into the 'rpc_xprt' structure.
* tapset/linux/rcu.stp: New file.

tapset/linux/rcu.stp [new file with mode: 0644]
tapset/linux/rpc.stp

diff --git a/tapset/linux/rcu.stp b/tapset/linux/rcu.stp
new file mode 100644 (file)
index 0000000..c990234
--- /dev/null
@@ -0,0 +1,41 @@
+// rcu tapset
+// Copyright (C) 2013 Red Hat
+//
+// This file is part of systemtap, and is free software.  You can
+// redistribute it and/or modify it under the terms of the GNU General
+// Public License (GPL); either version 2, or (at your option) any
+// later version.
+
+%{
+#include <linux/rcupdate.h>
+#ifndef rcu_dereference_check
+#define STAP_ALWAYS_ACQUIRE_RCU_LOCK
+#endif
+%}
+
+function rcu_dereference:long (protected_pointer:long) %{ /* pure */
+    void *protected_pointer = (void *)(long)STAP_ARG_protected_pointer;
+    long fetched_value;
+
+#ifndef STAP_ALWAYS_ACQUIRE_RCU_LOCK
+    int lock_acquired = 0;
+
+    if (! rcu_read_lock_held()) {
+       rcu_read_lock();
+       lock_acquired = 1;
+    }
+#else
+    rcu_read_lock();
+#endif
+
+    fetched_value = (long)rcu_dereference(protected_pointer);
+
+#ifndef STAP_ALWAYS_ACQUIRE_RCU_LOCK
+    if (lock_acquired) {
+       rcu_read_unlock();
+    }
+#else
+    rcu_read_unlock();
+#endif
+    STAP_RETVALUE = fetched_value;
+%}
index 1aff639d305b49c6098c7e265ccacf283e8c7c8e..b3ba4dff73c1e60eabfc734949f4e46f6a6c18ac 100644 (file)
@@ -276,7 +276,9 @@ probe _sunrpc.clnt.create_client.return.rpc_create_client =
 probe sunrpc.clnt.clone_client = kernel.function("rpc_clone_client") !,
        module("sunrpc").function("rpc_clone_client")
 {
-       servername = kernel_string($clnt->cl_server)
+       servername = kernel_string(@choose_defined($clnt->cl_server,
+                                  @cast(rcu_dereference($clnt->cl_xprt),
+                                        "struct rpc_xprt")->servername))
        progname = kernel_string($clnt->cl_protname)
        prog = prog_from_clnt($clnt)
        vers = vers_from_clnt($clnt)
@@ -322,7 +324,9 @@ probe sunrpc.clnt.clone_client.return =
 probe sunrpc.clnt.shutdown_client = kernel.function("rpc_shutdown_client") !,
        module("sunrpc").function("rpc_shutdown_client")
 {
-       servername = kernel_string($clnt->cl_server)
+       servername = kernel_string(@choose_defined($clnt->cl_server,
+                                  @cast(rcu_dereference($clnt->cl_xprt),
+                                        "struct rpc_xprt")->servername))
        progname = kernel_string($clnt->cl_protname)
        prog = prog_from_clnt($clnt)
        vers = vers_from_clnt($clnt)
@@ -392,7 +396,9 @@ probe sunrpc.clnt.bind_new_program =
        kernel.function("rpc_bind_new_program") !,
        module("sunrpc").function("rpc_bind_new_program")
 {
-       servername = kernel_string($old->cl_server)
+       servername = kernel_string(@choose_defined($old->cl_server,
+                                  @cast(rcu_dereference($old->cl_xprt),
+                                        "struct rpc_xprt")->servername))
        old_progname = kernel_string($old->cl_protname)
        old_prog = prog_from_clnt($old)
        old_vers = vers_from_clnt($old)
@@ -431,7 +437,9 @@ probe sunrpc.clnt.bind_new_program.return =
 probe sunrpc.clnt.call_sync = kernel.function("rpc_call_sync") !,
        module("sunrpc").function("rpc_call_sync")
 {
-       servername = kernel_string($clnt->cl_server)
+       servername = kernel_string(@choose_defined($clnt->cl_server,
+                                  @cast(rcu_dereference($clnt->cl_xprt),
+                                        "struct rpc_xprt")->servername))
        progname = kernel_string($clnt->cl_protname)
        prog = prog_from_clnt($clnt)
        vers = vers_from_clnt($clnt)
@@ -476,7 +484,9 @@ probe sunrpc.clnt.call_sync.return = kernel.function("rpc_call_sync").return !,
 probe sunrpc.clnt.call_async = kernel.function("rpc_call_async") !,
        module("sunrpc").function("rpc_call_async")
 {
-       servername = kernel_string($clnt->cl_server)
+       servername = kernel_string(@choose_defined($clnt->cl_server,
+                                  @cast(rcu_dereference($clnt->cl_xprt),
+                                        "struct rpc_xprt")->servername))
        progname = kernel_string($clnt->cl_protname)
        prog = prog_from_clnt($clnt)
        vers = vers_from_clnt($clnt)
@@ -518,7 +528,9 @@ probe sunrpc.clnt.call_async.return =
 probe sunrpc.clnt.restart_call = kernel.function("rpc_restart_call") !,
        module("sunrpc").function("rpc_restart_call")
 {
-       servername = kernel_string($task->tk_client->cl_server)
+       servername = kernel_string(@choose_defined($task->tk_client->cl_server,
+                                  @cast(rcu_dereference($task->tk_client->cl_xprt),
+                                        "struct rpc_xprt")->servername))
        prog = prog_from_clnt($task->tk_client)
        xid = $task->tk_rqstp->rq_xid
        tk_pid = $task->tk_pid
This page took 0.033861 seconds and 5 git commands to generate.