NFS: Record task, client ID, and XID in xdr_status trace points
authorChuck Lever <chuck.lever@oracle.com>
Wed, 19 Jun 2019 14:34:09 +0000 (10:34 -0400)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Tue, 9 Jul 2019 14:30:25 +0000 (10:30 -0400)
When triggering an nfs_xdr_status trace point, record the task ID
and XID of the failing RPC to better pinpoint the problem.

This feels like a bit of a layering violation.

Suggested-by: Trond Myklebust <trondmy@hammerspace.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
fs/nfs/nfs2xdr.c
fs/nfs/nfs3xdr.c
fs/nfs/nfs4trace.h
fs/nfs/nfs4xdr.c
fs/nfs/nfstrace.h

index 572794dab4b1868defd65b063e56337e94f022ba..cbc17a203248388785a5c085afc3979297207152 100644 (file)
@@ -151,7 +151,7 @@ static int decode_stat(struct xdr_stream *xdr, enum nfs_stat *status)
        return 0;
 out_status:
        *status = be32_to_cpup(p);
-       trace_nfs_xdr_status((int)*status);
+       trace_nfs_xdr_status(xdr, (int)*status);
        return 0;
 }
 
index abbbdde97e31ae4e648f2ae1f2f284cff7e286a4..602767850b36015a546eafb9005282d05d0369fb 100644 (file)
@@ -343,7 +343,7 @@ static int decode_nfsstat3(struct xdr_stream *xdr, enum nfs_stat *status)
        return 0;
 out_status:
        *status = be32_to_cpup(p);
-       trace_nfs_xdr_status((int)*status);
+       trace_nfs_xdr_status(xdr, (int)*status);
        return 0;
 }
 
index 9a39fd51c8e796feff6cc61cd1af980edfd3bdf5..d85f20945a2b2789cf4996f1b41f0f4e79eb5f75 100644 (file)
@@ -564,24 +564,35 @@ TRACE_EVENT(nfs4_setup_sequence,
 
 TRACE_EVENT(nfs4_xdr_status,
                TP_PROTO(
+                       const struct xdr_stream *xdr,
                        u32 op,
                        int error
                ),
 
-               TP_ARGS(op, error),
+               TP_ARGS(xdr, op, error),
 
                TP_STRUCT__entry(
+                       __field(unsigned int, task_id)
+                       __field(unsigned int, client_id)
+                       __field(u32, xid)
                        __field(u32, op)
                        __field(unsigned long, error)
                ),
 
                TP_fast_assign(
+                       const struct rpc_rqst *rqstp = xdr->rqst;
+                       const struct rpc_task *task = rqstp->rq_task;
+
+                       __entry->task_id = task->tk_pid;
+                       __entry->client_id = task->tk_client->cl_clid;
+                       __entry->xid = be32_to_cpu(rqstp->rq_xid);
                        __entry->op = op;
                        __entry->error = error;
                ),
 
                TP_printk(
-                       "error=%ld (%s) operation %d:",
+                       "task:%u@%d xid=0x%08x error=%ld (%s) operation=%u",
+                       __entry->task_id, __entry->client_id, __entry->xid,
                        -__entry->error, show_nfsv4_errors(__entry->error),
                        __entry->op
                )
index 602446158bfb56e1fe62b74411d276431baef8c6..d974ff3164ba2dbd0bda3916ee779c53e00a4260 100644 (file)
@@ -3187,7 +3187,7 @@ static bool __decode_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected,
        return true;
 out_status:
        nfserr = be32_to_cpup(p);
-       trace_nfs4_xdr_status(opnum, nfserr);
+       trace_nfs4_xdr_status(xdr, opnum, nfserr);
        *nfs_retval = nfs4_stat_to_errno(nfserr);
        return true;
 out_bad_operation:
index cd09356e4772a1ddd89f2507a0eeae893aa14308..976d4089e2678a407d533d3eb53192e5151493a1 100644 (file)
@@ -1139,21 +1139,32 @@ TRACE_DEFINE_ENUM(NFSERR_JUKEBOX);
 
 TRACE_EVENT(nfs_xdr_status,
                TP_PROTO(
+                       const struct xdr_stream *xdr,
                        int error
                ),
 
-               TP_ARGS(error),
+               TP_ARGS(xdr, error),
 
                TP_STRUCT__entry(
+                       __field(unsigned int, task_id)
+                       __field(unsigned int, client_id)
+                       __field(u32, xid)
                        __field(unsigned long, error)
                ),
 
                TP_fast_assign(
+                       const struct rpc_rqst *rqstp = xdr->rqst;
+                       const struct rpc_task *task = rqstp->rq_task;
+
+                       __entry->task_id = task->tk_pid;
+                       __entry->client_id = task->tk_client->cl_clid;
+                       __entry->xid = be32_to_cpu(rqstp->rq_xid);
                        __entry->error = error;
                ),
 
                TP_printk(
-                       "error=%ld (%s)",
+                       "task:%u@%d xid=0x%08x error=%ld (%s)",
+                       __entry->task_id, __entry->client_id, __entry->xid,
                        -__entry->error, nfs_show_status(__entry->error)
                )
 );