summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2019-06-19 10:34:09 -0400
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2019-07-09 10:30:25 -0400
commit62a92ba97a31c544802bbf13d3a998e86796d548 (patch)
treeabe58a8ec4901c2ce5d1a02bf8c6bda41fd245cf
parent7d4006c161ad8cded95f80f43b5fecc36e781497 (diff)
NFS: Record task, client ID, and XID in xdr_status trace points
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>
-rw-r--r--fs/nfs/nfs2xdr.c2
-rw-r--r--fs/nfs/nfs3xdr.c2
-rw-r--r--fs/nfs/nfs4trace.h15
-rw-r--r--fs/nfs/nfs4xdr.c2
-rw-r--r--fs/nfs/nfstrace.h15
5 files changed, 29 insertions, 7 deletions
diff --git a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c
index 572794dab4b1..cbc17a203248 100644
--- a/fs/nfs/nfs2xdr.c
+++ b/fs/nfs/nfs2xdr.c
@@ -151,7 +151,7 @@ static int decode_stat(struct xdr_stream *xdr, enum nfs_stat *status)
151 return 0; 151 return 0;
152out_status: 152out_status:
153 *status = be32_to_cpup(p); 153 *status = be32_to_cpup(p);
154 trace_nfs_xdr_status((int)*status); 154 trace_nfs_xdr_status(xdr, (int)*status);
155 return 0; 155 return 0;
156} 156}
157 157
diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c
index abbbdde97e31..602767850b36 100644
--- a/fs/nfs/nfs3xdr.c
+++ b/fs/nfs/nfs3xdr.c
@@ -343,7 +343,7 @@ static int decode_nfsstat3(struct xdr_stream *xdr, enum nfs_stat *status)
343 return 0; 343 return 0;
344out_status: 344out_status:
345 *status = be32_to_cpup(p); 345 *status = be32_to_cpup(p);
346 trace_nfs_xdr_status((int)*status); 346 trace_nfs_xdr_status(xdr, (int)*status);
347 return 0; 347 return 0;
348} 348}
349 349
diff --git a/fs/nfs/nfs4trace.h b/fs/nfs/nfs4trace.h
index 9a39fd51c8e7..d85f20945a2b 100644
--- a/fs/nfs/nfs4trace.h
+++ b/fs/nfs/nfs4trace.h
@@ -564,24 +564,35 @@ TRACE_EVENT(nfs4_setup_sequence,
564 564
565TRACE_EVENT(nfs4_xdr_status, 565TRACE_EVENT(nfs4_xdr_status,
566 TP_PROTO( 566 TP_PROTO(
567 const struct xdr_stream *xdr,
567 u32 op, 568 u32 op,
568 int error 569 int error
569 ), 570 ),
570 571
571 TP_ARGS(op, error), 572 TP_ARGS(xdr, op, error),
572 573
573 TP_STRUCT__entry( 574 TP_STRUCT__entry(
575 __field(unsigned int, task_id)
576 __field(unsigned int, client_id)
577 __field(u32, xid)
574 __field(u32, op) 578 __field(u32, op)
575 __field(unsigned long, error) 579 __field(unsigned long, error)
576 ), 580 ),
577 581
578 TP_fast_assign( 582 TP_fast_assign(
583 const struct rpc_rqst *rqstp = xdr->rqst;
584 const struct rpc_task *task = rqstp->rq_task;
585
586 __entry->task_id = task->tk_pid;
587 __entry->client_id = task->tk_client->cl_clid;
588 __entry->xid = be32_to_cpu(rqstp->rq_xid);
579 __entry->op = op; 589 __entry->op = op;
580 __entry->error = error; 590 __entry->error = error;
581 ), 591 ),
582 592
583 TP_printk( 593 TP_printk(
584 "error=%ld (%s) operation %d:", 594 "task:%u@%d xid=0x%08x error=%ld (%s) operation=%u",
595 __entry->task_id, __entry->client_id, __entry->xid,
585 -__entry->error, show_nfsv4_errors(__entry->error), 596 -__entry->error, show_nfsv4_errors(__entry->error),
586 __entry->op 597 __entry->op
587 ) 598 )
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 602446158bfb..d974ff3164ba 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -3187,7 +3187,7 @@ static bool __decode_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected,
3187 return true; 3187 return true;
3188out_status: 3188out_status:
3189 nfserr = be32_to_cpup(p); 3189 nfserr = be32_to_cpup(p);
3190 trace_nfs4_xdr_status(opnum, nfserr); 3190 trace_nfs4_xdr_status(xdr, opnum, nfserr);
3191 *nfs_retval = nfs4_stat_to_errno(nfserr); 3191 *nfs_retval = nfs4_stat_to_errno(nfserr);
3192 return true; 3192 return true;
3193out_bad_operation: 3193out_bad_operation:
diff --git a/fs/nfs/nfstrace.h b/fs/nfs/nfstrace.h
index cd09356e4772..976d4089e267 100644
--- a/fs/nfs/nfstrace.h
+++ b/fs/nfs/nfstrace.h
@@ -1139,21 +1139,32 @@ TRACE_DEFINE_ENUM(NFSERR_JUKEBOX);
1139 1139
1140TRACE_EVENT(nfs_xdr_status, 1140TRACE_EVENT(nfs_xdr_status,
1141 TP_PROTO( 1141 TP_PROTO(
1142 const struct xdr_stream *xdr,
1142 int error 1143 int error
1143 ), 1144 ),
1144 1145
1145 TP_ARGS(error), 1146 TP_ARGS(xdr, error),
1146 1147
1147 TP_STRUCT__entry( 1148 TP_STRUCT__entry(
1149 __field(unsigned int, task_id)
1150 __field(unsigned int, client_id)
1151 __field(u32, xid)
1148 __field(unsigned long, error) 1152 __field(unsigned long, error)
1149 ), 1153 ),
1150 1154
1151 TP_fast_assign( 1155 TP_fast_assign(
1156 const struct rpc_rqst *rqstp = xdr->rqst;
1157 const struct rpc_task *task = rqstp->rq_task;
1158
1159 __entry->task_id = task->tk_pid;
1160 __entry->client_id = task->tk_client->cl_clid;
1161 __entry->xid = be32_to_cpu(rqstp->rq_xid);
1152 __entry->error = error; 1162 __entry->error = error;
1153 ), 1163 ),
1154 1164
1155 TP_printk( 1165 TP_printk(
1156 "error=%ld (%s)", 1166 "task:%u@%d xid=0x%08x error=%ld (%s)",
1167 __entry->task_id, __entry->client_id, __entry->xid,
1157 -__entry->error, nfs_show_status(__entry->error) 1168 -__entry->error, nfs_show_status(__entry->error)
1158 ) 1169 )
1159); 1170);