Commit 74fb8fec authored by Chuck Lever's avatar Chuck Lever Committed by Anna Schumaker

SUNRPC: Trace GSS context lifetimes

Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent 53bc19f1
...@@ -17,6 +17,16 @@ ...@@ -17,6 +17,16 @@
** GSS-API related trace events ** GSS-API related trace events
**/ **/
TRACE_DEFINE_ENUM(RPC_GSS_SVC_NONE);
TRACE_DEFINE_ENUM(RPC_GSS_SVC_INTEGRITY);
TRACE_DEFINE_ENUM(RPC_GSS_SVC_PRIVACY);
#define show_gss_service(x) \
__print_symbolic(x, \
{ RPC_GSS_SVC_NONE, "none" }, \
{ RPC_GSS_SVC_INTEGRITY, "integrity" }, \
{ RPC_GSS_SVC_PRIVACY, "privacy" })
TRACE_DEFINE_ENUM(GSS_S_BAD_MECH); TRACE_DEFINE_ENUM(GSS_S_BAD_MECH);
TRACE_DEFINE_ENUM(GSS_S_BAD_NAME); TRACE_DEFINE_ENUM(GSS_S_BAD_NAME);
TRACE_DEFINE_ENUM(GSS_S_BAD_NAMETYPE); TRACE_DEFINE_ENUM(GSS_S_BAD_NAMETYPE);
...@@ -126,6 +136,40 @@ DEFINE_GSSAPI_EVENT(verify_mic); ...@@ -126,6 +136,40 @@ DEFINE_GSSAPI_EVENT(verify_mic);
DEFINE_GSSAPI_EVENT(wrap); DEFINE_GSSAPI_EVENT(wrap);
DEFINE_GSSAPI_EVENT(unwrap); DEFINE_GSSAPI_EVENT(unwrap);
DECLARE_EVENT_CLASS(rpcgss_ctx_class,
TP_PROTO(
const struct gss_cred *gc
),
TP_ARGS(gc),
TP_STRUCT__entry(
__field(const void *, cred)
__field(unsigned long, service)
__string(principal, gc->gc_principal)
),
TP_fast_assign(
__entry->cred = gc;
__entry->service = gc->gc_service;
__assign_str(principal, gc->gc_principal)
),
TP_printk("cred=%p service=%s principal='%s'",
__entry->cred, show_gss_service(__entry->service),
__get_str(principal))
);
#define DEFINE_CTX_EVENT(name) \
DEFINE_EVENT(rpcgss_ctx_class, rpcgss_ctx_##name, \
TP_PROTO( \
const struct gss_cred *gc \
), \
TP_ARGS(gc))
DEFINE_CTX_EVENT(init);
DEFINE_CTX_EVENT(destroy);
TRACE_EVENT(rpcgss_svc_accept_upcall, TRACE_EVENT(rpcgss_svc_accept_upcall,
TP_PROTO( TP_PROTO(
__be32 xid, __be32 xid,
...@@ -405,6 +449,7 @@ TRACE_EVENT(rpcgss_upcall_result, ...@@ -405,6 +449,7 @@ TRACE_EVENT(rpcgss_upcall_result,
TRACE_EVENT(rpcgss_context, TRACE_EVENT(rpcgss_context,
TP_PROTO( TP_PROTO(
u32 window_size,
unsigned long expiry, unsigned long expiry,
unsigned long now, unsigned long now,
unsigned int timeout, unsigned int timeout,
...@@ -412,12 +457,13 @@ TRACE_EVENT(rpcgss_context, ...@@ -412,12 +457,13 @@ TRACE_EVENT(rpcgss_context,
const u8 *data const u8 *data
), ),
TP_ARGS(expiry, now, timeout, len, data), TP_ARGS(window_size, expiry, now, timeout, len, data),
TP_STRUCT__entry( TP_STRUCT__entry(
__field(unsigned long, expiry) __field(unsigned long, expiry)
__field(unsigned long, now) __field(unsigned long, now)
__field(unsigned int, timeout) __field(unsigned int, timeout)
__field(u32, window_size)
__field(int, len) __field(int, len)
__string(acceptor, data) __string(acceptor, data)
), ),
...@@ -426,13 +472,14 @@ TRACE_EVENT(rpcgss_context, ...@@ -426,13 +472,14 @@ TRACE_EVENT(rpcgss_context,
__entry->expiry = expiry; __entry->expiry = expiry;
__entry->now = now; __entry->now = now;
__entry->timeout = timeout; __entry->timeout = timeout;
__entry->window_size = window_size;
__entry->len = len; __entry->len = len;
strncpy(__get_str(acceptor), data, len); strncpy(__get_str(acceptor), data, len);
), ),
TP_printk("gc_expiry=%lu now=%lu timeout=%u acceptor=%.*s", TP_printk("win_size=%u expiry=%lu now=%lu timeout=%u acceptor=%.*s",
__entry->expiry, __entry->now, __entry->timeout, __entry->window_size, __entry->expiry, __entry->now,
__entry->len, __get_str(acceptor)) __entry->timeout, __entry->len, __get_str(acceptor))
); );
......
...@@ -254,7 +254,7 @@ gss_fill_context(const void *p, const void *end, struct gss_cl_ctx *ctx, struct ...@@ -254,7 +254,7 @@ gss_fill_context(const void *p, const void *end, struct gss_cl_ctx *ctx, struct
if (IS_ERR(p)) if (IS_ERR(p))
goto err; goto err;
done: done:
trace_rpcgss_context(ctx->gc_expiry, now, timeout, trace_rpcgss_context(window_size, ctx->gc_expiry, now, timeout,
ctx->gc_acceptor.len, ctx->gc_acceptor.data); ctx->gc_acceptor.len, ctx->gc_acceptor.data);
err: err:
return p; return p;
...@@ -697,10 +697,12 @@ gss_create_upcall(struct gss_auth *gss_auth, struct gss_cred *gss_cred) ...@@ -697,10 +697,12 @@ gss_create_upcall(struct gss_auth *gss_auth, struct gss_cred *gss_cred)
} }
schedule(); schedule();
} }
if (gss_msg->ctx) if (gss_msg->ctx) {
trace_rpcgss_ctx_init(gss_cred);
gss_cred_set_ctx(cred, gss_msg->ctx); gss_cred_set_ctx(cred, gss_msg->ctx);
else } else {
err = gss_msg->msg.errno; err = gss_msg->msg.errno;
}
spin_unlock(&pipe->lock); spin_unlock(&pipe->lock);
out_intr: out_intr:
finish_wait(&gss_msg->waitqueue, &wait); finish_wait(&gss_msg->waitqueue, &wait);
...@@ -1284,6 +1286,7 @@ gss_send_destroy_context(struct rpc_cred *cred) ...@@ -1284,6 +1286,7 @@ gss_send_destroy_context(struct rpc_cred *cred)
if (new) { if (new) {
ctx->gc_proc = RPC_GSS_PROC_DESTROY; ctx->gc_proc = RPC_GSS_PROC_DESTROY;
trace_rpcgss_ctx_destroy(gss_cred);
task = rpc_call_null(gss_auth->client, &new->gc_base, task = rpc_call_null(gss_auth->client, &new->gc_base,
RPC_TASK_ASYNC|RPC_TASK_SOFT); RPC_TASK_ASYNC|RPC_TASK_SOFT);
if (!IS_ERR(task)) if (!IS_ERR(task))
...@@ -1349,7 +1352,6 @@ gss_destroy_nullcred(struct rpc_cred *cred) ...@@ -1349,7 +1352,6 @@ gss_destroy_nullcred(struct rpc_cred *cred)
static void static void
gss_destroy_cred(struct rpc_cred *cred) gss_destroy_cred(struct rpc_cred *cred)
{ {
if (test_and_clear_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags) != 0) if (test_and_clear_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags) != 0)
gss_send_destroy_context(cred); gss_send_destroy_context(cred);
gss_destroy_nullcred(cred); gss_destroy_nullcred(cred);
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <linux/sunrpc/clnt.h> #include <linux/sunrpc/clnt.h>
#include <linux/sunrpc/sched.h> #include <linux/sunrpc/sched.h>
#include <linux/sunrpc/gss_err.h> #include <linux/sunrpc/gss_err.h>
#include <linux/sunrpc/auth_gss.h>
#define CREATE_TRACE_POINTS #define CREATE_TRACE_POINTS
#include <trace/events/rpcgss.h> #include <trace/events/rpcgss.h>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment