aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2013-08-14 17:58:28 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2013-08-22 08:58:27 -0400
commit2f92ae343e2358a4936c2470debfc4424b29eb3e (patch)
tree4b26d5165fdaea44f009c8544d54330a31c5ce8a /fs
parent1037e6eaa37a42cec877f103c091cfe5304f4450 (diff)
NFSv4.1: Add tracepoints for debugging slot table operations
Add tracepoints to nfs41_setup_sequence and nfs41_sequence_done to track session and slot table state changes. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/callback_proc.c1
-rw-r--r--fs/nfs/nfs4proc.c2
-rw-r--r--fs/nfs/nfs4session.h10
-rw-r--r--fs/nfs/nfs4trace.c2
-rw-r--r--fs/nfs/nfs4trace.h139
5 files changed, 154 insertions, 0 deletions
diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
index c0749305189b..b25ed7e3e937 100644
--- a/fs/nfs/callback_proc.c
+++ b/fs/nfs/callback_proc.c
@@ -464,6 +464,7 @@ out:
464 } else 464 } else
465 res->csr_status = status; 465 res->csr_status = status;
466 466
467 trace_nfs4_cb_sequence(args, res, status);
467 dprintk("%s: exit with status = %d res->csr_status %d\n", __func__, 468 dprintk("%s: exit with status = %d res->csr_status %d\n", __func__,
468 ntohl(status), ntohl(res->csr_status)); 469 ntohl(status), ntohl(res->csr_status));
469 return status; 470 return status;
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index c8b5ff6effe9..a745f7c41758 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -508,6 +508,7 @@ static int nfs41_sequence_done(struct rpc_task *task, struct nfs4_sequence_res *
508 interrupted = true; 508 interrupted = true;
509 } 509 }
510 510
511 trace_nfs4_sequence_done(session, res);
511 /* Check the SEQUENCE operation status */ 512 /* Check the SEQUENCE operation status */
512 switch (res->sr_status) { 513 switch (res->sr_status) {
513 case 0: 514 case 0:
@@ -660,6 +661,7 @@ int nfs41_setup_sequence(struct nfs4_session *session,
660 * set to 1 if an rpc level failure occurs. 661 * set to 1 if an rpc level failure occurs.
661 */ 662 */
662 res->sr_status = 1; 663 res->sr_status = 1;
664 trace_nfs4_setup_sequence(session, args);
663out_success: 665out_success:
664 rpc_call_start(task); 666 rpc_call_start(task);
665 return 0; 667 return 0;
diff --git a/fs/nfs/nfs4session.h b/fs/nfs/nfs4session.h
index 86a066926f24..e3e6ce357f69 100644
--- a/fs/nfs/nfs4session.h
+++ b/fs/nfs/nfs4session.h
@@ -117,6 +117,16 @@ static inline int nfs4_has_persistent_session(const struct nfs_client *clp)
117 return 0; 117 return 0;
118} 118}
119 119
120#ifdef CONFIG_CRC32
121/*
122 * nfs_session_id_hash - calculate the crc32 hash for the session id
123 * @session - pointer to session
124 */
125#define nfs_session_id_hash(sess_id) \
126 (~crc32_le(0xFFFFFFFF, &(sess_id)->data[0], sizeof((sess_id)->data)))
127#else
128#define nfs_session_id_hash(session) (0)
129#endif
120#else /* defined(CONFIG_NFS_V4_1) */ 130#else /* defined(CONFIG_NFS_V4_1) */
121 131
122static inline int nfs4_init_session(struct nfs_client *clp) 132static inline int nfs4_init_session(struct nfs_client *clp)
diff --git a/fs/nfs/nfs4trace.c b/fs/nfs/nfs4trace.c
index f8409743c5c5..d774335cc8bc 100644
--- a/fs/nfs/nfs4trace.c
+++ b/fs/nfs/nfs4trace.c
@@ -4,6 +4,8 @@
4#include <linux/nfs_fs.h> 4#include <linux/nfs_fs.h>
5#include "nfs4_fs.h" 5#include "nfs4_fs.h"
6#include "internal.h" 6#include "internal.h"
7#include "nfs4session.h"
8#include "callback.h"
7 9
8#define CREATE_TRACE_POINTS 10#define CREATE_TRACE_POINTS
9#include "nfs4trace.h" 11#include "nfs4trace.h"
diff --git a/fs/nfs/nfs4trace.h b/fs/nfs/nfs4trace.h
index b2a2d8a30c66..05b96a6dac5c 100644
--- a/fs/nfs/nfs4trace.h
+++ b/fs/nfs/nfs4trace.h
@@ -240,6 +240,145 @@ DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_clientid);
240DEFINE_NFS4_CLIENTID_EVENT(nfs4_bind_conn_to_session); 240DEFINE_NFS4_CLIENTID_EVENT(nfs4_bind_conn_to_session);
241DEFINE_NFS4_CLIENTID_EVENT(nfs4_sequence); 241DEFINE_NFS4_CLIENTID_EVENT(nfs4_sequence);
242DEFINE_NFS4_CLIENTID_EVENT(nfs4_reclaim_complete); 242DEFINE_NFS4_CLIENTID_EVENT(nfs4_reclaim_complete);
243
244TRACE_EVENT(nfs4_setup_sequence,
245 TP_PROTO(
246 const struct nfs4_session *session,
247 const struct nfs4_sequence_args *args
248 ),
249 TP_ARGS(session, args),
250
251 TP_STRUCT__entry(
252 __field(unsigned int, session)
253 __field(unsigned int, slot_nr)
254 __field(unsigned int, seq_nr)
255 __field(unsigned int, highest_used_slotid)
256 ),
257
258 TP_fast_assign(
259 const struct nfs4_slot *sa_slot = args->sa_slot;
260 __entry->session = nfs_session_id_hash(&session->sess_id);
261 __entry->slot_nr = sa_slot->slot_nr;
262 __entry->seq_nr = sa_slot->seq_nr;
263 __entry->highest_used_slotid =
264 sa_slot->table->highest_used_slotid;
265 ),
266 TP_printk(
267 "session=0x%08x slot_nr=%u seq_nr=%u "
268 "highest_used_slotid=%u",
269 __entry->session,
270 __entry->slot_nr,
271 __entry->seq_nr,
272 __entry->highest_used_slotid
273 )
274);
275
276#define show_nfs4_sequence_status_flags(status) \
277 __print_flags((unsigned long)status, "|", \
278 { SEQ4_STATUS_CB_PATH_DOWN, "CB_PATH_DOWN" }, \
279 { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING, \
280 "CB_GSS_CONTEXTS_EXPIRING" }, \
281 { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED, \
282 "CB_GSS_CONTEXTS_EXPIRED" }, \
283 { SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED, \
284 "EXPIRED_ALL_STATE_REVOKED" }, \
285 { SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED, \
286 "EXPIRED_SOME_STATE_REVOKED" }, \
287 { SEQ4_STATUS_ADMIN_STATE_REVOKED, \
288 "ADMIN_STATE_REVOKED" }, \
289 { SEQ4_STATUS_RECALLABLE_STATE_REVOKED, \
290 "RECALLABLE_STATE_REVOKED" }, \
291 { SEQ4_STATUS_LEASE_MOVED, "LEASE_MOVED" }, \
292 { SEQ4_STATUS_RESTART_RECLAIM_NEEDED, \
293 "RESTART_RECLAIM_NEEDED" }, \
294 { SEQ4_STATUS_CB_PATH_DOWN_SESSION, \
295 "CB_PATH_DOWN_SESSION" }, \
296 { SEQ4_STATUS_BACKCHANNEL_FAULT, \
297 "BACKCHANNEL_FAULT" })
298
299TRACE_EVENT(nfs4_sequence_done,
300 TP_PROTO(
301 const struct nfs4_session *session,
302 const struct nfs4_sequence_res *res
303 ),
304 TP_ARGS(session, res),
305
306 TP_STRUCT__entry(
307 __field(unsigned int, session)
308 __field(unsigned int, slot_nr)
309 __field(unsigned int, seq_nr)
310 __field(unsigned int, highest_slotid)
311 __field(unsigned int, target_highest_slotid)
312 __field(unsigned int, status_flags)
313 __field(int, error)
314 ),
315
316 TP_fast_assign(
317 const struct nfs4_slot *sr_slot = res->sr_slot;
318 __entry->session = nfs_session_id_hash(&session->sess_id);
319 __entry->slot_nr = sr_slot->slot_nr;
320 __entry->seq_nr = sr_slot->seq_nr;
321 __entry->highest_slotid = res->sr_highest_slotid;
322 __entry->target_highest_slotid =
323 res->sr_target_highest_slotid;
324 __entry->error = res->sr_status;
325 ),
326 TP_printk(
327 "error=%d (%s) session=0x%08x slot_nr=%u seq_nr=%u "
328 "highest_slotid=%u target_highest_slotid=%u "
329 "status_flags=%u (%s)",
330 __entry->error,
331 show_nfsv4_errors(__entry->error),
332 __entry->session,
333 __entry->slot_nr,
334 __entry->seq_nr,
335 __entry->highest_slotid,
336 __entry->target_highest_slotid,
337 __entry->status_flags,
338 show_nfs4_sequence_status_flags(__entry->status_flags)
339 )
340);
341
342struct cb_sequenceargs;
343struct cb_sequenceres;
344
345TRACE_EVENT(nfs4_cb_sequence,
346 TP_PROTO(
347 const struct cb_sequenceargs *args,
348 const struct cb_sequenceres *res,
349 __be32 status
350 ),
351 TP_ARGS(args, res, status),
352
353 TP_STRUCT__entry(
354 __field(unsigned int, session)
355 __field(unsigned int, slot_nr)
356 __field(unsigned int, seq_nr)
357 __field(unsigned int, highest_slotid)
358 __field(unsigned int, cachethis)
359 __field(int, error)
360 ),
361
362 TP_fast_assign(
363 __entry->session = nfs_session_id_hash(&args->csa_sessionid);
364 __entry->slot_nr = args->csa_slotid;
365 __entry->seq_nr = args->csa_sequenceid;
366 __entry->highest_slotid = args->csa_highestslotid;
367 __entry->cachethis = args->csa_cachethis;
368 __entry->error = -be32_to_cpu(status);
369 ),
370
371 TP_printk(
372 "error=%d (%s) session=0x%08x slot_nr=%u seq_nr=%u "
373 "highest_slotid=%u",
374 __entry->error,
375 show_nfsv4_errors(__entry->error),
376 __entry->session,
377 __entry->slot_nr,
378 __entry->seq_nr,
379 __entry->highest_slotid
380 )
381);
243#endif /* CONFIG_NFS_V4_1 */ 382#endif /* CONFIG_NFS_V4_1 */
244 383
245DECLARE_EVENT_CLASS(nfs4_open_event, 384DECLARE_EVENT_CLASS(nfs4_open_event,