Linux Audio

Check our new training course

Loading...
v6.13.7
   1/* SPDX-License-Identifier: GPL-2.0 */
   2/*
   3 * Copyright (c) 2014 Christoph Hellwig.
   4 */
   5#undef TRACE_SYSTEM
   6#define TRACE_SYSTEM nfsd
   7
   8#if !defined(_NFSD_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
   9#define _NFSD_TRACE_H
  10
  11#include <linux/tracepoint.h>
  12#include <linux/sunrpc/clnt.h>
  13#include <linux/sunrpc/xprt.h>
  14#include <trace/misc/nfs.h>
  15#include <trace/misc/sunrpc.h>
  16
  17#include "export.h"
  18#include "nfsfh.h"
  19#include "xdr4.h"
  20
  21#define NFSD_TRACE_PROC_RES_FIELDS \
  22		__field(unsigned int, netns_ino) \
  23		__field(u32, xid) \
  24		__field(unsigned long, status) \
  25		__array(unsigned char, server, sizeof(struct sockaddr_in6)) \
  26		__array(unsigned char, client, sizeof(struct sockaddr_in6))
  27
  28#define NFSD_TRACE_PROC_RES_ASSIGNMENTS(error) \
  29		do { \
  30			__entry->netns_ino = SVC_NET(rqstp)->ns.inum; \
  31			__entry->xid = be32_to_cpu(rqstp->rq_xid); \
  32			__entry->status = be32_to_cpu(error); \
  33			memcpy(__entry->server, &rqstp->rq_xprt->xpt_local, \
  34			       rqstp->rq_xprt->xpt_locallen); \
  35			memcpy(__entry->client, &rqstp->rq_xprt->xpt_remote, \
  36			       rqstp->rq_xprt->xpt_remotelen); \
  37		} while (0);
  38
  39DECLARE_EVENT_CLASS(nfsd_xdr_err_class,
  40	TP_PROTO(
  41		const struct svc_rqst *rqstp
  42	),
  43	TP_ARGS(rqstp),
  44	TP_STRUCT__entry(
  45		__field(unsigned int, netns_ino)
  46		__field(u32, xid)
  47		__field(u32, vers)
  48		__field(u32, proc)
  49		__sockaddr(server, rqstp->rq_xprt->xpt_locallen)
  50		__sockaddr(client, rqstp->rq_xprt->xpt_remotelen)
  51	),
  52	TP_fast_assign(
  53		const struct svc_xprt *xprt = rqstp->rq_xprt;
  54
  55		__entry->netns_ino = xprt->xpt_net->ns.inum;
  56		__entry->xid = be32_to_cpu(rqstp->rq_xid);
  57		__entry->vers = rqstp->rq_vers;
  58		__entry->proc = rqstp->rq_proc;
  59		__assign_sockaddr(server, &xprt->xpt_local, xprt->xpt_locallen);
  60		__assign_sockaddr(client, &xprt->xpt_remote, xprt->xpt_remotelen);
  61	),
  62	TP_printk("xid=0x%08x vers=%u proc=%u",
  63		__entry->xid, __entry->vers, __entry->proc
  64	)
  65);
  66
  67#define DEFINE_NFSD_XDR_ERR_EVENT(name) \
  68DEFINE_EVENT(nfsd_xdr_err_class, nfsd_##name##_err, \
  69	TP_PROTO(const struct svc_rqst *rqstp), \
  70	TP_ARGS(rqstp))
  71
  72DEFINE_NFSD_XDR_ERR_EVENT(garbage_args);
  73DEFINE_NFSD_XDR_ERR_EVENT(cant_encode);
  74
  75#define show_nfsd_may_flags(x)						\
  76	__print_flags(x, "|",						\
  77		{ NFSD_MAY_EXEC,		"EXEC" },		\
  78		{ NFSD_MAY_WRITE,		"WRITE" },		\
  79		{ NFSD_MAY_READ,		"READ" },		\
  80		{ NFSD_MAY_SATTR,		"SATTR" },		\
  81		{ NFSD_MAY_TRUNC,		"TRUNC" },		\
  82		{ NFSD_MAY_NLM,			"NLM" },		\
  83		{ NFSD_MAY_OWNER_OVERRIDE,	"OWNER_OVERRIDE" },	\
  84		{ NFSD_MAY_LOCAL_ACCESS,	"LOCAL_ACCESS" },	\
  85		{ NFSD_MAY_BYPASS_GSS_ON_ROOT,	"BYPASS_GSS_ON_ROOT" },	\
  86		{ NFSD_MAY_NOT_BREAK_LEASE,	"NOT_BREAK_LEASE" },	\
  87		{ NFSD_MAY_BYPASS_GSS,		"BYPASS_GSS" },		\
  88		{ NFSD_MAY_READ_IF_EXEC,	"READ_IF_EXEC" },	\
  89		{ NFSD_MAY_64BIT_COOKIE,	"64BIT_COOKIE" },	\
  90		{ NFSD_MAY_LOCALIO,		"LOCALIO" })
  91
  92TRACE_EVENT(nfsd_compound,
  93	TP_PROTO(
  94		const struct svc_rqst *rqst,
  95		const char *tag,
  96		u32 taglen,
  97		u32 opcnt
  98	),
  99	TP_ARGS(rqst, tag, taglen, opcnt),
 100	TP_STRUCT__entry(
 101		__field(u32, xid)
 102		__field(u32, opcnt)
 103		__string_len(tag, tag, taglen)
 104	),
 105	TP_fast_assign(
 106		__entry->xid = be32_to_cpu(rqst->rq_xid);
 107		__entry->opcnt = opcnt;
 108		__assign_str(tag);
 109	),
 110	TP_printk("xid=0x%08x opcnt=%u tag=%s",
 111		__entry->xid, __entry->opcnt, __get_str(tag)
 112	)
 113)
 114
 115TRACE_EVENT(nfsd_compound_status,
 116	TP_PROTO(u32 args_opcnt,
 117		 u32 resp_opcnt,
 118		 __be32 status,
 119		 const char *name),
 120	TP_ARGS(args_opcnt, resp_opcnt, status, name),
 121	TP_STRUCT__entry(
 122		__field(u32, args_opcnt)
 123		__field(u32, resp_opcnt)
 124		__field(int, status)
 125		__string(name, name)
 126	),
 127	TP_fast_assign(
 128		__entry->args_opcnt = args_opcnt;
 129		__entry->resp_opcnt = resp_opcnt;
 130		__entry->status = be32_to_cpu(status);
 131		__assign_str(name);
 132	),
 133	TP_printk("op=%u/%u %s status=%d",
 134		__entry->resp_opcnt, __entry->args_opcnt,
 135		__get_str(name), __entry->status)
 136)
 137
 138TRACE_EVENT(nfsd_compound_decode_err,
 139	TP_PROTO(
 140		const struct svc_rqst *rqstp,
 141		u32 args_opcnt,
 142		u32 resp_opcnt,
 143		u32 opnum,
 144		__be32 status
 145	),
 146	TP_ARGS(rqstp, args_opcnt, resp_opcnt, opnum, status),
 147	TP_STRUCT__entry(
 148		NFSD_TRACE_PROC_RES_FIELDS
 149
 150		__field(u32, args_opcnt)
 151		__field(u32, resp_opcnt)
 152		__field(u32, opnum)
 153	),
 154	TP_fast_assign(
 155		NFSD_TRACE_PROC_RES_ASSIGNMENTS(status)
 156
 157		__entry->args_opcnt = args_opcnt;
 158		__entry->resp_opcnt = resp_opcnt;
 159		__entry->opnum = opnum;
 160	),
 161	TP_printk("op=%u/%u opnum=%u status=%lu",
 162		__entry->resp_opcnt, __entry->args_opcnt,
 163		__entry->opnum, __entry->status)
 164);
 165
 166DECLARE_EVENT_CLASS(nfsd_compound_err_class,
 167	TP_PROTO(
 168		const struct svc_rqst *rqstp,
 169		u32 opnum,
 170		__be32 status
 171	),
 172	TP_ARGS(rqstp, opnum, status),
 173	TP_STRUCT__entry(
 174		NFSD_TRACE_PROC_RES_FIELDS
 175
 176		__field(u32, opnum)
 177	),
 178	TP_fast_assign(
 179		NFSD_TRACE_PROC_RES_ASSIGNMENTS(status)
 180
 181		__entry->opnum = opnum;
 182	),
 183	TP_printk("opnum=%u status=%lu",
 184		__entry->opnum, __entry->status)
 185);
 186
 187#define DEFINE_NFSD_COMPOUND_ERR_EVENT(name)				\
 188DEFINE_EVENT(nfsd_compound_err_class, nfsd_compound_##name##_err,	\
 189	TP_PROTO(							\
 190		const struct svc_rqst *rqstp,				\
 191		u32 opnum,						\
 192		__be32 status						\
 193	),								\
 194	TP_ARGS(rqstp, opnum, status))
 195
 196DEFINE_NFSD_COMPOUND_ERR_EVENT(op);
 197DEFINE_NFSD_COMPOUND_ERR_EVENT(encode);
 198
 199#define show_fs_file_type(x) \
 200	__print_symbolic(x, \
 201		{ S_IFLNK,		"LNK" }, \
 202		{ S_IFREG,		"REG" }, \
 203		{ S_IFDIR,		"DIR" }, \
 204		{ S_IFCHR,		"CHR" }, \
 205		{ S_IFBLK,		"BLK" }, \
 206		{ S_IFIFO,		"FIFO" }, \
 207		{ S_IFSOCK,		"SOCK" })
 208
 209TRACE_EVENT_CONDITION(nfsd_fh_verify,
 210	TP_PROTO(
 211		const struct svc_rqst *rqstp,
 212		const struct svc_fh *fhp,
 213		umode_t type,
 214		int access
 215	),
 216	TP_ARGS(rqstp, fhp, type, access),
 217	TP_CONDITION(rqstp != NULL),
 218	TP_STRUCT__entry(
 219		__field(unsigned int, netns_ino)
 220		__sockaddr(server, rqstp->rq_xprt->xpt_remotelen)
 221		__sockaddr(client, rqstp->rq_xprt->xpt_remotelen)
 222		__field(u32, xid)
 223		__field(u32, fh_hash)
 224		__field(const void *, inode)
 225		__field(unsigned long, type)
 226		__field(unsigned long, access)
 227	),
 228	TP_fast_assign(
 229		__entry->netns_ino = SVC_NET(rqstp)->ns.inum;
 230		__assign_sockaddr(server, &rqstp->rq_xprt->xpt_local,
 231		       rqstp->rq_xprt->xpt_locallen);
 232		__assign_sockaddr(client, &rqstp->rq_xprt->xpt_remote,
 233				  rqstp->rq_xprt->xpt_remotelen);
 234		__entry->xid = be32_to_cpu(rqstp->rq_xid);
 235		__entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle);
 236		__entry->inode = d_inode(fhp->fh_dentry);
 237		__entry->type = type;
 238		__entry->access = access;
 239	),
 240	TP_printk("xid=0x%08x fh_hash=0x%08x type=%s access=%s",
 241		__entry->xid, __entry->fh_hash,
 242		show_fs_file_type(__entry->type),
 243		show_nfsd_may_flags(__entry->access)
 244	)
 245);
 246
 247TRACE_EVENT_CONDITION(nfsd_fh_verify_err,
 248	TP_PROTO(
 249		const struct svc_rqst *rqstp,
 250		const struct svc_fh *fhp,
 251		umode_t type,
 252		int access,
 253		__be32 error
 254	),
 255	TP_ARGS(rqstp, fhp, type, access, error),
 256	TP_CONDITION(rqstp != NULL && error),
 257	TP_STRUCT__entry(
 258		__field(unsigned int, netns_ino)
 259		__sockaddr(server, rqstp->rq_xprt->xpt_remotelen)
 260		__sockaddr(client, rqstp->rq_xprt->xpt_remotelen)
 261		__field(u32, xid)
 262		__field(u32, fh_hash)
 263		__field(const void *, inode)
 264		__field(unsigned long, type)
 265		__field(unsigned long, access)
 266		__field(int, error)
 267	),
 268	TP_fast_assign(
 269		__entry->netns_ino = SVC_NET(rqstp)->ns.inum;
 270		__assign_sockaddr(server, &rqstp->rq_xprt->xpt_local,
 271		       rqstp->rq_xprt->xpt_locallen);
 272		__assign_sockaddr(client, &rqstp->rq_xprt->xpt_remote,
 273				  rqstp->rq_xprt->xpt_remotelen);
 274		__entry->xid = be32_to_cpu(rqstp->rq_xid);
 275		__entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle);
 276		if (fhp->fh_dentry)
 277			__entry->inode = d_inode(fhp->fh_dentry);
 278		else
 279			__entry->inode = NULL;
 280		__entry->type = type;
 281		__entry->access = access;
 282		__entry->error = be32_to_cpu(error);
 283	),
 284	TP_printk("xid=0x%08x fh_hash=0x%08x type=%s access=%s error=%d",
 285		__entry->xid, __entry->fh_hash,
 286		show_fs_file_type(__entry->type),
 287		show_nfsd_may_flags(__entry->access),
 288		__entry->error
 289	)
 290);
 291
 292DECLARE_EVENT_CLASS(nfsd_fh_err_class,
 293	TP_PROTO(struct svc_rqst *rqstp,
 294		 struct svc_fh	*fhp,
 295		 int		status),
 296	TP_ARGS(rqstp, fhp, status),
 297	TP_STRUCT__entry(
 298		__field(u32, xid)
 299		__field(u32, fh_hash)
 300		__field(int, status)
 301	),
 302	TP_fast_assign(
 303		__entry->xid = be32_to_cpu(rqstp->rq_xid);
 304		__entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle);
 305		__entry->status = status;
 306	),
 307	TP_printk("xid=0x%08x fh_hash=0x%08x status=%d",
 308		  __entry->xid, __entry->fh_hash,
 309		  __entry->status)
 310)
 311
 312#define DEFINE_NFSD_FH_ERR_EVENT(name)			\
 313DEFINE_EVENT_CONDITION(nfsd_fh_err_class, nfsd_##name,	\
 314	TP_PROTO(struct svc_rqst *rqstp,		\
 315		 struct svc_fh	*fhp,			\
 316		 int		status),		\
 317	TP_ARGS(rqstp, fhp, status),			\
 318	TP_CONDITION(rqstp != NULL))
 319
 320DEFINE_NFSD_FH_ERR_EVENT(set_fh_dentry_badexport);
 321DEFINE_NFSD_FH_ERR_EVENT(set_fh_dentry_badhandle);
 322
 323TRACE_EVENT(nfsd_exp_find_key,
 324	TP_PROTO(const struct svc_expkey *key,
 325		 int status),
 326	TP_ARGS(key, status),
 327	TP_STRUCT__entry(
 328		__field(int, fsidtype)
 329		__array(u32, fsid, 6)
 330		__string(auth_domain, key->ek_client->name)
 331		__field(int, status)
 332	),
 333	TP_fast_assign(
 334		__entry->fsidtype = key->ek_fsidtype;
 335		memcpy(__entry->fsid, key->ek_fsid, 4*6);
 336		__assign_str(auth_domain);
 337		__entry->status = status;
 338	),
 339	TP_printk("fsid=%x::%s domain=%s status=%d",
 340		__entry->fsidtype,
 341		__print_array(__entry->fsid, 6, 4),
 342		__get_str(auth_domain),
 343		__entry->status
 344	)
 345);
 346
 347TRACE_EVENT(nfsd_expkey_update,
 348	TP_PROTO(const struct svc_expkey *key, const char *exp_path),
 349	TP_ARGS(key, exp_path),
 350	TP_STRUCT__entry(
 351		__field(int, fsidtype)
 352		__array(u32, fsid, 6)
 353		__string(auth_domain, key->ek_client->name)
 354		__string(path, exp_path)
 355		__field(bool, cache)
 356	),
 357	TP_fast_assign(
 358		__entry->fsidtype = key->ek_fsidtype;
 359		memcpy(__entry->fsid, key->ek_fsid, 4*6);
 360		__assign_str(auth_domain);
 361		__assign_str(path);
 362		__entry->cache = !test_bit(CACHE_NEGATIVE, &key->h.flags);
 363	),
 364	TP_printk("fsid=%x::%s domain=%s path=%s cache=%s",
 365		__entry->fsidtype,
 366		__print_array(__entry->fsid, 6, 4),
 367		__get_str(auth_domain),
 368		__get_str(path),
 369		__entry->cache ? "pos" : "neg"
 370	)
 371);
 372
 373TRACE_EVENT(nfsd_exp_get_by_name,
 374	TP_PROTO(const struct svc_export *key,
 375		 int status),
 376	TP_ARGS(key, status),
 377	TP_STRUCT__entry(
 378		__string(path, key->ex_path.dentry->d_name.name)
 379		__string(auth_domain, key->ex_client->name)
 380		__field(int, status)
 381	),
 382	TP_fast_assign(
 383		__assign_str(path);
 384		__assign_str(auth_domain);
 385		__entry->status = status;
 386	),
 387	TP_printk("path=%s domain=%s status=%d",
 388		__get_str(path),
 389		__get_str(auth_domain),
 390		__entry->status
 391	)
 392);
 393
 394TRACE_EVENT(nfsd_export_update,
 395	TP_PROTO(const struct svc_export *key),
 396	TP_ARGS(key),
 397	TP_STRUCT__entry(
 398		__string(path, key->ex_path.dentry->d_name.name)
 399		__string(auth_domain, key->ex_client->name)
 400		__field(bool, cache)
 401	),
 402	TP_fast_assign(
 403		__assign_str(path);
 404		__assign_str(auth_domain);
 405		__entry->cache = !test_bit(CACHE_NEGATIVE, &key->h.flags);
 406	),
 407	TP_printk("path=%s domain=%s cache=%s",
 408		__get_str(path),
 409		__get_str(auth_domain),
 410		__entry->cache ? "pos" : "neg"
 411	)
 412);
 413
 414DECLARE_EVENT_CLASS(nfsd_io_class,
 415	TP_PROTO(struct svc_rqst *rqstp,
 416		 struct svc_fh	*fhp,
 417		 u64		offset,
 418		 u32		len),
 419	TP_ARGS(rqstp, fhp, offset, len),
 420	TP_STRUCT__entry(
 421		__field(u32, xid)
 422		__field(u32, fh_hash)
 423		__field(u64, offset)
 424		__field(u32, len)
 425	),
 426	TP_fast_assign(
 427		__entry->xid = be32_to_cpu(rqstp->rq_xid);
 428		__entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle);
 429		__entry->offset = offset;
 430		__entry->len = len;
 431	),
 432	TP_printk("xid=0x%08x fh_hash=0x%08x offset=%llu len=%u",
 433		  __entry->xid, __entry->fh_hash,
 434		  __entry->offset, __entry->len)
 435)
 436
 437#define DEFINE_NFSD_IO_EVENT(name)		\
 438DEFINE_EVENT(nfsd_io_class, nfsd_##name,	\
 439	TP_PROTO(struct svc_rqst *rqstp,	\
 440		 struct svc_fh	*fhp,		\
 441		 u64		offset,		\
 442		 u32		len),		\
 443	TP_ARGS(rqstp, fhp, offset, len))
 444
 445DEFINE_NFSD_IO_EVENT(read_start);
 446DEFINE_NFSD_IO_EVENT(read_splice);
 447DEFINE_NFSD_IO_EVENT(read_vector);
 448DEFINE_NFSD_IO_EVENT(read_io_done);
 449DEFINE_NFSD_IO_EVENT(read_done);
 450DEFINE_NFSD_IO_EVENT(write_start);
 451DEFINE_NFSD_IO_EVENT(write_opened);
 452DEFINE_NFSD_IO_EVENT(write_io_done);
 453DEFINE_NFSD_IO_EVENT(write_done);
 454
 455DECLARE_EVENT_CLASS(nfsd_err_class,
 456	TP_PROTO(struct svc_rqst *rqstp,
 457		 struct svc_fh	*fhp,
 458		 loff_t		offset,
 459		 int		status),
 460	TP_ARGS(rqstp, fhp, offset, status),
 461	TP_STRUCT__entry(
 462		__field(u32, xid)
 463		__field(u32, fh_hash)
 464		__field(loff_t, offset)
 465		__field(int, status)
 466	),
 467	TP_fast_assign(
 468		__entry->xid = be32_to_cpu(rqstp->rq_xid);
 469		__entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle);
 470		__entry->offset = offset;
 471		__entry->status = status;
 472	),
 473	TP_printk("xid=0x%08x fh_hash=0x%08x offset=%lld status=%d",
 474		  __entry->xid, __entry->fh_hash,
 475		  __entry->offset, __entry->status)
 476)
 477
 478#define DEFINE_NFSD_ERR_EVENT(name)		\
 479DEFINE_EVENT(nfsd_err_class, nfsd_##name,	\
 480	TP_PROTO(struct svc_rqst *rqstp,	\
 481		 struct svc_fh	*fhp,		\
 482		 loff_t		offset,		\
 483		 int		len),		\
 484	TP_ARGS(rqstp, fhp, offset, len))
 485
 486DEFINE_NFSD_ERR_EVENT(read_err);
 487DEFINE_NFSD_ERR_EVENT(write_err);
 488
 489TRACE_EVENT(nfsd_dirent,
 490	TP_PROTO(struct svc_fh *fhp,
 491		 u64 ino,
 492		 const char *name,
 493		 int namlen),
 494	TP_ARGS(fhp, ino, name, namlen),
 495	TP_STRUCT__entry(
 496		__field(u32, fh_hash)
 497		__field(u64, ino)
 498		__string_len(name, name, namlen)
 499	),
 500	TP_fast_assign(
 501		__entry->fh_hash = fhp ? knfsd_fh_hash(&fhp->fh_handle) : 0;
 502		__entry->ino = ino;
 503		__assign_str(name);
 504	),
 505	TP_printk("fh_hash=0x%08x ino=%llu name=%s",
 506		__entry->fh_hash, __entry->ino, __get_str(name)
 507	)
 508)
 509
 510DECLARE_EVENT_CLASS(nfsd_copy_err_class,
 511	TP_PROTO(struct svc_rqst *rqstp,
 512		 struct svc_fh	*src_fhp,
 513		 loff_t		src_offset,
 514		 struct svc_fh	*dst_fhp,
 515		 loff_t		dst_offset,
 516		 u64		count,
 517		 int		status),
 518	TP_ARGS(rqstp, src_fhp, src_offset, dst_fhp, dst_offset, count, status),
 519	TP_STRUCT__entry(
 520		__field(u32, xid)
 521		__field(u32, src_fh_hash)
 522		__field(loff_t, src_offset)
 523		__field(u32, dst_fh_hash)
 524		__field(loff_t, dst_offset)
 525		__field(u64, count)
 526		__field(int, status)
 527	),
 528	TP_fast_assign(
 529		__entry->xid = be32_to_cpu(rqstp->rq_xid);
 530		__entry->src_fh_hash = knfsd_fh_hash(&src_fhp->fh_handle);
 531		__entry->src_offset = src_offset;
 532		__entry->dst_fh_hash = knfsd_fh_hash(&dst_fhp->fh_handle);
 533		__entry->dst_offset = dst_offset;
 534		__entry->count = count;
 535		__entry->status = status;
 536	),
 537	TP_printk("xid=0x%08x src_fh_hash=0x%08x src_offset=%lld "
 538			"dst_fh_hash=0x%08x dst_offset=%lld "
 539			"count=%llu status=%d",
 540		  __entry->xid, __entry->src_fh_hash, __entry->src_offset,
 541		  __entry->dst_fh_hash, __entry->dst_offset,
 542		  (unsigned long long)__entry->count,
 543		  __entry->status)
 544)
 545
 546#define DEFINE_NFSD_COPY_ERR_EVENT(name)		\
 547DEFINE_EVENT(nfsd_copy_err_class, nfsd_##name,		\
 548	TP_PROTO(struct svc_rqst	*rqstp,		\
 549		 struct svc_fh		*src_fhp,	\
 550		 loff_t			src_offset,	\
 551		 struct svc_fh		*dst_fhp,	\
 552		 loff_t			dst_offset,	\
 553		 u64			count,		\
 554		 int			status),	\
 555	TP_ARGS(rqstp, src_fhp, src_offset, dst_fhp, dst_offset, \
 556		count, status))
 557
 558DEFINE_NFSD_COPY_ERR_EVENT(clone_file_range_err);
 559
 560#include "state.h"
 561#include "filecache.h"
 562#include "vfs.h"
 563
 564TRACE_EVENT(nfsd_delegret_wakeup,
 565	TP_PROTO(
 566		const struct svc_rqst *rqstp,
 567		const struct inode *inode,
 568		long timeo
 569	),
 570	TP_ARGS(rqstp, inode, timeo),
 571	TP_STRUCT__entry(
 572		__field(u32, xid)
 573		__field(const void *, inode)
 574		__field(long, timeo)
 575	),
 576	TP_fast_assign(
 577		__entry->xid = be32_to_cpu(rqstp->rq_xid);
 578		__entry->inode = inode;
 579		__entry->timeo = timeo;
 580	),
 581	TP_printk("xid=0x%08x inode=%p%s",
 582		  __entry->xid, __entry->inode,
 583		  __entry->timeo == 0 ? " (timed out)" : ""
 584	)
 585);
 586
 587DECLARE_EVENT_CLASS(nfsd_stateid_class,
 588	TP_PROTO(stateid_t *stp),
 589	TP_ARGS(stp),
 590	TP_STRUCT__entry(
 591		__field(u32, cl_boot)
 592		__field(u32, cl_id)
 593		__field(u32, si_id)
 594		__field(u32, si_generation)
 595	),
 596	TP_fast_assign(
 597		__entry->cl_boot = stp->si_opaque.so_clid.cl_boot;
 598		__entry->cl_id = stp->si_opaque.so_clid.cl_id;
 599		__entry->si_id = stp->si_opaque.so_id;
 600		__entry->si_generation = stp->si_generation;
 601	),
 602	TP_printk("client %08x:%08x stateid %08x:%08x",
 603		__entry->cl_boot,
 604		__entry->cl_id,
 605		__entry->si_id,
 606		__entry->si_generation)
 607)
 608
 609#define DEFINE_STATEID_EVENT(name) \
 610DEFINE_EVENT(nfsd_stateid_class, nfsd_##name, \
 611	TP_PROTO(stateid_t *stp), \
 612	TP_ARGS(stp))
 613
 614DEFINE_STATEID_EVENT(layoutstate_alloc);
 615DEFINE_STATEID_EVENT(layoutstate_unhash);
 616DEFINE_STATEID_EVENT(layoutstate_free);
 617DEFINE_STATEID_EVENT(layout_get_lookup_fail);
 618DEFINE_STATEID_EVENT(layout_commit_lookup_fail);
 619DEFINE_STATEID_EVENT(layout_return_lookup_fail);
 620DEFINE_STATEID_EVENT(layout_recall);
 621DEFINE_STATEID_EVENT(layout_recall_done);
 622DEFINE_STATEID_EVENT(layout_recall_fail);
 623DEFINE_STATEID_EVENT(layout_recall_release);
 624
 625DEFINE_STATEID_EVENT(open);
 626DEFINE_STATEID_EVENT(deleg_read);
 627DEFINE_STATEID_EVENT(deleg_write);
 628DEFINE_STATEID_EVENT(deleg_return);
 629DEFINE_STATEID_EVENT(deleg_recall);
 630
 631DECLARE_EVENT_CLASS(nfsd_stateseqid_class,
 632	TP_PROTO(u32 seqid, const stateid_t *stp),
 633	TP_ARGS(seqid, stp),
 634	TP_STRUCT__entry(
 635		__field(u32, seqid)
 636		__field(u32, cl_boot)
 637		__field(u32, cl_id)
 638		__field(u32, si_id)
 639		__field(u32, si_generation)
 640	),
 641	TP_fast_assign(
 642		__entry->seqid = seqid;
 643		__entry->cl_boot = stp->si_opaque.so_clid.cl_boot;
 644		__entry->cl_id = stp->si_opaque.so_clid.cl_id;
 645		__entry->si_id = stp->si_opaque.so_id;
 646		__entry->si_generation = stp->si_generation;
 647	),
 648	TP_printk("seqid=%u client %08x:%08x stateid %08x:%08x",
 649		__entry->seqid, __entry->cl_boot, __entry->cl_id,
 650		__entry->si_id, __entry->si_generation)
 651)
 652
 653#define DEFINE_STATESEQID_EVENT(name) \
 654DEFINE_EVENT(nfsd_stateseqid_class, nfsd_##name, \
 655	TP_PROTO(u32 seqid, const stateid_t *stp), \
 656	TP_ARGS(seqid, stp))
 657
 658DEFINE_STATESEQID_EVENT(preprocess);
 659DEFINE_STATESEQID_EVENT(open_confirm);
 660
 661#define show_stid_type(x)						\
 662	__print_flags(x, "|",						\
 663		{ SC_TYPE_OPEN,		"OPEN" },		\
 664		{ SC_TYPE_LOCK,		"LOCK" },		\
 665		{ SC_TYPE_DELEG,		"DELEG" },		\
 666		{ SC_TYPE_LAYOUT,		"LAYOUT" })
 
 667
 668#define show_stid_status(x)						\
 669	__print_flags(x, "|",						\
 670		{ SC_STATUS_CLOSED,		"CLOSED" },		\
 671		{ SC_STATUS_REVOKED,		"REVOKED" },		\
 672		{ SC_STATUS_ADMIN_REVOKED,	"ADMIN_REVOKED" })
 
 
 
 
 673
 674DECLARE_EVENT_CLASS(nfsd_stid_class,
 675	TP_PROTO(
 676		const struct nfs4_stid *stid
 677	),
 678	TP_ARGS(stid),
 679	TP_STRUCT__entry(
 680		__field(unsigned long, sc_type)
 681		__field(unsigned long, sc_status)
 682		__field(int, sc_count)
 683		__field(u32, cl_boot)
 684		__field(u32, cl_id)
 685		__field(u32, si_id)
 686		__field(u32, si_generation)
 687	),
 688	TP_fast_assign(
 689		const stateid_t *stp = &stid->sc_stateid;
 690
 691		__entry->sc_type = stid->sc_type;
 692		__entry->sc_status = stid->sc_status;
 693		__entry->sc_count = refcount_read(&stid->sc_count);
 694		__entry->cl_boot = stp->si_opaque.so_clid.cl_boot;
 695		__entry->cl_id = stp->si_opaque.so_clid.cl_id;
 696		__entry->si_id = stp->si_opaque.so_id;
 697		__entry->si_generation = stp->si_generation;
 698	),
 699	TP_printk("client %08x:%08x stateid %08x:%08x ref=%d type=%s state=%s",
 700		__entry->cl_boot, __entry->cl_id,
 701		__entry->si_id, __entry->si_generation,
 702		__entry->sc_count, show_stid_type(__entry->sc_type),
 703		show_stid_status(__entry->sc_status)
 704	)
 705);
 706
 707#define DEFINE_STID_EVENT(name)					\
 708DEFINE_EVENT(nfsd_stid_class, nfsd_stid_##name,			\
 709	TP_PROTO(const struct nfs4_stid *stid),			\
 710	TP_ARGS(stid))
 711
 712DEFINE_STID_EVENT(revoke);
 713
 714TRACE_EVENT(nfsd_stateowner_replay,
 715	TP_PROTO(
 716		u32 opnum,
 717		const struct nfs4_replay *rp
 718	),
 719	TP_ARGS(opnum, rp),
 720	TP_STRUCT__entry(
 721		__field(unsigned long, status)
 722		__field(u32, opnum)
 723	),
 724	TP_fast_assign(
 725		__entry->status = be32_to_cpu(rp->rp_status);
 726		__entry->opnum = opnum;
 727	),
 728	TP_printk("opnum=%u status=%lu",
 729		__entry->opnum, __entry->status)
 730);
 731
 732TRACE_EVENT_CONDITION(nfsd_seq4_status,
 733	TP_PROTO(
 734		const struct svc_rqst *rqstp,
 735		const struct nfsd4_sequence *sequence
 736	),
 737	TP_ARGS(rqstp, sequence),
 738	TP_CONDITION(sequence->status_flags),
 739	TP_STRUCT__entry(
 740		__field(unsigned int, netns_ino)
 741		__field(u32, xid)
 742		__field(u32, cl_boot)
 743		__field(u32, cl_id)
 744		__field(u32, seqno)
 745		__field(u32, reserved)
 746		__field(unsigned long, status_flags)
 747	),
 748	TP_fast_assign(
 749		const struct nfsd4_sessionid *sid =
 750			(struct nfsd4_sessionid *)&sequence->sessionid;
 751
 752		__entry->netns_ino = SVC_NET(rqstp)->ns.inum;
 753		__entry->xid = be32_to_cpu(rqstp->rq_xid);
 754		__entry->cl_boot = sid->clientid.cl_boot;
 755		__entry->cl_id = sid->clientid.cl_id;
 756		__entry->seqno = sid->sequence;
 757		__entry->reserved = sid->reserved;
 758		__entry->status_flags = sequence->status_flags;
 759	),
 760	TP_printk("xid=0x%08x sessionid=%08x:%08x:%08x:%08x status_flags=%s",
 761		__entry->xid, __entry->cl_boot, __entry->cl_id,
 762		__entry->seqno, __entry->reserved,
 763		show_nfs4_seq4_status(__entry->status_flags)
 764	)
 765);
 766
 767DECLARE_EVENT_CLASS(nfsd_cs_slot_class,
 768	TP_PROTO(
 769		const struct nfs4_client *clp,
 770		const struct nfsd4_create_session *cs
 771	),
 772	TP_ARGS(clp, cs),
 773	TP_STRUCT__entry(
 774		__field(u32, seqid)
 775		__field(u32, slot_seqid)
 776		__field(u32, cl_boot)
 777		__field(u32, cl_id)
 778		__sockaddr(addr, clp->cl_cb_conn.cb_addrlen)
 779	),
 780	TP_fast_assign(
 781		const struct nfsd4_clid_slot *slot = &clp->cl_cs_slot;
 782
 783		__entry->cl_boot = clp->cl_clientid.cl_boot;
 784		__entry->cl_id = clp->cl_clientid.cl_id;
 785		__assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr,
 786				  clp->cl_cb_conn.cb_addrlen);
 787		__entry->seqid = cs->seqid;
 788		__entry->slot_seqid = slot->sl_seqid;
 789	),
 790	TP_printk("addr=%pISpc client %08x:%08x seqid=%u slot_seqid=%u",
 791		__get_sockaddr(addr), __entry->cl_boot, __entry->cl_id,
 792		__entry->seqid, __entry->slot_seqid
 793	)
 794);
 795
 796#define DEFINE_CS_SLOT_EVENT(name) \
 797DEFINE_EVENT(nfsd_cs_slot_class, nfsd_##name, \
 798	TP_PROTO( \
 799		const struct nfs4_client *clp, \
 800		const struct nfsd4_create_session *cs \
 801	), \
 802	TP_ARGS(clp, cs))
 803
 804DEFINE_CS_SLOT_EVENT(slot_seqid_conf);
 805DEFINE_CS_SLOT_EVENT(slot_seqid_unconf);
 806
 807TRACE_EVENT(nfsd_slot_seqid_sequence,
 808	TP_PROTO(
 809		const struct nfs4_client *clp,
 810		const struct nfsd4_sequence *seq,
 811		const struct nfsd4_slot *slot
 812	),
 813	TP_ARGS(clp, seq, slot),
 814	TP_STRUCT__entry(
 815		__field(u32, seqid)
 816		__field(u32, slot_seqid)
 817		__field(u32, cl_boot)
 818		__field(u32, cl_id)
 819		__sockaddr(addr, clp->cl_cb_conn.cb_addrlen)
 820		__field(bool, in_use)
 821	),
 822	TP_fast_assign(
 823		__entry->cl_boot = clp->cl_clientid.cl_boot;
 824		__entry->cl_id = clp->cl_clientid.cl_id;
 825		__assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr,
 826				  clp->cl_cb_conn.cb_addrlen);
 827		__entry->seqid = seq->seqid;
 828		__entry->slot_seqid = slot->sl_seqid;
 829	),
 830	TP_printk("addr=%pISpc client %08x:%08x seqid=%u slot_seqid=%u (%sin use)",
 831		__get_sockaddr(addr), __entry->cl_boot, __entry->cl_id,
 832		__entry->seqid, __entry->slot_seqid,
 833		__entry->in_use ? "" : "not "
 834	)
 835);
 836
 837DECLARE_EVENT_CLASS(nfsd_clientid_class,
 838	TP_PROTO(const clientid_t *clid),
 839	TP_ARGS(clid),
 840	TP_STRUCT__entry(
 841		__field(u32, cl_boot)
 842		__field(u32, cl_id)
 843	),
 844	TP_fast_assign(
 845		__entry->cl_boot = clid->cl_boot;
 846		__entry->cl_id = clid->cl_id;
 847	),
 848	TP_printk("client %08x:%08x", __entry->cl_boot, __entry->cl_id)
 849)
 850
 851#define DEFINE_CLIENTID_EVENT(name) \
 852DEFINE_EVENT(nfsd_clientid_class, nfsd_clid_##name, \
 853	TP_PROTO(const clientid_t *clid), \
 854	TP_ARGS(clid))
 855
 856DEFINE_CLIENTID_EVENT(expire_unconf);
 857DEFINE_CLIENTID_EVENT(reclaim_complete);
 858DEFINE_CLIENTID_EVENT(confirmed);
 859DEFINE_CLIENTID_EVENT(destroyed);
 860DEFINE_CLIENTID_EVENT(admin_expired);
 861DEFINE_CLIENTID_EVENT(replaced);
 862DEFINE_CLIENTID_EVENT(purged);
 863DEFINE_CLIENTID_EVENT(renew);
 864DEFINE_CLIENTID_EVENT(stale);
 865
 866TRACE_EVENT(nfsd_mark_client_expired,
 867	TP_PROTO(
 868		const struct nfs4_client *clp,
 869		int cl_rpc_users
 870	),
 871	TP_ARGS(clp, cl_rpc_users),
 872	TP_STRUCT__entry(
 873		__field(int, cl_rpc_users)
 874		__field(u32, cl_boot)
 875		__field(u32, cl_id)
 876		__sockaddr(addr, clp->cl_cb_conn.cb_addrlen)
 877	),
 878	TP_fast_assign(
 879		__entry->cl_rpc_users = cl_rpc_users;
 880		__entry->cl_boot = clp->cl_clientid.cl_boot;
 881		__entry->cl_id = clp->cl_clientid.cl_id;
 882		__assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr,
 883				  clp->cl_cb_conn.cb_addrlen)
 884	),
 885	TP_printk("addr=%pISpc client %08x:%08x cl_rpc_users=%d",
 886		__get_sockaddr(addr), __entry->cl_boot, __entry->cl_id,
 887		__entry->cl_rpc_users)
 888);
 889
 890DECLARE_EVENT_CLASS(nfsd_net_class,
 891	TP_PROTO(const struct nfsd_net *nn),
 892	TP_ARGS(nn),
 893	TP_STRUCT__entry(
 894		__field(unsigned long long, boot_time)
 895	),
 896	TP_fast_assign(
 897		__entry->boot_time = nn->boot_time;
 898	),
 899	TP_printk("boot_time=%16llx", __entry->boot_time)
 900)
 901
 902#define DEFINE_NET_EVENT(name) \
 903DEFINE_EVENT(nfsd_net_class, nfsd_##name, \
 904	TP_PROTO(const struct nfsd_net *nn), \
 905	TP_ARGS(nn))
 906
 907DEFINE_NET_EVENT(grace_start);
 908DEFINE_NET_EVENT(grace_complete);
 909
 910TRACE_EVENT(nfsd_writeverf_reset,
 911	TP_PROTO(
 912		const struct nfsd_net *nn,
 913		const struct svc_rqst *rqstp,
 914		int error
 915	),
 916	TP_ARGS(nn, rqstp, error),
 917	TP_STRUCT__entry(
 918		__field(unsigned long long, boot_time)
 919		__field(u32, xid)
 920		__field(int, error)
 921		__array(unsigned char, verifier, NFS4_VERIFIER_SIZE)
 922	),
 923	TP_fast_assign(
 924		__entry->boot_time = nn->boot_time;
 925		__entry->xid = be32_to_cpu(rqstp->rq_xid);
 926		__entry->error = error;
 927
 928		/* avoid seqlock inside TP_fast_assign */
 929		memcpy(__entry->verifier, nn->writeverf,
 930		       NFS4_VERIFIER_SIZE);
 931	),
 932	TP_printk("boot_time=%16llx xid=0x%08x error=%d new verifier=0x%s",
 933		__entry->boot_time, __entry->xid, __entry->error,
 934		__print_hex_str(__entry->verifier, NFS4_VERIFIER_SIZE)
 935	)
 936);
 937
 938TRACE_EVENT(nfsd_clid_cred_mismatch,
 939	TP_PROTO(
 940		const struct nfs4_client *clp,
 941		const struct svc_rqst *rqstp
 942	),
 943	TP_ARGS(clp, rqstp),
 944	TP_STRUCT__entry(
 945		__field(u32, cl_boot)
 946		__field(u32, cl_id)
 947		__field(unsigned long, cl_flavor)
 948		__field(unsigned long, new_flavor)
 949		__sockaddr(addr, rqstp->rq_xprt->xpt_remotelen)
 950	),
 951	TP_fast_assign(
 952		__entry->cl_boot = clp->cl_clientid.cl_boot;
 953		__entry->cl_id = clp->cl_clientid.cl_id;
 954		__entry->cl_flavor = clp->cl_cred.cr_flavor;
 955		__entry->new_flavor = rqstp->rq_cred.cr_flavor;
 956		__assign_sockaddr(addr, &rqstp->rq_xprt->xpt_remote,
 957				  rqstp->rq_xprt->xpt_remotelen);
 958	),
 959	TP_printk("client %08x:%08x flavor=%s, conflict=%s from addr=%pISpc",
 960		__entry->cl_boot, __entry->cl_id,
 961		show_nfsd_authflavor(__entry->cl_flavor),
 962		show_nfsd_authflavor(__entry->new_flavor),
 963		__get_sockaddr(addr)
 964	)
 965)
 966
 967TRACE_EVENT(nfsd_clid_verf_mismatch,
 968	TP_PROTO(
 969		const struct nfs4_client *clp,
 970		const struct svc_rqst *rqstp,
 971		const nfs4_verifier *verf
 972	),
 973	TP_ARGS(clp, rqstp, verf),
 974	TP_STRUCT__entry(
 975		__field(u32, cl_boot)
 976		__field(u32, cl_id)
 977		__array(unsigned char, cl_verifier, NFS4_VERIFIER_SIZE)
 978		__array(unsigned char, new_verifier, NFS4_VERIFIER_SIZE)
 979		__sockaddr(addr, rqstp->rq_xprt->xpt_remotelen)
 980	),
 981	TP_fast_assign(
 982		__entry->cl_boot = clp->cl_clientid.cl_boot;
 983		__entry->cl_id = clp->cl_clientid.cl_id;
 984		memcpy(__entry->cl_verifier, (void *)&clp->cl_verifier,
 985		       NFS4_VERIFIER_SIZE);
 986		memcpy(__entry->new_verifier, (void *)verf,
 987		       NFS4_VERIFIER_SIZE);
 988		__assign_sockaddr(addr, &rqstp->rq_xprt->xpt_remote,
 989				  rqstp->rq_xprt->xpt_remotelen);
 990	),
 991	TP_printk("client %08x:%08x verf=0x%s, updated=0x%s from addr=%pISpc",
 992		__entry->cl_boot, __entry->cl_id,
 993		__print_hex_str(__entry->cl_verifier, NFS4_VERIFIER_SIZE),
 994		__print_hex_str(__entry->new_verifier, NFS4_VERIFIER_SIZE),
 995		__get_sockaddr(addr)
 996	)
 997);
 998
 999DECLARE_EVENT_CLASS(nfsd_clid_class,
1000	TP_PROTO(const struct nfs4_client *clp),
1001	TP_ARGS(clp),
1002	TP_STRUCT__entry(
1003		__field(u32, cl_boot)
1004		__field(u32, cl_id)
1005		__array(unsigned char, addr, sizeof(struct sockaddr_in6))
1006		__field(unsigned long, flavor)
1007		__array(unsigned char, verifier, NFS4_VERIFIER_SIZE)
1008		__string_len(name, clp->cl_name.data, clp->cl_name.len)
1009	),
1010	TP_fast_assign(
1011		__entry->cl_boot = clp->cl_clientid.cl_boot;
1012		__entry->cl_id = clp->cl_clientid.cl_id;
1013		memcpy(__entry->addr, &clp->cl_addr,
1014			sizeof(struct sockaddr_in6));
1015		__entry->flavor = clp->cl_cred.cr_flavor;
1016		memcpy(__entry->verifier, (void *)&clp->cl_verifier,
1017		       NFS4_VERIFIER_SIZE);
1018		__assign_str(name);
1019	),
1020	TP_printk("addr=%pISpc name='%s' verifier=0x%s flavor=%s client=%08x:%08x",
1021		__entry->addr, __get_str(name),
1022		__print_hex_str(__entry->verifier, NFS4_VERIFIER_SIZE),
1023		show_nfsd_authflavor(__entry->flavor),
1024		__entry->cl_boot, __entry->cl_id)
1025);
1026
1027#define DEFINE_CLID_EVENT(name) \
1028DEFINE_EVENT(nfsd_clid_class, nfsd_clid_##name, \
1029	TP_PROTO(const struct nfs4_client *clp), \
1030	TP_ARGS(clp))
1031
1032DEFINE_CLID_EVENT(fresh);
1033DEFINE_CLID_EVENT(confirmed_r);
1034
1035/*
1036 * from fs/nfsd/filecache.h
1037 */
1038#define show_nf_flags(val)						\
1039	__print_flags(val, "|",						\
1040		{ 1 << NFSD_FILE_HASHED,	"HASHED" },		\
1041		{ 1 << NFSD_FILE_PENDING,	"PENDING" },		\
1042		{ 1 << NFSD_FILE_REFERENCED,	"REFERENCED" },		\
1043		{ 1 << NFSD_FILE_GC,		"GC" })
1044
1045DECLARE_EVENT_CLASS(nfsd_file_class,
1046	TP_PROTO(struct nfsd_file *nf),
1047	TP_ARGS(nf),
1048	TP_STRUCT__entry(
1049		__field(void *, nf_inode)
1050		__field(int, nf_ref)
1051		__field(unsigned long, nf_flags)
1052		__field(unsigned char, nf_may)
1053		__field(struct file *, nf_file)
1054	),
1055	TP_fast_assign(
1056		__entry->nf_inode = nf->nf_inode;
1057		__entry->nf_ref = refcount_read(&nf->nf_ref);
1058		__entry->nf_flags = nf->nf_flags;
1059		__entry->nf_may = nf->nf_may;
1060		__entry->nf_file = nf->nf_file;
1061	),
1062	TP_printk("inode=%p ref=%d flags=%s may=%s nf_file=%p",
1063		__entry->nf_inode,
1064		__entry->nf_ref,
1065		show_nf_flags(__entry->nf_flags),
1066		show_nfsd_may_flags(__entry->nf_may),
1067		__entry->nf_file)
1068)
1069
1070#define DEFINE_NFSD_FILE_EVENT(name) \
1071DEFINE_EVENT(nfsd_file_class, name, \
1072	TP_PROTO(struct nfsd_file *nf), \
1073	TP_ARGS(nf))
1074
1075DEFINE_NFSD_FILE_EVENT(nfsd_file_free);
1076DEFINE_NFSD_FILE_EVENT(nfsd_file_unhash);
1077DEFINE_NFSD_FILE_EVENT(nfsd_file_put);
1078DEFINE_NFSD_FILE_EVENT(nfsd_file_closing);
1079DEFINE_NFSD_FILE_EVENT(nfsd_file_unhash_and_queue);
1080
1081TRACE_EVENT(nfsd_file_alloc,
1082	TP_PROTO(
1083		const struct nfsd_file *nf
1084	),
1085	TP_ARGS(nf),
1086	TP_STRUCT__entry(
1087		__field(const void *, nf_inode)
1088		__field(unsigned long, nf_flags)
1089		__field(unsigned long, nf_may)
1090		__field(unsigned int, nf_ref)
1091	),
1092	TP_fast_assign(
1093		__entry->nf_inode = nf->nf_inode;
1094		__entry->nf_flags = nf->nf_flags;
1095		__entry->nf_ref = refcount_read(&nf->nf_ref);
1096		__entry->nf_may = nf->nf_may;
1097	),
1098	TP_printk("inode=%p ref=%u flags=%s may=%s",
1099		__entry->nf_inode, __entry->nf_ref,
1100		show_nf_flags(__entry->nf_flags),
1101		show_nfsd_may_flags(__entry->nf_may)
1102	)
1103);
1104
1105TRACE_EVENT(nfsd_file_acquire,
1106	TP_PROTO(
1107		const struct svc_rqst *rqstp,
1108		const struct inode *inode,
1109		unsigned int may_flags,
1110		const struct nfsd_file *nf,
1111		__be32 status
1112	),
1113
1114	TP_ARGS(rqstp, inode, may_flags, nf, status),
1115
1116	TP_STRUCT__entry(
1117		__field(u32, xid)
1118		__field(const void *, inode)
1119		__field(unsigned long, may_flags)
1120		__field(unsigned int, nf_ref)
1121		__field(unsigned long, nf_flags)
1122		__field(unsigned long, nf_may)
1123		__field(const void *, nf_file)
1124		__field(u32, status)
1125	),
1126
1127	TP_fast_assign(
1128		__entry->xid = rqstp ? be32_to_cpu(rqstp->rq_xid) : 0;
1129		__entry->inode = inode;
1130		__entry->may_flags = may_flags;
1131		__entry->nf_ref = nf ? refcount_read(&nf->nf_ref) : 0;
1132		__entry->nf_flags = nf ? nf->nf_flags : 0;
1133		__entry->nf_may = nf ? nf->nf_may : 0;
1134		__entry->nf_file = nf ? nf->nf_file : NULL;
1135		__entry->status = be32_to_cpu(status);
1136	),
1137
1138	TP_printk("xid=0x%x inode=%p may_flags=%s ref=%u nf_flags=%s nf_may=%s nf_file=%p status=%u",
1139			__entry->xid, __entry->inode,
1140			show_nfsd_may_flags(__entry->may_flags),
1141			__entry->nf_ref, show_nf_flags(__entry->nf_flags),
1142			show_nfsd_may_flags(__entry->nf_may),
1143			__entry->nf_file, __entry->status
1144	)
1145);
1146
1147TRACE_EVENT(nfsd_file_insert_err,
1148	TP_PROTO(
1149		const struct svc_rqst *rqstp,
1150		const struct inode *inode,
1151		unsigned int may_flags,
1152		long error
1153	),
1154	TP_ARGS(rqstp, inode, may_flags, error),
1155	TP_STRUCT__entry(
1156		__field(u32, xid)
1157		__field(const void *, inode)
1158		__field(unsigned long, may_flags)
1159		__field(long, error)
1160	),
1161	TP_fast_assign(
1162		__entry->xid = rqstp ? be32_to_cpu(rqstp->rq_xid) : 0;
1163		__entry->inode = inode;
1164		__entry->may_flags = may_flags;
1165		__entry->error = error;
1166	),
1167	TP_printk("xid=0x%x inode=%p may_flags=%s error=%ld",
1168		__entry->xid, __entry->inode,
1169		show_nfsd_may_flags(__entry->may_flags),
1170		__entry->error
1171	)
1172);
1173
1174TRACE_EVENT(nfsd_file_cons_err,
1175	TP_PROTO(
1176		const struct svc_rqst *rqstp,
1177		const struct inode *inode,
1178		unsigned int may_flags,
1179		const struct nfsd_file *nf
1180	),
1181	TP_ARGS(rqstp, inode, may_flags, nf),
1182	TP_STRUCT__entry(
1183		__field(u32, xid)
1184		__field(const void *, inode)
1185		__field(unsigned long, may_flags)
1186		__field(unsigned int, nf_ref)
1187		__field(unsigned long, nf_flags)
1188		__field(unsigned long, nf_may)
1189		__field(const void *, nf_file)
1190	),
1191	TP_fast_assign(
1192		__entry->xid = rqstp ? be32_to_cpu(rqstp->rq_xid) : 0;
1193		__entry->inode = inode;
1194		__entry->may_flags = may_flags;
1195		__entry->nf_ref = refcount_read(&nf->nf_ref);
1196		__entry->nf_flags = nf->nf_flags;
1197		__entry->nf_may = nf->nf_may;
1198		__entry->nf_file = nf->nf_file;
1199	),
1200	TP_printk("xid=0x%x inode=%p may_flags=%s ref=%u nf_flags=%s nf_may=%s nf_file=%p",
1201		__entry->xid, __entry->inode,
1202		show_nfsd_may_flags(__entry->may_flags), __entry->nf_ref,
1203		show_nf_flags(__entry->nf_flags),
1204		show_nfsd_may_flags(__entry->nf_may), __entry->nf_file
1205	)
1206);
1207
1208DECLARE_EVENT_CLASS(nfsd_file_open_class,
1209	TP_PROTO(const struct nfsd_file *nf, __be32 status),
1210	TP_ARGS(nf, status),
1211	TP_STRUCT__entry(
1212		__field(void *, nf_inode)	/* cannot be dereferenced */
1213		__field(int, nf_ref)
1214		__field(unsigned long, nf_flags)
1215		__field(unsigned long, nf_may)
1216		__field(void *, nf_file)	/* cannot be dereferenced */
1217	),
1218	TP_fast_assign(
1219		__entry->nf_inode = nf->nf_inode;
1220		__entry->nf_ref = refcount_read(&nf->nf_ref);
1221		__entry->nf_flags = nf->nf_flags;
1222		__entry->nf_may = nf->nf_may;
1223		__entry->nf_file = nf->nf_file;
1224	),
1225	TP_printk("inode=%p ref=%d flags=%s may=%s file=%p",
1226		__entry->nf_inode,
1227		__entry->nf_ref,
1228		show_nf_flags(__entry->nf_flags),
1229		show_nfsd_may_flags(__entry->nf_may),
1230		__entry->nf_file)
1231)
1232
1233#define DEFINE_NFSD_FILE_OPEN_EVENT(name)					\
1234DEFINE_EVENT(nfsd_file_open_class, name,					\
1235	TP_PROTO(							\
1236		const struct nfsd_file *nf,				\
1237		__be32 status						\
1238	),								\
1239	TP_ARGS(nf, status))
1240
1241DEFINE_NFSD_FILE_OPEN_EVENT(nfsd_file_open);
1242DEFINE_NFSD_FILE_OPEN_EVENT(nfsd_file_opened);
1243
1244TRACE_EVENT(nfsd_file_is_cached,
1245	TP_PROTO(
1246		const struct inode *inode,
1247		int found
1248	),
1249	TP_ARGS(inode, found),
1250	TP_STRUCT__entry(
1251		__field(const struct inode *, inode)
1252		__field(int, found)
1253	),
1254	TP_fast_assign(
1255		__entry->inode = inode;
1256		__entry->found = found;
1257	),
1258	TP_printk("inode=%p is %scached",
1259		__entry->inode,
1260		__entry->found ? "" : "not "
1261	)
1262);
1263
1264TRACE_EVENT(nfsd_file_fsnotify_handle_event,
1265	TP_PROTO(struct inode *inode, u32 mask),
1266	TP_ARGS(inode, mask),
1267	TP_STRUCT__entry(
1268		__field(struct inode *, inode)
1269		__field(unsigned int, nlink)
1270		__field(umode_t, mode)
1271		__field(u32, mask)
1272	),
1273	TP_fast_assign(
1274		__entry->inode = inode;
1275		__entry->nlink = inode->i_nlink;
1276		__entry->mode = inode->i_mode;
1277		__entry->mask = mask;
1278	),
1279	TP_printk("inode=%p nlink=%u mode=0%ho mask=0x%x", __entry->inode,
1280			__entry->nlink, __entry->mode, __entry->mask)
1281);
1282
1283DECLARE_EVENT_CLASS(nfsd_file_gc_class,
1284	TP_PROTO(
1285		const struct nfsd_file *nf
1286	),
1287	TP_ARGS(nf),
1288	TP_STRUCT__entry(
1289		__field(void *, nf_inode)
1290		__field(void *, nf_file)
1291		__field(int, nf_ref)
1292		__field(unsigned long, nf_flags)
1293	),
1294	TP_fast_assign(
1295		__entry->nf_inode = nf->nf_inode;
1296		__entry->nf_file = nf->nf_file;
1297		__entry->nf_ref = refcount_read(&nf->nf_ref);
1298		__entry->nf_flags = nf->nf_flags;
1299	),
1300	TP_printk("inode=%p ref=%d nf_flags=%s nf_file=%p",
1301		__entry->nf_inode, __entry->nf_ref,
1302		show_nf_flags(__entry->nf_flags),
1303		__entry->nf_file
1304	)
1305);
1306
1307#define DEFINE_NFSD_FILE_GC_EVENT(name)					\
1308DEFINE_EVENT(nfsd_file_gc_class, name,					\
1309	TP_PROTO(							\
1310		const struct nfsd_file *nf				\
1311	),								\
1312	TP_ARGS(nf))
1313
1314DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_lru_add);
1315DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_lru_add_disposed);
1316DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_lru_del);
1317DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_lru_del_disposed);
1318DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_gc_in_use);
1319DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_gc_writeback);
1320DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_gc_referenced);
1321DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_gc_disposed);
1322
1323DECLARE_EVENT_CLASS(nfsd_file_lruwalk_class,
1324	TP_PROTO(
1325		unsigned long removed,
1326		unsigned long remaining
1327	),
1328	TP_ARGS(removed, remaining),
1329	TP_STRUCT__entry(
1330		__field(unsigned long, removed)
1331		__field(unsigned long, remaining)
1332	),
1333	TP_fast_assign(
1334		__entry->removed = removed;
1335		__entry->remaining = remaining;
1336	),
1337	TP_printk("%lu entries removed, %lu remaining",
1338		__entry->removed, __entry->remaining)
1339);
1340
1341#define DEFINE_NFSD_FILE_LRUWALK_EVENT(name)				\
1342DEFINE_EVENT(nfsd_file_lruwalk_class, name,				\
1343	TP_PROTO(							\
1344		unsigned long removed,					\
1345		unsigned long remaining					\
1346	),								\
1347	TP_ARGS(removed, remaining))
1348
1349DEFINE_NFSD_FILE_LRUWALK_EVENT(nfsd_file_gc_removed);
1350DEFINE_NFSD_FILE_LRUWALK_EVENT(nfsd_file_shrinker_removed);
1351
1352TRACE_EVENT(nfsd_file_close,
1353	TP_PROTO(
1354		const struct inode *inode
1355	),
1356	TP_ARGS(inode),
1357	TP_STRUCT__entry(
1358		__field(const void *, inode)
1359	),
1360	TP_fast_assign(
1361		__entry->inode = inode;
1362	),
1363	TP_printk("inode=%p",
1364		__entry->inode
1365	)
1366);
1367
1368#include "cache.h"
1369
1370TRACE_DEFINE_ENUM(RC_DROPIT);
1371TRACE_DEFINE_ENUM(RC_REPLY);
1372TRACE_DEFINE_ENUM(RC_DOIT);
1373
1374#define show_drc_retval(x)						\
1375	__print_symbolic(x,						\
1376		{ RC_DROPIT, "DROPIT" },				\
1377		{ RC_REPLY, "REPLY" },					\
1378		{ RC_DOIT, "DOIT" })
1379
1380TRACE_EVENT(nfsd_drc_found,
1381	TP_PROTO(
1382		const struct nfsd_net *nn,
1383		const struct svc_rqst *rqstp,
1384		int result
1385	),
1386	TP_ARGS(nn, rqstp, result),
1387	TP_STRUCT__entry(
1388		__field(unsigned long long, boot_time)
1389		__field(unsigned long, result)
1390		__field(u32, xid)
1391	),
1392	TP_fast_assign(
1393		__entry->boot_time = nn->boot_time;
1394		__entry->result = result;
1395		__entry->xid = be32_to_cpu(rqstp->rq_xid);
1396	),
1397	TP_printk("boot_time=%16llx xid=0x%08x result=%s",
1398		__entry->boot_time, __entry->xid,
1399		show_drc_retval(__entry->result))
1400
1401);
1402
1403TRACE_EVENT(nfsd_drc_mismatch,
1404	TP_PROTO(
1405		const struct nfsd_net *nn,
1406		const struct nfsd_cacherep *key,
1407		const struct nfsd_cacherep *rp
1408	),
1409	TP_ARGS(nn, key, rp),
1410	TP_STRUCT__entry(
1411		__field(unsigned long long, boot_time)
1412		__field(u32, xid)
1413		__field(u32, cached)
1414		__field(u32, ingress)
1415	),
1416	TP_fast_assign(
1417		__entry->boot_time = nn->boot_time;
1418		__entry->xid = be32_to_cpu(key->c_key.k_xid);
1419		__entry->cached = (__force u32)key->c_key.k_csum;
1420		__entry->ingress = (__force u32)rp->c_key.k_csum;
1421	),
1422	TP_printk("boot_time=%16llx xid=0x%08x cached-csum=0x%08x ingress-csum=0x%08x",
1423		__entry->boot_time, __entry->xid, __entry->cached,
1424		__entry->ingress)
1425);
1426
1427TRACE_EVENT(nfsd_cb_args,
1428	TP_PROTO(
1429		const struct nfs4_client *clp,
1430		const struct nfs4_cb_conn *conn
1431	),
1432	TP_ARGS(clp, conn),
1433	TP_STRUCT__entry(
1434		__field(u32, cl_boot)
1435		__field(u32, cl_id)
1436		__field(u32, prog)
1437		__field(u32, ident)
1438		__sockaddr(addr, conn->cb_addrlen)
1439	),
1440	TP_fast_assign(
1441		__entry->cl_boot = clp->cl_clientid.cl_boot;
1442		__entry->cl_id = clp->cl_clientid.cl_id;
1443		__entry->prog = conn->cb_prog;
1444		__entry->ident = conn->cb_ident;
1445		__assign_sockaddr(addr, &conn->cb_addr, conn->cb_addrlen);
1446	),
1447	TP_printk("addr=%pISpc client %08x:%08x prog=%u ident=%u",
1448		__get_sockaddr(addr), __entry->cl_boot, __entry->cl_id,
1449		__entry->prog, __entry->ident)
1450);
1451
1452TRACE_EVENT(nfsd_cb_nodelegs,
1453	TP_PROTO(const struct nfs4_client *clp),
1454	TP_ARGS(clp),
1455	TP_STRUCT__entry(
1456		__field(u32, cl_boot)
1457		__field(u32, cl_id)
1458	),
1459	TP_fast_assign(
1460		__entry->cl_boot = clp->cl_clientid.cl_boot;
1461		__entry->cl_id = clp->cl_clientid.cl_id;
1462	),
1463	TP_printk("client %08x:%08x", __entry->cl_boot, __entry->cl_id)
1464)
1465
1466#define show_cb_state(val)						\
1467	__print_symbolic(val,						\
1468		{ NFSD4_CB_UP,		"UP" },				\
1469		{ NFSD4_CB_UNKNOWN,	"UNKNOWN" },			\
1470		{ NFSD4_CB_DOWN,	"DOWN" },			\
1471		{ NFSD4_CB_FAULT,	"FAULT"})
1472
1473DECLARE_EVENT_CLASS(nfsd_cb_class,
1474	TP_PROTO(const struct nfs4_client *clp),
1475	TP_ARGS(clp),
1476	TP_STRUCT__entry(
1477		__field(unsigned long, state)
1478		__field(u32, cl_boot)
1479		__field(u32, cl_id)
1480		__sockaddr(addr, clp->cl_cb_conn.cb_addrlen)
1481	),
1482	TP_fast_assign(
1483		__entry->state = clp->cl_cb_state;
1484		__entry->cl_boot = clp->cl_clientid.cl_boot;
1485		__entry->cl_id = clp->cl_clientid.cl_id;
1486		__assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr,
1487				  clp->cl_cb_conn.cb_addrlen)
1488	),
1489	TP_printk("addr=%pISpc client %08x:%08x state=%s",
1490		__get_sockaddr(addr), __entry->cl_boot, __entry->cl_id,
1491		show_cb_state(__entry->state))
1492);
1493
1494#define DEFINE_NFSD_CB_EVENT(name)			\
1495DEFINE_EVENT(nfsd_cb_class, nfsd_cb_##name,		\
1496	TP_PROTO(const struct nfs4_client *clp),	\
1497	TP_ARGS(clp))
1498
1499DEFINE_NFSD_CB_EVENT(start);
1500DEFINE_NFSD_CB_EVENT(new_state);
1501DEFINE_NFSD_CB_EVENT(probe);
1502DEFINE_NFSD_CB_EVENT(lost);
1503DEFINE_NFSD_CB_EVENT(shutdown);
1504DEFINE_NFSD_CB_EVENT(rpc_prepare);
1505DEFINE_NFSD_CB_EVENT(rpc_done);
1506DEFINE_NFSD_CB_EVENT(rpc_release);
1507
1508TRACE_DEFINE_ENUM(RPC_AUTH_NULL);
1509TRACE_DEFINE_ENUM(RPC_AUTH_UNIX);
1510TRACE_DEFINE_ENUM(RPC_AUTH_GSS);
1511TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5);
1512TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5I);
1513TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5P);
1514
1515#define show_nfsd_authflavor(val)					\
1516	__print_symbolic(val,						\
1517		{ RPC_AUTH_NULL,		"none" },		\
1518		{ RPC_AUTH_UNIX,		"sys" },		\
1519		{ RPC_AUTH_GSS,			"gss" },		\
1520		{ RPC_AUTH_GSS_KRB5,		"krb5" },		\
1521		{ RPC_AUTH_GSS_KRB5I,		"krb5i" },		\
1522		{ RPC_AUTH_GSS_KRB5P,		"krb5p" })
1523
1524TRACE_EVENT(nfsd_cb_setup,
1525	TP_PROTO(const struct nfs4_client *clp,
1526		 const char *netid,
1527		 rpc_authflavor_t authflavor
1528	),
1529	TP_ARGS(clp, netid, authflavor),
1530	TP_STRUCT__entry(
1531		__field(u32, cl_boot)
1532		__field(u32, cl_id)
1533		__field(unsigned long, authflavor)
1534		__sockaddr(addr, clp->cl_cb_conn.cb_addrlen)
1535		__string(netid, netid)
1536	),
1537	TP_fast_assign(
1538		__entry->cl_boot = clp->cl_clientid.cl_boot;
1539		__entry->cl_id = clp->cl_clientid.cl_id;
1540		__assign_str(netid);
1541		__entry->authflavor = authflavor;
1542		__assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr,
1543				  clp->cl_cb_conn.cb_addrlen)
1544	),
1545	TP_printk("addr=%pISpc client %08x:%08x proto=%s flavor=%s",
1546		__get_sockaddr(addr), __entry->cl_boot, __entry->cl_id,
1547		__get_str(netid), show_nfsd_authflavor(__entry->authflavor))
1548);
1549
1550TRACE_EVENT(nfsd_cb_setup_err,
1551	TP_PROTO(
1552		const struct nfs4_client *clp,
1553		long error
1554	),
1555	TP_ARGS(clp, error),
1556	TP_STRUCT__entry(
1557		__field(long, error)
1558		__field(u32, cl_boot)
1559		__field(u32, cl_id)
1560		__sockaddr(addr, clp->cl_cb_conn.cb_addrlen)
1561	),
1562	TP_fast_assign(
1563		__entry->error = error;
1564		__entry->cl_boot = clp->cl_clientid.cl_boot;
1565		__entry->cl_id = clp->cl_clientid.cl_id;
1566		__assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr,
1567				  clp->cl_cb_conn.cb_addrlen)
1568	),
1569	TP_printk("addr=%pISpc client %08x:%08x error=%ld",
1570		__get_sockaddr(addr), __entry->cl_boot, __entry->cl_id,
1571		__entry->error)
1572);
1573
1574/* Not a real opcode, but there is no 0 operation. */
1575#define _CB_NULL	0
1576
1577#define show_nfsd_cb_opcode(val)					\
1578	__print_symbolic(val,						\
1579		{ _CB_NULL,			"CB_NULL" },		\
1580		{ OP_CB_GETATTR,		"CB_GETATTR" },		\
1581		{ OP_CB_RECALL,			"CB_RECALL" },		\
1582		{ OP_CB_LAYOUTRECALL,		"CB_LAYOUTRECALL" },	\
1583		{ OP_CB_RECALL_ANY,		"CB_RECALL_ANY" },	\
1584		{ OP_CB_NOTIFY_LOCK,		"CB_NOTIFY_LOCK" },	\
1585		{ OP_CB_OFFLOAD,		"CB_OFFLOAD" })
1586
1587DECLARE_EVENT_CLASS(nfsd_cb_lifetime_class,
1588	TP_PROTO(
1589		const struct nfs4_client *clp,
1590		const struct nfsd4_callback *cb
1591	),
1592	TP_ARGS(clp, cb),
1593	TP_STRUCT__entry(
1594		__field(u32, cl_boot)
1595		__field(u32, cl_id)
1596		__field(const void *, cb)
1597		__field(unsigned long, opcode)
1598		__field(bool, need_restart)
1599		__sockaddr(addr, clp->cl_cb_conn.cb_addrlen)
1600	),
1601	TP_fast_assign(
1602		__entry->cl_boot = clp->cl_clientid.cl_boot;
1603		__entry->cl_id = clp->cl_clientid.cl_id;
1604		__entry->cb = cb;
1605		__entry->opcode = cb->cb_ops ? cb->cb_ops->opcode : _CB_NULL;
1606		__entry->need_restart = cb->cb_need_restart;
1607		__assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr,
1608				  clp->cl_cb_conn.cb_addrlen)
1609	),
1610	TP_printk("addr=%pISpc client %08x:%08x cb=%p%s opcode=%s",
1611		__get_sockaddr(addr), __entry->cl_boot, __entry->cl_id, __entry->cb,
1612		__entry->need_restart ?  " (need restart)" : " (first try)",
1613		show_nfsd_cb_opcode(__entry->opcode)
1614	)
1615);
1616
1617#define DEFINE_NFSD_CB_LIFETIME_EVENT(name)		\
1618DEFINE_EVENT(nfsd_cb_lifetime_class, nfsd_cb_##name,	\
1619	TP_PROTO(					\
1620		const struct nfs4_client *clp,		\
1621		const struct nfsd4_callback *cb		\
1622	),						\
1623	TP_ARGS(clp, cb))
1624
1625DEFINE_NFSD_CB_LIFETIME_EVENT(queue);
1626DEFINE_NFSD_CB_LIFETIME_EVENT(destroy);
1627DEFINE_NFSD_CB_LIFETIME_EVENT(restart);
1628DEFINE_NFSD_CB_LIFETIME_EVENT(bc_update);
1629DEFINE_NFSD_CB_LIFETIME_EVENT(bc_shutdown);
1630
1631TRACE_EVENT(nfsd_cb_seq_status,
1632	TP_PROTO(
1633		const struct rpc_task *task,
1634		const struct nfsd4_callback *cb
1635	),
1636	TP_ARGS(task, cb),
1637	TP_STRUCT__entry(
1638		__field(unsigned int, task_id)
1639		__field(unsigned int, client_id)
1640		__field(u32, cl_boot)
1641		__field(u32, cl_id)
1642		__field(u32, seqno)
1643		__field(u32, reserved)
1644		__field(int, tk_status)
1645		__field(int, seq_status)
1646	),
1647	TP_fast_assign(
1648		const struct nfs4_client *clp = cb->cb_clp;
1649		const struct nfsd4_session *session = clp->cl_cb_session;
1650		const struct nfsd4_sessionid *sid =
1651			(struct nfsd4_sessionid *)&session->se_sessionid;
1652
1653		__entry->task_id = task->tk_pid;
1654		__entry->client_id = task->tk_client ?
1655				     task->tk_client->cl_clid : -1;
1656		__entry->cl_boot = sid->clientid.cl_boot;
1657		__entry->cl_id = sid->clientid.cl_id;
1658		__entry->seqno = sid->sequence;
1659		__entry->reserved = sid->reserved;
1660		__entry->tk_status = task->tk_status;
1661		__entry->seq_status = cb->cb_seq_status;
1662	),
1663	TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
1664		" sessionid=%08x:%08x:%08x:%08x tk_status=%d seq_status=%d",
1665		__entry->task_id, __entry->client_id,
1666		__entry->cl_boot, __entry->cl_id,
1667		__entry->seqno, __entry->reserved,
1668		__entry->tk_status, __entry->seq_status
1669	)
1670);
1671
1672TRACE_EVENT(nfsd_cb_free_slot,
1673	TP_PROTO(
1674		const struct rpc_task *task,
1675		const struct nfsd4_callback *cb
1676	),
1677	TP_ARGS(task, cb),
1678	TP_STRUCT__entry(
1679		__field(unsigned int, task_id)
1680		__field(unsigned int, client_id)
1681		__field(u32, cl_boot)
1682		__field(u32, cl_id)
1683		__field(u32, seqno)
1684		__field(u32, reserved)
1685		__field(u32, slot_seqno)
1686	),
1687	TP_fast_assign(
1688		const struct nfs4_client *clp = cb->cb_clp;
1689		const struct nfsd4_session *session = clp->cl_cb_session;
1690		const struct nfsd4_sessionid *sid =
1691			(struct nfsd4_sessionid *)&session->se_sessionid;
1692
1693		__entry->task_id = task->tk_pid;
1694		__entry->client_id = task->tk_client ?
1695				     task->tk_client->cl_clid : -1;
1696		__entry->cl_boot = sid->clientid.cl_boot;
1697		__entry->cl_id = sid->clientid.cl_id;
1698		__entry->seqno = sid->sequence;
1699		__entry->reserved = sid->reserved;
1700		__entry->slot_seqno = session->se_cb_seq_nr[cb->cb_held_slot];
1701	),
1702	TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
1703		" sessionid=%08x:%08x:%08x:%08x new slot seqno=%u",
1704		__entry->task_id, __entry->client_id,
1705		__entry->cl_boot, __entry->cl_id,
1706		__entry->seqno, __entry->reserved,
1707		__entry->slot_seqno
1708	)
1709);
1710
1711TRACE_EVENT_CONDITION(nfsd_cb_recall,
1712	TP_PROTO(
1713		const struct nfs4_stid *stid
1714	),
1715	TP_ARGS(stid),
1716	TP_CONDITION(stid->sc_client),
1717	TP_STRUCT__entry(
1718		__field(u32, cl_boot)
1719		__field(u32, cl_id)
1720		__field(u32, si_id)
1721		__field(u32, si_generation)
1722		__sockaddr(addr, stid->sc_client->cl_cb_conn.cb_addrlen)
1723	),
1724	TP_fast_assign(
1725		const stateid_t *stp = &stid->sc_stateid;
1726		const struct nfs4_client *clp = stid->sc_client;
1727
1728		__entry->cl_boot = stp->si_opaque.so_clid.cl_boot;
1729		__entry->cl_id = stp->si_opaque.so_clid.cl_id;
1730		__entry->si_id = stp->si_opaque.so_id;
1731		__entry->si_generation = stp->si_generation;
1732		__assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr,
1733				  clp->cl_cb_conn.cb_addrlen)
1734	),
1735	TP_printk("addr=%pISpc client %08x:%08x stateid %08x:%08x",
1736		__get_sockaddr(addr), __entry->cl_boot, __entry->cl_id,
1737		__entry->si_id, __entry->si_generation)
1738);
1739
1740TRACE_EVENT(nfsd_cb_notify_lock,
1741	TP_PROTO(
1742		const struct nfs4_lockowner *lo,
1743		const struct nfsd4_blocked_lock *nbl
1744	),
1745	TP_ARGS(lo, nbl),
1746	TP_STRUCT__entry(
1747		__field(u32, cl_boot)
1748		__field(u32, cl_id)
1749		__field(u32, fh_hash)
1750		__sockaddr(addr, lo->lo_owner.so_client->cl_cb_conn.cb_addrlen)
1751	),
1752	TP_fast_assign(
1753		const struct nfs4_client *clp = lo->lo_owner.so_client;
1754
1755		__entry->cl_boot = clp->cl_clientid.cl_boot;
1756		__entry->cl_id = clp->cl_clientid.cl_id;
1757		__entry->fh_hash = knfsd_fh_hash(&nbl->nbl_fh);
1758		__assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr,
1759				  clp->cl_cb_conn.cb_addrlen)
1760	),
1761	TP_printk("addr=%pISpc client %08x:%08x fh_hash=0x%08x",
1762		__get_sockaddr(addr), __entry->cl_boot, __entry->cl_id,
1763		__entry->fh_hash)
1764);
1765
1766TRACE_EVENT(nfsd_cb_offload,
1767	TP_PROTO(
1768		const struct nfs4_client *clp,
1769		const stateid_t *stp,
1770		const struct knfsd_fh *fh,
1771		u64 count,
1772		__be32 status
1773	),
1774	TP_ARGS(clp, stp, fh, count, status),
1775	TP_STRUCT__entry(
1776		__field(u32, cl_boot)
1777		__field(u32, cl_id)
1778		__field(u32, si_id)
1779		__field(u32, si_generation)
1780		__field(u32, fh_hash)
1781		__field(int, status)
1782		__field(u64, count)
1783		__sockaddr(addr, clp->cl_cb_conn.cb_addrlen)
1784	),
1785	TP_fast_assign(
1786		__entry->cl_boot = stp->si_opaque.so_clid.cl_boot;
1787		__entry->cl_id = stp->si_opaque.so_clid.cl_id;
1788		__entry->si_id = stp->si_opaque.so_id;
1789		__entry->si_generation = stp->si_generation;
1790		__entry->fh_hash = knfsd_fh_hash(fh);
1791		__entry->status = be32_to_cpu(status);
1792		__entry->count = count;
1793		__assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr,
1794				  clp->cl_cb_conn.cb_addrlen)
1795	),
1796	TP_printk("addr=%pISpc client %08x:%08x stateid %08x:%08x fh_hash=0x%08x count=%llu status=%d",
1797		__get_sockaddr(addr), __entry->cl_boot, __entry->cl_id,
1798		__entry->si_id, __entry->si_generation,
1799		__entry->fh_hash, __entry->count, __entry->status)
1800);
1801
1802TRACE_EVENT(nfsd_cb_recall_any,
1803	TP_PROTO(
1804		const struct nfsd4_cb_recall_any *ra
1805	),
1806	TP_ARGS(ra),
1807	TP_STRUCT__entry(
1808		__field(u32, cl_boot)
1809		__field(u32, cl_id)
1810		__field(u32, keep)
1811		__field(unsigned long, bmval0)
1812		__sockaddr(addr, ra->ra_cb.cb_clp->cl_cb_conn.cb_addrlen)
1813	),
1814	TP_fast_assign(
1815		__entry->cl_boot = ra->ra_cb.cb_clp->cl_clientid.cl_boot;
1816		__entry->cl_id = ra->ra_cb.cb_clp->cl_clientid.cl_id;
1817		__entry->keep = ra->ra_keep;
1818		__entry->bmval0 = ra->ra_bmval[0];
1819		__assign_sockaddr(addr, &ra->ra_cb.cb_clp->cl_addr,
1820				  ra->ra_cb.cb_clp->cl_cb_conn.cb_addrlen);
1821	),
1822	TP_printk("addr=%pISpc client %08x:%08x keep=%u bmval0=%s",
1823		__get_sockaddr(addr), __entry->cl_boot, __entry->cl_id,
1824		__entry->keep, show_rca_mask(__entry->bmval0)
1825	)
1826);
1827
1828DECLARE_EVENT_CLASS(nfsd_cb_done_class,
1829	TP_PROTO(
1830		const stateid_t *stp,
1831		const struct rpc_task *task
1832	),
1833	TP_ARGS(stp, task),
1834	TP_STRUCT__entry(
1835		__field(u32, cl_boot)
1836		__field(u32, cl_id)
1837		__field(u32, si_id)
1838		__field(u32, si_generation)
1839		__field(int, status)
1840	),
1841	TP_fast_assign(
1842		__entry->cl_boot = stp->si_opaque.so_clid.cl_boot;
1843		__entry->cl_id = stp->si_opaque.so_clid.cl_id;
1844		__entry->si_id = stp->si_opaque.so_id;
1845		__entry->si_generation = stp->si_generation;
1846		__entry->status = task->tk_status;
1847	),
1848	TP_printk("client %08x:%08x stateid %08x:%08x status=%d",
1849		__entry->cl_boot, __entry->cl_id, __entry->si_id,
1850		__entry->si_generation, __entry->status
1851	)
1852);
1853
1854#define DEFINE_NFSD_CB_DONE_EVENT(name)			\
1855DEFINE_EVENT(nfsd_cb_done_class, name,			\
1856	TP_PROTO(					\
1857		const stateid_t *stp,			\
1858		const struct rpc_task *task		\
1859	),						\
1860	TP_ARGS(stp, task))
1861
1862DEFINE_NFSD_CB_DONE_EVENT(nfsd_cb_recall_done);
1863DEFINE_NFSD_CB_DONE_EVENT(nfsd_cb_notify_lock_done);
1864DEFINE_NFSD_CB_DONE_EVENT(nfsd_cb_layout_done);
1865DEFINE_NFSD_CB_DONE_EVENT(nfsd_cb_offload_done);
1866DEFINE_NFSD_CB_DONE_EVENT(nfsd_cb_getattr_done);
1867
1868TRACE_EVENT(nfsd_cb_recall_any_done,
1869	TP_PROTO(
1870		const struct nfsd4_callback *cb,
1871		const struct rpc_task *task
1872	),
1873	TP_ARGS(cb, task),
1874	TP_STRUCT__entry(
1875		__field(u32, cl_boot)
1876		__field(u32, cl_id)
1877		__field(int, status)
1878	),
1879	TP_fast_assign(
1880		__entry->status = task->tk_status;
1881		__entry->cl_boot = cb->cb_clp->cl_clientid.cl_boot;
1882		__entry->cl_id = cb->cb_clp->cl_clientid.cl_id;
1883	),
1884	TP_printk("client %08x:%08x status=%d",
1885		__entry->cl_boot, __entry->cl_id, __entry->status
1886	)
1887);
1888
1889TRACE_EVENT(nfsd_ctl_unlock_ip,
1890	TP_PROTO(
1891		const struct net *net,
1892		const char *address
1893	),
1894	TP_ARGS(net, address),
1895	TP_STRUCT__entry(
1896		__field(unsigned int, netns_ino)
1897		__string(address, address)
1898	),
1899	TP_fast_assign(
1900		__entry->netns_ino = net->ns.inum;
1901		__assign_str(address);
1902	),
1903	TP_printk("address=%s",
1904		__get_str(address)
1905	)
1906);
1907
1908TRACE_EVENT(nfsd_ctl_unlock_fs,
1909	TP_PROTO(
1910		const struct net *net,
1911		const char *path
1912	),
1913	TP_ARGS(net, path),
1914	TP_STRUCT__entry(
1915		__field(unsigned int, netns_ino)
1916		__string(path, path)
1917	),
1918	TP_fast_assign(
1919		__entry->netns_ino = net->ns.inum;
1920		__assign_str(path);
1921	),
1922	TP_printk("path=%s",
1923		__get_str(path)
1924	)
1925);
1926
1927TRACE_EVENT(nfsd_ctl_filehandle,
1928	TP_PROTO(
1929		const struct net *net,
1930		const char *domain,
1931		const char *path,
1932		int maxsize
1933	),
1934	TP_ARGS(net, domain, path, maxsize),
1935	TP_STRUCT__entry(
1936		__field(unsigned int, netns_ino)
1937		__field(int, maxsize)
1938		__string(domain, domain)
1939		__string(path, path)
1940	),
1941	TP_fast_assign(
1942		__entry->netns_ino = net->ns.inum;
1943		__entry->maxsize = maxsize;
1944		__assign_str(domain);
1945		__assign_str(path);
1946	),
1947	TP_printk("domain=%s path=%s maxsize=%d",
1948		__get_str(domain), __get_str(path), __entry->maxsize
1949	)
1950);
1951
1952TRACE_EVENT(nfsd_ctl_threads,
1953	TP_PROTO(
1954		const struct net *net,
1955		int newthreads
1956	),
1957	TP_ARGS(net, newthreads),
1958	TP_STRUCT__entry(
1959		__field(unsigned int, netns_ino)
1960		__field(int, newthreads)
1961	),
1962	TP_fast_assign(
1963		__entry->netns_ino = net->ns.inum;
1964		__entry->newthreads = newthreads;
1965	),
1966	TP_printk("newthreads=%d",
1967		__entry->newthreads
1968	)
1969);
1970
1971TRACE_EVENT(nfsd_ctl_pool_threads,
1972	TP_PROTO(
1973		const struct net *net,
1974		int pool,
1975		int nrthreads
1976	),
1977	TP_ARGS(net, pool, nrthreads),
1978	TP_STRUCT__entry(
1979		__field(unsigned int, netns_ino)
1980		__field(int, pool)
1981		__field(int, nrthreads)
1982	),
1983	TP_fast_assign(
1984		__entry->netns_ino = net->ns.inum;
1985		__entry->pool = pool;
1986		__entry->nrthreads = nrthreads;
1987	),
1988	TP_printk("pool=%d nrthreads=%d",
1989		__entry->pool, __entry->nrthreads
1990	)
1991);
1992
1993TRACE_EVENT(nfsd_ctl_version,
1994	TP_PROTO(
1995		const struct net *net,
1996		const char *mesg
1997	),
1998	TP_ARGS(net, mesg),
1999	TP_STRUCT__entry(
2000		__field(unsigned int, netns_ino)
2001		__string(mesg, mesg)
2002	),
2003	TP_fast_assign(
2004		__entry->netns_ino = net->ns.inum;
2005		__assign_str(mesg);
2006	),
2007	TP_printk("%s",
2008		__get_str(mesg)
2009	)
2010);
2011
2012TRACE_EVENT(nfsd_ctl_ports_addfd,
2013	TP_PROTO(
2014		const struct net *net,
2015		int fd
2016	),
2017	TP_ARGS(net, fd),
2018	TP_STRUCT__entry(
2019		__field(unsigned int, netns_ino)
2020		__field(int, fd)
2021	),
2022	TP_fast_assign(
2023		__entry->netns_ino = net->ns.inum;
2024		__entry->fd = fd;
2025	),
2026	TP_printk("fd=%d",
2027		__entry->fd
2028	)
2029);
2030
2031TRACE_EVENT(nfsd_ctl_ports_addxprt,
2032	TP_PROTO(
2033		const struct net *net,
2034		const char *transport,
2035		int port
2036	),
2037	TP_ARGS(net, transport, port),
2038	TP_STRUCT__entry(
2039		__field(unsigned int, netns_ino)
2040		__field(int, port)
2041		__string(transport, transport)
2042	),
2043	TP_fast_assign(
2044		__entry->netns_ino = net->ns.inum;
2045		__entry->port = port;
2046		__assign_str(transport);
2047	),
2048	TP_printk("transport=%s port=%d",
2049		__get_str(transport), __entry->port
2050	)
2051);
2052
2053TRACE_EVENT(nfsd_ctl_maxblksize,
2054	TP_PROTO(
2055		const struct net *net,
2056		int bsize
2057	),
2058	TP_ARGS(net, bsize),
2059	TP_STRUCT__entry(
2060		__field(unsigned int, netns_ino)
2061		__field(int, bsize)
2062	),
2063	TP_fast_assign(
2064		__entry->netns_ino = net->ns.inum;
2065		__entry->bsize = bsize;
2066	),
2067	TP_printk("bsize=%d",
2068		__entry->bsize
2069	)
2070);
2071
2072TRACE_EVENT(nfsd_ctl_maxconn,
2073	TP_PROTO(
2074		const struct net *net,
2075		int maxconn
2076	),
2077	TP_ARGS(net, maxconn),
2078	TP_STRUCT__entry(
2079		__field(unsigned int, netns_ino)
2080		__field(int, maxconn)
2081	),
2082	TP_fast_assign(
2083		__entry->netns_ino = net->ns.inum;
2084		__entry->maxconn = maxconn;
2085	),
2086	TP_printk("maxconn=%d",
2087		__entry->maxconn
2088	)
2089);
2090
2091TRACE_EVENT(nfsd_ctl_time,
2092	TP_PROTO(
2093		const struct net *net,
2094		const char *name,
2095		size_t namelen,
2096		int time
2097	),
2098	TP_ARGS(net, name, namelen, time),
2099	TP_STRUCT__entry(
2100		__field(unsigned int, netns_ino)
2101		__field(int, time)
2102		__string_len(name, name, namelen)
2103	),
2104	TP_fast_assign(
2105		__entry->netns_ino = net->ns.inum;
2106		__entry->time = time;
2107		__assign_str(name);
2108	),
2109	TP_printk("file=%s time=%d",
2110		__get_str(name), __entry->time
2111	)
2112);
2113
2114TRACE_EVENT(nfsd_ctl_recoverydir,
2115	TP_PROTO(
2116		const struct net *net,
2117		const char *recdir
2118	),
2119	TP_ARGS(net, recdir),
2120	TP_STRUCT__entry(
2121		__field(unsigned int, netns_ino)
2122		__string(recdir, recdir)
2123	),
2124	TP_fast_assign(
2125		__entry->netns_ino = net->ns.inum;
2126		__assign_str(recdir);
2127	),
2128	TP_printk("recdir=%s",
2129		__get_str(recdir)
2130	)
2131);
2132
2133TRACE_EVENT(nfsd_end_grace,
2134	TP_PROTO(
2135		const struct net *net
2136	),
2137	TP_ARGS(net),
2138	TP_STRUCT__entry(
2139		__field(unsigned int, netns_ino)
2140	),
2141	TP_fast_assign(
2142		__entry->netns_ino = net->ns.inum;
2143	),
2144	TP_printk("nn=%d", __entry->netns_ino
2145	)
2146);
2147
2148DECLARE_EVENT_CLASS(nfsd_copy_class,
2149	TP_PROTO(
2150		const struct nfsd4_copy *copy
2151	),
2152	TP_ARGS(copy),
2153	TP_STRUCT__entry(
2154		__field(bool, intra)
2155		__field(bool, async)
2156		__field(u32, src_cl_boot)
2157		__field(u32, src_cl_id)
2158		__field(u32, src_so_id)
2159		__field(u32, src_si_generation)
2160		__field(u32, dst_cl_boot)
2161		__field(u32, dst_cl_id)
2162		__field(u32, dst_so_id)
2163		__field(u32, dst_si_generation)
2164		__field(u32, cb_cl_boot)
2165		__field(u32, cb_cl_id)
2166		__field(u32, cb_so_id)
2167		__field(u32, cb_si_generation)
2168		__field(u64, src_cp_pos)
2169		__field(u64, dst_cp_pos)
2170		__field(u64, cp_count)
2171		__sockaddr(addr, sizeof(struct sockaddr_in6))
2172	),
2173	TP_fast_assign(
2174		const stateid_t *src_stp = &copy->cp_src_stateid;
2175		const stateid_t *dst_stp = &copy->cp_dst_stateid;
2176		const stateid_t *cb_stp = &copy->cp_res.cb_stateid;
2177
2178		__entry->intra = test_bit(NFSD4_COPY_F_INTRA, &copy->cp_flags);
2179		__entry->async = !test_bit(NFSD4_COPY_F_SYNCHRONOUS, &copy->cp_flags);
2180		__entry->src_cl_boot = src_stp->si_opaque.so_clid.cl_boot;
2181		__entry->src_cl_id = src_stp->si_opaque.so_clid.cl_id;
2182		__entry->src_so_id = src_stp->si_opaque.so_id;
2183		__entry->src_si_generation = src_stp->si_generation;
2184		__entry->dst_cl_boot = dst_stp->si_opaque.so_clid.cl_boot;
2185		__entry->dst_cl_id = dst_stp->si_opaque.so_clid.cl_id;
2186		__entry->dst_so_id = dst_stp->si_opaque.so_id;
2187		__entry->dst_si_generation = dst_stp->si_generation;
2188		__entry->cb_cl_boot = cb_stp->si_opaque.so_clid.cl_boot;
2189		__entry->cb_cl_id = cb_stp->si_opaque.so_clid.cl_id;
2190		__entry->cb_so_id = cb_stp->si_opaque.so_id;
2191		__entry->cb_si_generation = cb_stp->si_generation;
2192		__entry->src_cp_pos = copy->cp_src_pos;
2193		__entry->dst_cp_pos = copy->cp_dst_pos;
2194		__entry->cp_count = copy->cp_count;
2195		__assign_sockaddr(addr, &copy->cp_clp->cl_addr,
2196				sizeof(struct sockaddr_in6));
2197	),
2198	TP_printk("client=%pISpc intra=%d async=%d "
2199		"src_client %08x:%08x src_stateid %08x:%08x "
2200		"dst_client %08x:%08x dst_stateid %08x:%08x "
2201		"cb_client %08x:%08x cb_stateid %08x:%08x "
2202		"cp_src_pos=%llu cp_dst_pos=%llu cp_count=%llu",
2203		__get_sockaddr(addr), __entry->intra, __entry->async,
2204		__entry->src_cl_boot, __entry->src_cl_id,
2205		__entry->src_so_id, __entry->src_si_generation,
2206		__entry->dst_cl_boot, __entry->dst_cl_id,
2207		__entry->dst_so_id, __entry->dst_si_generation,
2208		__entry->cb_cl_boot, __entry->cb_cl_id,
2209		__entry->cb_so_id, __entry->cb_si_generation,
2210		__entry->src_cp_pos, __entry->dst_cp_pos, __entry->cp_count
2211	)
2212);
2213
2214#define DEFINE_COPY_EVENT(name)				\
2215DEFINE_EVENT(nfsd_copy_class, nfsd_copy_##name,	\
2216	TP_PROTO(const struct nfsd4_copy *copy),	\
2217	TP_ARGS(copy))
2218
2219DEFINE_COPY_EVENT(inter);
2220DEFINE_COPY_EVENT(intra);
2221DEFINE_COPY_EVENT(async);
2222
2223TRACE_EVENT(nfsd_copy_done,
2224	TP_PROTO(
2225		const struct nfsd4_copy *copy,
2226		__be32 status
2227	),
2228	TP_ARGS(copy, status),
2229	TP_STRUCT__entry(
2230		__field(int, status)
2231		__field(bool, intra)
2232		__field(bool, async)
2233		__sockaddr(addr, sizeof(struct sockaddr_in6))
2234	),
2235	TP_fast_assign(
2236		__entry->status = be32_to_cpu(status);
2237		__entry->intra = test_bit(NFSD4_COPY_F_INTRA, &copy->cp_flags);
2238		__entry->async = !test_bit(NFSD4_COPY_F_SYNCHRONOUS, &copy->cp_flags);
2239		__assign_sockaddr(addr, &copy->cp_clp->cl_addr,
2240				sizeof(struct sockaddr_in6));
2241	),
2242	TP_printk("addr=%pISpc status=%d intra=%d async=%d",
2243		__get_sockaddr(addr), __entry->status, __entry->intra, __entry->async
2244	)
2245);
2246
2247DECLARE_EVENT_CLASS(nfsd_copy_async_done_class,
2248	TP_PROTO(
2249		const struct nfsd4_copy *copy
2250	),
2251	TP_ARGS(copy),
2252	TP_STRUCT__entry(
2253		__field(int, status)
2254		__field(bool, intra)
2255		__field(bool, async)
2256		__field(u32, src_cl_boot)
2257		__field(u32, src_cl_id)
2258		__field(u32, src_so_id)
2259		__field(u32, src_si_generation)
2260		__field(u32, dst_cl_boot)
2261		__field(u32, dst_cl_id)
2262		__field(u32, dst_so_id)
2263		__field(u32, dst_si_generation)
2264		__field(u32, cb_cl_boot)
2265		__field(u32, cb_cl_id)
2266		__field(u32, cb_so_id)
2267		__field(u32, cb_si_generation)
2268		__field(u64, src_cp_pos)
2269		__field(u64, dst_cp_pos)
2270		__field(u64, cp_count)
2271		__sockaddr(addr, sizeof(struct sockaddr_in6))
2272	),
2273	TP_fast_assign(
2274		const stateid_t *src_stp = &copy->cp_src_stateid;
2275		const stateid_t *dst_stp = &copy->cp_dst_stateid;
2276		const stateid_t *cb_stp = &copy->cp_res.cb_stateid;
2277
2278		__entry->status = be32_to_cpu(copy->nfserr);
2279		__entry->intra = test_bit(NFSD4_COPY_F_INTRA, &copy->cp_flags);
2280		__entry->async = !test_bit(NFSD4_COPY_F_SYNCHRONOUS, &copy->cp_flags);
2281		__entry->src_cl_boot = src_stp->si_opaque.so_clid.cl_boot;
2282		__entry->src_cl_id = src_stp->si_opaque.so_clid.cl_id;
2283		__entry->src_so_id = src_stp->si_opaque.so_id;
2284		__entry->src_si_generation = src_stp->si_generation;
2285		__entry->dst_cl_boot = dst_stp->si_opaque.so_clid.cl_boot;
2286		__entry->dst_cl_id = dst_stp->si_opaque.so_clid.cl_id;
2287		__entry->dst_so_id = dst_stp->si_opaque.so_id;
2288		__entry->dst_si_generation = dst_stp->si_generation;
2289		__entry->cb_cl_boot = cb_stp->si_opaque.so_clid.cl_boot;
2290		__entry->cb_cl_id = cb_stp->si_opaque.so_clid.cl_id;
2291		__entry->cb_so_id = cb_stp->si_opaque.so_id;
2292		__entry->cb_si_generation = cb_stp->si_generation;
2293		__entry->src_cp_pos = copy->cp_src_pos;
2294		__entry->dst_cp_pos = copy->cp_dst_pos;
2295		__entry->cp_count = copy->cp_count;
2296		__assign_sockaddr(addr, &copy->cp_clp->cl_addr,
2297				sizeof(struct sockaddr_in6));
2298	),
2299	TP_printk("client=%pISpc status=%d intra=%d async=%d "
2300		"src_client %08x:%08x src_stateid %08x:%08x "
2301		"dst_client %08x:%08x dst_stateid %08x:%08x "
2302		"cb_client %08x:%08x cb_stateid %08x:%08x "
2303		"cp_src_pos=%llu cp_dst_pos=%llu cp_count=%llu",
2304		__get_sockaddr(addr),
2305		__entry->status, __entry->intra, __entry->async,
2306		__entry->src_cl_boot, __entry->src_cl_id,
2307		__entry->src_so_id, __entry->src_si_generation,
2308		__entry->dst_cl_boot, __entry->dst_cl_id,
2309		__entry->dst_so_id, __entry->dst_si_generation,
2310		__entry->cb_cl_boot, __entry->cb_cl_id,
2311		__entry->cb_so_id, __entry->cb_si_generation,
2312		__entry->src_cp_pos, __entry->dst_cp_pos, __entry->cp_count
2313	)
2314);
2315
2316#define DEFINE_COPY_ASYNC_DONE_EVENT(name)		\
2317DEFINE_EVENT(nfsd_copy_async_done_class,		\
2318	nfsd_copy_async_##name,				\
2319	TP_PROTO(const struct nfsd4_copy *copy),	\
2320	TP_ARGS(copy))
2321
2322DEFINE_COPY_ASYNC_DONE_EVENT(done);
2323DEFINE_COPY_ASYNC_DONE_EVENT(cancel);
2324
2325#endif /* _NFSD_TRACE_H */
2326
2327#undef TRACE_INCLUDE_PATH
2328#define TRACE_INCLUDE_PATH .
2329#define TRACE_INCLUDE_FILE trace
2330#include <trace/define_trace.h>
v6.8
   1/* SPDX-License-Identifier: GPL-2.0 */
   2/*
   3 * Copyright (c) 2014 Christoph Hellwig.
   4 */
   5#undef TRACE_SYSTEM
   6#define TRACE_SYSTEM nfsd
   7
   8#if !defined(_NFSD_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
   9#define _NFSD_TRACE_H
  10
  11#include <linux/tracepoint.h>
 
  12#include <linux/sunrpc/xprt.h>
  13#include <trace/misc/nfs.h>
 
  14
  15#include "export.h"
  16#include "nfsfh.h"
  17#include "xdr4.h"
  18
  19#define NFSD_TRACE_PROC_RES_FIELDS \
  20		__field(unsigned int, netns_ino) \
  21		__field(u32, xid) \
  22		__field(unsigned long, status) \
  23		__array(unsigned char, server, sizeof(struct sockaddr_in6)) \
  24		__array(unsigned char, client, sizeof(struct sockaddr_in6))
  25
  26#define NFSD_TRACE_PROC_RES_ASSIGNMENTS(error) \
  27		do { \
  28			__entry->netns_ino = SVC_NET(rqstp)->ns.inum; \
  29			__entry->xid = be32_to_cpu(rqstp->rq_xid); \
  30			__entry->status = be32_to_cpu(error); \
  31			memcpy(__entry->server, &rqstp->rq_xprt->xpt_local, \
  32			       rqstp->rq_xprt->xpt_locallen); \
  33			memcpy(__entry->client, &rqstp->rq_xprt->xpt_remote, \
  34			       rqstp->rq_xprt->xpt_remotelen); \
  35		} while (0);
  36
  37DECLARE_EVENT_CLASS(nfsd_xdr_err_class,
  38	TP_PROTO(
  39		const struct svc_rqst *rqstp
  40	),
  41	TP_ARGS(rqstp),
  42	TP_STRUCT__entry(
  43		__field(unsigned int, netns_ino)
  44		__field(u32, xid)
  45		__field(u32, vers)
  46		__field(u32, proc)
  47		__sockaddr(server, rqstp->rq_xprt->xpt_locallen)
  48		__sockaddr(client, rqstp->rq_xprt->xpt_remotelen)
  49	),
  50	TP_fast_assign(
  51		const struct svc_xprt *xprt = rqstp->rq_xprt;
  52
  53		__entry->netns_ino = xprt->xpt_net->ns.inum;
  54		__entry->xid = be32_to_cpu(rqstp->rq_xid);
  55		__entry->vers = rqstp->rq_vers;
  56		__entry->proc = rqstp->rq_proc;
  57		__assign_sockaddr(server, &xprt->xpt_local, xprt->xpt_locallen);
  58		__assign_sockaddr(client, &xprt->xpt_remote, xprt->xpt_remotelen);
  59	),
  60	TP_printk("xid=0x%08x vers=%u proc=%u",
  61		__entry->xid, __entry->vers, __entry->proc
  62	)
  63);
  64
  65#define DEFINE_NFSD_XDR_ERR_EVENT(name) \
  66DEFINE_EVENT(nfsd_xdr_err_class, nfsd_##name##_err, \
  67	TP_PROTO(const struct svc_rqst *rqstp), \
  68	TP_ARGS(rqstp))
  69
  70DEFINE_NFSD_XDR_ERR_EVENT(garbage_args);
  71DEFINE_NFSD_XDR_ERR_EVENT(cant_encode);
  72
  73#define show_nfsd_may_flags(x)						\
  74	__print_flags(x, "|",						\
  75		{ NFSD_MAY_EXEC,		"EXEC" },		\
  76		{ NFSD_MAY_WRITE,		"WRITE" },		\
  77		{ NFSD_MAY_READ,		"READ" },		\
  78		{ NFSD_MAY_SATTR,		"SATTR" },		\
  79		{ NFSD_MAY_TRUNC,		"TRUNC" },		\
  80		{ NFSD_MAY_LOCK,		"LOCK" },		\
  81		{ NFSD_MAY_OWNER_OVERRIDE,	"OWNER_OVERRIDE" },	\
  82		{ NFSD_MAY_LOCAL_ACCESS,	"LOCAL_ACCESS" },	\
  83		{ NFSD_MAY_BYPASS_GSS_ON_ROOT,	"BYPASS_GSS_ON_ROOT" },	\
  84		{ NFSD_MAY_NOT_BREAK_LEASE,	"NOT_BREAK_LEASE" },	\
  85		{ NFSD_MAY_BYPASS_GSS,		"BYPASS_GSS" },		\
  86		{ NFSD_MAY_READ_IF_EXEC,	"READ_IF_EXEC" },	\
  87		{ NFSD_MAY_64BIT_COOKIE,	"64BIT_COOKIE" })
 
  88
  89TRACE_EVENT(nfsd_compound,
  90	TP_PROTO(
  91		const struct svc_rqst *rqst,
  92		const char *tag,
  93		u32 taglen,
  94		u32 opcnt
  95	),
  96	TP_ARGS(rqst, tag, taglen, opcnt),
  97	TP_STRUCT__entry(
  98		__field(u32, xid)
  99		__field(u32, opcnt)
 100		__string_len(tag, tag, taglen)
 101	),
 102	TP_fast_assign(
 103		__entry->xid = be32_to_cpu(rqst->rq_xid);
 104		__entry->opcnt = opcnt;
 105		__assign_str_len(tag, tag, taglen);
 106	),
 107	TP_printk("xid=0x%08x opcnt=%u tag=%s",
 108		__entry->xid, __entry->opcnt, __get_str(tag)
 109	)
 110)
 111
 112TRACE_EVENT(nfsd_compound_status,
 113	TP_PROTO(u32 args_opcnt,
 114		 u32 resp_opcnt,
 115		 __be32 status,
 116		 const char *name),
 117	TP_ARGS(args_opcnt, resp_opcnt, status, name),
 118	TP_STRUCT__entry(
 119		__field(u32, args_opcnt)
 120		__field(u32, resp_opcnt)
 121		__field(int, status)
 122		__string(name, name)
 123	),
 124	TP_fast_assign(
 125		__entry->args_opcnt = args_opcnt;
 126		__entry->resp_opcnt = resp_opcnt;
 127		__entry->status = be32_to_cpu(status);
 128		__assign_str(name, name);
 129	),
 130	TP_printk("op=%u/%u %s status=%d",
 131		__entry->resp_opcnt, __entry->args_opcnt,
 132		__get_str(name), __entry->status)
 133)
 134
 135TRACE_EVENT(nfsd_compound_decode_err,
 136	TP_PROTO(
 137		const struct svc_rqst *rqstp,
 138		u32 args_opcnt,
 139		u32 resp_opcnt,
 140		u32 opnum,
 141		__be32 status
 142	),
 143	TP_ARGS(rqstp, args_opcnt, resp_opcnt, opnum, status),
 144	TP_STRUCT__entry(
 145		NFSD_TRACE_PROC_RES_FIELDS
 146
 147		__field(u32, args_opcnt)
 148		__field(u32, resp_opcnt)
 149		__field(u32, opnum)
 150	),
 151	TP_fast_assign(
 152		NFSD_TRACE_PROC_RES_ASSIGNMENTS(status)
 153
 154		__entry->args_opcnt = args_opcnt;
 155		__entry->resp_opcnt = resp_opcnt;
 156		__entry->opnum = opnum;
 157	),
 158	TP_printk("op=%u/%u opnum=%u status=%lu",
 159		__entry->resp_opcnt, __entry->args_opcnt,
 160		__entry->opnum, __entry->status)
 161);
 162
 163TRACE_EVENT(nfsd_compound_encode_err,
 164	TP_PROTO(
 165		const struct svc_rqst *rqstp,
 166		u32 opnum,
 167		__be32 status
 168	),
 169	TP_ARGS(rqstp, opnum, status),
 170	TP_STRUCT__entry(
 171		NFSD_TRACE_PROC_RES_FIELDS
 172
 173		__field(u32, opnum)
 174	),
 175	TP_fast_assign(
 176		NFSD_TRACE_PROC_RES_ASSIGNMENTS(status)
 177
 178		__entry->opnum = opnum;
 179	),
 180	TP_printk("opnum=%u status=%lu",
 181		__entry->opnum, __entry->status)
 182);
 183
 
 
 
 
 
 
 
 
 
 
 
 
 184#define show_fs_file_type(x) \
 185	__print_symbolic(x, \
 186		{ S_IFLNK,		"LNK" }, \
 187		{ S_IFREG,		"REG" }, \
 188		{ S_IFDIR,		"DIR" }, \
 189		{ S_IFCHR,		"CHR" }, \
 190		{ S_IFBLK,		"BLK" }, \
 191		{ S_IFIFO,		"FIFO" }, \
 192		{ S_IFSOCK,		"SOCK" })
 193
 194TRACE_EVENT(nfsd_fh_verify,
 195	TP_PROTO(
 196		const struct svc_rqst *rqstp,
 197		const struct svc_fh *fhp,
 198		umode_t type,
 199		int access
 200	),
 201	TP_ARGS(rqstp, fhp, type, access),
 
 202	TP_STRUCT__entry(
 203		__field(unsigned int, netns_ino)
 204		__sockaddr(server, rqstp->rq_xprt->xpt_remotelen)
 205		__sockaddr(client, rqstp->rq_xprt->xpt_remotelen)
 206		__field(u32, xid)
 207		__field(u32, fh_hash)
 208		__field(const void *, inode)
 209		__field(unsigned long, type)
 210		__field(unsigned long, access)
 211	),
 212	TP_fast_assign(
 213		__entry->netns_ino = SVC_NET(rqstp)->ns.inum;
 214		__assign_sockaddr(server, &rqstp->rq_xprt->xpt_local,
 215		       rqstp->rq_xprt->xpt_locallen);
 216		__assign_sockaddr(client, &rqstp->rq_xprt->xpt_remote,
 217				  rqstp->rq_xprt->xpt_remotelen);
 218		__entry->xid = be32_to_cpu(rqstp->rq_xid);
 219		__entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle);
 220		__entry->inode = d_inode(fhp->fh_dentry);
 221		__entry->type = type;
 222		__entry->access = access;
 223	),
 224	TP_printk("xid=0x%08x fh_hash=0x%08x type=%s access=%s",
 225		__entry->xid, __entry->fh_hash,
 226		show_fs_file_type(__entry->type),
 227		show_nfsd_may_flags(__entry->access)
 228	)
 229);
 230
 231TRACE_EVENT_CONDITION(nfsd_fh_verify_err,
 232	TP_PROTO(
 233		const struct svc_rqst *rqstp,
 234		const struct svc_fh *fhp,
 235		umode_t type,
 236		int access,
 237		__be32 error
 238	),
 239	TP_ARGS(rqstp, fhp, type, access, error),
 240	TP_CONDITION(error),
 241	TP_STRUCT__entry(
 242		__field(unsigned int, netns_ino)
 243		__sockaddr(server, rqstp->rq_xprt->xpt_remotelen)
 244		__sockaddr(client, rqstp->rq_xprt->xpt_remotelen)
 245		__field(u32, xid)
 246		__field(u32, fh_hash)
 247		__field(const void *, inode)
 248		__field(unsigned long, type)
 249		__field(unsigned long, access)
 250		__field(int, error)
 251	),
 252	TP_fast_assign(
 253		__entry->netns_ino = SVC_NET(rqstp)->ns.inum;
 254		__assign_sockaddr(server, &rqstp->rq_xprt->xpt_local,
 255		       rqstp->rq_xprt->xpt_locallen);
 256		__assign_sockaddr(client, &rqstp->rq_xprt->xpt_remote,
 257				  rqstp->rq_xprt->xpt_remotelen);
 258		__entry->xid = be32_to_cpu(rqstp->rq_xid);
 259		__entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle);
 260		if (fhp->fh_dentry)
 261			__entry->inode = d_inode(fhp->fh_dentry);
 262		else
 263			__entry->inode = NULL;
 264		__entry->type = type;
 265		__entry->access = access;
 266		__entry->error = be32_to_cpu(error);
 267	),
 268	TP_printk("xid=0x%08x fh_hash=0x%08x type=%s access=%s error=%d",
 269		__entry->xid, __entry->fh_hash,
 270		show_fs_file_type(__entry->type),
 271		show_nfsd_may_flags(__entry->access),
 272		__entry->error
 273	)
 274);
 275
 276DECLARE_EVENT_CLASS(nfsd_fh_err_class,
 277	TP_PROTO(struct svc_rqst *rqstp,
 278		 struct svc_fh	*fhp,
 279		 int		status),
 280	TP_ARGS(rqstp, fhp, status),
 281	TP_STRUCT__entry(
 282		__field(u32, xid)
 283		__field(u32, fh_hash)
 284		__field(int, status)
 285	),
 286	TP_fast_assign(
 287		__entry->xid = be32_to_cpu(rqstp->rq_xid);
 288		__entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle);
 289		__entry->status = status;
 290	),
 291	TP_printk("xid=0x%08x fh_hash=0x%08x status=%d",
 292		  __entry->xid, __entry->fh_hash,
 293		  __entry->status)
 294)
 295
 296#define DEFINE_NFSD_FH_ERR_EVENT(name)		\
 297DEFINE_EVENT(nfsd_fh_err_class, nfsd_##name,	\
 298	TP_PROTO(struct svc_rqst *rqstp,	\
 299		 struct svc_fh	*fhp,		\
 300		 int		status),	\
 301	TP_ARGS(rqstp, fhp, status))
 
 302
 303DEFINE_NFSD_FH_ERR_EVENT(set_fh_dentry_badexport);
 304DEFINE_NFSD_FH_ERR_EVENT(set_fh_dentry_badhandle);
 305
 306TRACE_EVENT(nfsd_exp_find_key,
 307	TP_PROTO(const struct svc_expkey *key,
 308		 int status),
 309	TP_ARGS(key, status),
 310	TP_STRUCT__entry(
 311		__field(int, fsidtype)
 312		__array(u32, fsid, 6)
 313		__string(auth_domain, key->ek_client->name)
 314		__field(int, status)
 315	),
 316	TP_fast_assign(
 317		__entry->fsidtype = key->ek_fsidtype;
 318		memcpy(__entry->fsid, key->ek_fsid, 4*6);
 319		__assign_str(auth_domain, key->ek_client->name);
 320		__entry->status = status;
 321	),
 322	TP_printk("fsid=%x::%s domain=%s status=%d",
 323		__entry->fsidtype,
 324		__print_array(__entry->fsid, 6, 4),
 325		__get_str(auth_domain),
 326		__entry->status
 327	)
 328);
 329
 330TRACE_EVENT(nfsd_expkey_update,
 331	TP_PROTO(const struct svc_expkey *key, const char *exp_path),
 332	TP_ARGS(key, exp_path),
 333	TP_STRUCT__entry(
 334		__field(int, fsidtype)
 335		__array(u32, fsid, 6)
 336		__string(auth_domain, key->ek_client->name)
 337		__string(path, exp_path)
 338		__field(bool, cache)
 339	),
 340	TP_fast_assign(
 341		__entry->fsidtype = key->ek_fsidtype;
 342		memcpy(__entry->fsid, key->ek_fsid, 4*6);
 343		__assign_str(auth_domain, key->ek_client->name);
 344		__assign_str(path, exp_path);
 345		__entry->cache = !test_bit(CACHE_NEGATIVE, &key->h.flags);
 346	),
 347	TP_printk("fsid=%x::%s domain=%s path=%s cache=%s",
 348		__entry->fsidtype,
 349		__print_array(__entry->fsid, 6, 4),
 350		__get_str(auth_domain),
 351		__get_str(path),
 352		__entry->cache ? "pos" : "neg"
 353	)
 354);
 355
 356TRACE_EVENT(nfsd_exp_get_by_name,
 357	TP_PROTO(const struct svc_export *key,
 358		 int status),
 359	TP_ARGS(key, status),
 360	TP_STRUCT__entry(
 361		__string(path, key->ex_path.dentry->d_name.name)
 362		__string(auth_domain, key->ex_client->name)
 363		__field(int, status)
 364	),
 365	TP_fast_assign(
 366		__assign_str(path, key->ex_path.dentry->d_name.name);
 367		__assign_str(auth_domain, key->ex_client->name);
 368		__entry->status = status;
 369	),
 370	TP_printk("path=%s domain=%s status=%d",
 371		__get_str(path),
 372		__get_str(auth_domain),
 373		__entry->status
 374	)
 375);
 376
 377TRACE_EVENT(nfsd_export_update,
 378	TP_PROTO(const struct svc_export *key),
 379	TP_ARGS(key),
 380	TP_STRUCT__entry(
 381		__string(path, key->ex_path.dentry->d_name.name)
 382		__string(auth_domain, key->ex_client->name)
 383		__field(bool, cache)
 384	),
 385	TP_fast_assign(
 386		__assign_str(path, key->ex_path.dentry->d_name.name);
 387		__assign_str(auth_domain, key->ex_client->name);
 388		__entry->cache = !test_bit(CACHE_NEGATIVE, &key->h.flags);
 389	),
 390	TP_printk("path=%s domain=%s cache=%s",
 391		__get_str(path),
 392		__get_str(auth_domain),
 393		__entry->cache ? "pos" : "neg"
 394	)
 395);
 396
 397DECLARE_EVENT_CLASS(nfsd_io_class,
 398	TP_PROTO(struct svc_rqst *rqstp,
 399		 struct svc_fh	*fhp,
 400		 u64		offset,
 401		 u32		len),
 402	TP_ARGS(rqstp, fhp, offset, len),
 403	TP_STRUCT__entry(
 404		__field(u32, xid)
 405		__field(u32, fh_hash)
 406		__field(u64, offset)
 407		__field(u32, len)
 408	),
 409	TP_fast_assign(
 410		__entry->xid = be32_to_cpu(rqstp->rq_xid);
 411		__entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle);
 412		__entry->offset = offset;
 413		__entry->len = len;
 414	),
 415	TP_printk("xid=0x%08x fh_hash=0x%08x offset=%llu len=%u",
 416		  __entry->xid, __entry->fh_hash,
 417		  __entry->offset, __entry->len)
 418)
 419
 420#define DEFINE_NFSD_IO_EVENT(name)		\
 421DEFINE_EVENT(nfsd_io_class, nfsd_##name,	\
 422	TP_PROTO(struct svc_rqst *rqstp,	\
 423		 struct svc_fh	*fhp,		\
 424		 u64		offset,		\
 425		 u32		len),		\
 426	TP_ARGS(rqstp, fhp, offset, len))
 427
 428DEFINE_NFSD_IO_EVENT(read_start);
 429DEFINE_NFSD_IO_EVENT(read_splice);
 430DEFINE_NFSD_IO_EVENT(read_vector);
 431DEFINE_NFSD_IO_EVENT(read_io_done);
 432DEFINE_NFSD_IO_EVENT(read_done);
 433DEFINE_NFSD_IO_EVENT(write_start);
 434DEFINE_NFSD_IO_EVENT(write_opened);
 435DEFINE_NFSD_IO_EVENT(write_io_done);
 436DEFINE_NFSD_IO_EVENT(write_done);
 437
 438DECLARE_EVENT_CLASS(nfsd_err_class,
 439	TP_PROTO(struct svc_rqst *rqstp,
 440		 struct svc_fh	*fhp,
 441		 loff_t		offset,
 442		 int		status),
 443	TP_ARGS(rqstp, fhp, offset, status),
 444	TP_STRUCT__entry(
 445		__field(u32, xid)
 446		__field(u32, fh_hash)
 447		__field(loff_t, offset)
 448		__field(int, status)
 449	),
 450	TP_fast_assign(
 451		__entry->xid = be32_to_cpu(rqstp->rq_xid);
 452		__entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle);
 453		__entry->offset = offset;
 454		__entry->status = status;
 455	),
 456	TP_printk("xid=0x%08x fh_hash=0x%08x offset=%lld status=%d",
 457		  __entry->xid, __entry->fh_hash,
 458		  __entry->offset, __entry->status)
 459)
 460
 461#define DEFINE_NFSD_ERR_EVENT(name)		\
 462DEFINE_EVENT(nfsd_err_class, nfsd_##name,	\
 463	TP_PROTO(struct svc_rqst *rqstp,	\
 464		 struct svc_fh	*fhp,		\
 465		 loff_t		offset,		\
 466		 int		len),		\
 467	TP_ARGS(rqstp, fhp, offset, len))
 468
 469DEFINE_NFSD_ERR_EVENT(read_err);
 470DEFINE_NFSD_ERR_EVENT(write_err);
 471
 472TRACE_EVENT(nfsd_dirent,
 473	TP_PROTO(struct svc_fh *fhp,
 474		 u64 ino,
 475		 const char *name,
 476		 int namlen),
 477	TP_ARGS(fhp, ino, name, namlen),
 478	TP_STRUCT__entry(
 479		__field(u32, fh_hash)
 480		__field(u64, ino)
 481		__string_len(name, name, namlen)
 482	),
 483	TP_fast_assign(
 484		__entry->fh_hash = fhp ? knfsd_fh_hash(&fhp->fh_handle) : 0;
 485		__entry->ino = ino;
 486		__assign_str_len(name, name, namlen)
 487	),
 488	TP_printk("fh_hash=0x%08x ino=%llu name=%s",
 489		__entry->fh_hash, __entry->ino, __get_str(name)
 490	)
 491)
 492
 493DECLARE_EVENT_CLASS(nfsd_copy_err_class,
 494	TP_PROTO(struct svc_rqst *rqstp,
 495		 struct svc_fh	*src_fhp,
 496		 loff_t		src_offset,
 497		 struct svc_fh	*dst_fhp,
 498		 loff_t		dst_offset,
 499		 u64		count,
 500		 int		status),
 501	TP_ARGS(rqstp, src_fhp, src_offset, dst_fhp, dst_offset, count, status),
 502	TP_STRUCT__entry(
 503		__field(u32, xid)
 504		__field(u32, src_fh_hash)
 505		__field(loff_t, src_offset)
 506		__field(u32, dst_fh_hash)
 507		__field(loff_t, dst_offset)
 508		__field(u64, count)
 509		__field(int, status)
 510	),
 511	TP_fast_assign(
 512		__entry->xid = be32_to_cpu(rqstp->rq_xid);
 513		__entry->src_fh_hash = knfsd_fh_hash(&src_fhp->fh_handle);
 514		__entry->src_offset = src_offset;
 515		__entry->dst_fh_hash = knfsd_fh_hash(&dst_fhp->fh_handle);
 516		__entry->dst_offset = dst_offset;
 517		__entry->count = count;
 518		__entry->status = status;
 519	),
 520	TP_printk("xid=0x%08x src_fh_hash=0x%08x src_offset=%lld "
 521			"dst_fh_hash=0x%08x dst_offset=%lld "
 522			"count=%llu status=%d",
 523		  __entry->xid, __entry->src_fh_hash, __entry->src_offset,
 524		  __entry->dst_fh_hash, __entry->dst_offset,
 525		  (unsigned long long)__entry->count,
 526		  __entry->status)
 527)
 528
 529#define DEFINE_NFSD_COPY_ERR_EVENT(name)		\
 530DEFINE_EVENT(nfsd_copy_err_class, nfsd_##name,		\
 531	TP_PROTO(struct svc_rqst	*rqstp,		\
 532		 struct svc_fh		*src_fhp,	\
 533		 loff_t			src_offset,	\
 534		 struct svc_fh		*dst_fhp,	\
 535		 loff_t			dst_offset,	\
 536		 u64			count,		\
 537		 int			status),	\
 538	TP_ARGS(rqstp, src_fhp, src_offset, dst_fhp, dst_offset, \
 539		count, status))
 540
 541DEFINE_NFSD_COPY_ERR_EVENT(clone_file_range_err);
 542
 543#include "state.h"
 544#include "filecache.h"
 545#include "vfs.h"
 546
 547TRACE_EVENT(nfsd_delegret_wakeup,
 548	TP_PROTO(
 549		const struct svc_rqst *rqstp,
 550		const struct inode *inode,
 551		long timeo
 552	),
 553	TP_ARGS(rqstp, inode, timeo),
 554	TP_STRUCT__entry(
 555		__field(u32, xid)
 556		__field(const void *, inode)
 557		__field(long, timeo)
 558	),
 559	TP_fast_assign(
 560		__entry->xid = be32_to_cpu(rqstp->rq_xid);
 561		__entry->inode = inode;
 562		__entry->timeo = timeo;
 563	),
 564	TP_printk("xid=0x%08x inode=%p%s",
 565		  __entry->xid, __entry->inode,
 566		  __entry->timeo == 0 ? " (timed out)" : ""
 567	)
 568);
 569
 570DECLARE_EVENT_CLASS(nfsd_stateid_class,
 571	TP_PROTO(stateid_t *stp),
 572	TP_ARGS(stp),
 573	TP_STRUCT__entry(
 574		__field(u32, cl_boot)
 575		__field(u32, cl_id)
 576		__field(u32, si_id)
 577		__field(u32, si_generation)
 578	),
 579	TP_fast_assign(
 580		__entry->cl_boot = stp->si_opaque.so_clid.cl_boot;
 581		__entry->cl_id = stp->si_opaque.so_clid.cl_id;
 582		__entry->si_id = stp->si_opaque.so_id;
 583		__entry->si_generation = stp->si_generation;
 584	),
 585	TP_printk("client %08x:%08x stateid %08x:%08x",
 586		__entry->cl_boot,
 587		__entry->cl_id,
 588		__entry->si_id,
 589		__entry->si_generation)
 590)
 591
 592#define DEFINE_STATEID_EVENT(name) \
 593DEFINE_EVENT(nfsd_stateid_class, nfsd_##name, \
 594	TP_PROTO(stateid_t *stp), \
 595	TP_ARGS(stp))
 596
 597DEFINE_STATEID_EVENT(layoutstate_alloc);
 598DEFINE_STATEID_EVENT(layoutstate_unhash);
 599DEFINE_STATEID_EVENT(layoutstate_free);
 600DEFINE_STATEID_EVENT(layout_get_lookup_fail);
 601DEFINE_STATEID_EVENT(layout_commit_lookup_fail);
 602DEFINE_STATEID_EVENT(layout_return_lookup_fail);
 603DEFINE_STATEID_EVENT(layout_recall);
 604DEFINE_STATEID_EVENT(layout_recall_done);
 605DEFINE_STATEID_EVENT(layout_recall_fail);
 606DEFINE_STATEID_EVENT(layout_recall_release);
 607
 608DEFINE_STATEID_EVENT(open);
 609DEFINE_STATEID_EVENT(deleg_read);
 610DEFINE_STATEID_EVENT(deleg_write);
 611DEFINE_STATEID_EVENT(deleg_return);
 612DEFINE_STATEID_EVENT(deleg_recall);
 613
 614DECLARE_EVENT_CLASS(nfsd_stateseqid_class,
 615	TP_PROTO(u32 seqid, const stateid_t *stp),
 616	TP_ARGS(seqid, stp),
 617	TP_STRUCT__entry(
 618		__field(u32, seqid)
 619		__field(u32, cl_boot)
 620		__field(u32, cl_id)
 621		__field(u32, si_id)
 622		__field(u32, si_generation)
 623	),
 624	TP_fast_assign(
 625		__entry->seqid = seqid;
 626		__entry->cl_boot = stp->si_opaque.so_clid.cl_boot;
 627		__entry->cl_id = stp->si_opaque.so_clid.cl_id;
 628		__entry->si_id = stp->si_opaque.so_id;
 629		__entry->si_generation = stp->si_generation;
 630	),
 631	TP_printk("seqid=%u client %08x:%08x stateid %08x:%08x",
 632		__entry->seqid, __entry->cl_boot, __entry->cl_id,
 633		__entry->si_id, __entry->si_generation)
 634)
 635
 636#define DEFINE_STATESEQID_EVENT(name) \
 637DEFINE_EVENT(nfsd_stateseqid_class, nfsd_##name, \
 638	TP_PROTO(u32 seqid, const stateid_t *stp), \
 639	TP_ARGS(seqid, stp))
 640
 641DEFINE_STATESEQID_EVENT(preprocess);
 642DEFINE_STATESEQID_EVENT(open_confirm);
 643
 644TRACE_DEFINE_ENUM(NFS4_OPEN_STID);
 645TRACE_DEFINE_ENUM(NFS4_LOCK_STID);
 646TRACE_DEFINE_ENUM(NFS4_DELEG_STID);
 647TRACE_DEFINE_ENUM(NFS4_CLOSED_STID);
 648TRACE_DEFINE_ENUM(NFS4_REVOKED_DELEG_STID);
 649TRACE_DEFINE_ENUM(NFS4_CLOSED_DELEG_STID);
 650TRACE_DEFINE_ENUM(NFS4_LAYOUT_STID);
 651
 652#define show_stid_type(x)						\
 653	__print_flags(x, "|",						\
 654		{ NFS4_OPEN_STID,		"OPEN" },		\
 655		{ NFS4_LOCK_STID,		"LOCK" },		\
 656		{ NFS4_DELEG_STID,		"DELEG" },		\
 657		{ NFS4_CLOSED_STID,		"CLOSED" },		\
 658		{ NFS4_REVOKED_DELEG_STID,	"REVOKED" },		\
 659		{ NFS4_CLOSED_DELEG_STID,	"CLOSED_DELEG" },	\
 660		{ NFS4_LAYOUT_STID,		"LAYOUT" })
 661
 662DECLARE_EVENT_CLASS(nfsd_stid_class,
 663	TP_PROTO(
 664		const struct nfs4_stid *stid
 665	),
 666	TP_ARGS(stid),
 667	TP_STRUCT__entry(
 668		__field(unsigned long, sc_type)
 
 669		__field(int, sc_count)
 670		__field(u32, cl_boot)
 671		__field(u32, cl_id)
 672		__field(u32, si_id)
 673		__field(u32, si_generation)
 674	),
 675	TP_fast_assign(
 676		const stateid_t *stp = &stid->sc_stateid;
 677
 678		__entry->sc_type = stid->sc_type;
 
 679		__entry->sc_count = refcount_read(&stid->sc_count);
 680		__entry->cl_boot = stp->si_opaque.so_clid.cl_boot;
 681		__entry->cl_id = stp->si_opaque.so_clid.cl_id;
 682		__entry->si_id = stp->si_opaque.so_id;
 683		__entry->si_generation = stp->si_generation;
 684	),
 685	TP_printk("client %08x:%08x stateid %08x:%08x ref=%d type=%s",
 686		__entry->cl_boot, __entry->cl_id,
 687		__entry->si_id, __entry->si_generation,
 688		__entry->sc_count, show_stid_type(__entry->sc_type)
 
 689	)
 690);
 691
 692#define DEFINE_STID_EVENT(name)					\
 693DEFINE_EVENT(nfsd_stid_class, nfsd_stid_##name,			\
 694	TP_PROTO(const struct nfs4_stid *stid),			\
 695	TP_ARGS(stid))
 696
 697DEFINE_STID_EVENT(revoke);
 698
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 699DECLARE_EVENT_CLASS(nfsd_clientid_class,
 700	TP_PROTO(const clientid_t *clid),
 701	TP_ARGS(clid),
 702	TP_STRUCT__entry(
 703		__field(u32, cl_boot)
 704		__field(u32, cl_id)
 705	),
 706	TP_fast_assign(
 707		__entry->cl_boot = clid->cl_boot;
 708		__entry->cl_id = clid->cl_id;
 709	),
 710	TP_printk("client %08x:%08x", __entry->cl_boot, __entry->cl_id)
 711)
 712
 713#define DEFINE_CLIENTID_EVENT(name) \
 714DEFINE_EVENT(nfsd_clientid_class, nfsd_clid_##name, \
 715	TP_PROTO(const clientid_t *clid), \
 716	TP_ARGS(clid))
 717
 718DEFINE_CLIENTID_EVENT(expire_unconf);
 719DEFINE_CLIENTID_EVENT(reclaim_complete);
 720DEFINE_CLIENTID_EVENT(confirmed);
 721DEFINE_CLIENTID_EVENT(destroyed);
 722DEFINE_CLIENTID_EVENT(admin_expired);
 723DEFINE_CLIENTID_EVENT(replaced);
 724DEFINE_CLIENTID_EVENT(purged);
 725DEFINE_CLIENTID_EVENT(renew);
 726DEFINE_CLIENTID_EVENT(stale);
 727
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 728DECLARE_EVENT_CLASS(nfsd_net_class,
 729	TP_PROTO(const struct nfsd_net *nn),
 730	TP_ARGS(nn),
 731	TP_STRUCT__entry(
 732		__field(unsigned long long, boot_time)
 733	),
 734	TP_fast_assign(
 735		__entry->boot_time = nn->boot_time;
 736	),
 737	TP_printk("boot_time=%16llx", __entry->boot_time)
 738)
 739
 740#define DEFINE_NET_EVENT(name) \
 741DEFINE_EVENT(nfsd_net_class, nfsd_##name, \
 742	TP_PROTO(const struct nfsd_net *nn), \
 743	TP_ARGS(nn))
 744
 745DEFINE_NET_EVENT(grace_start);
 746DEFINE_NET_EVENT(grace_complete);
 747
 748TRACE_EVENT(nfsd_writeverf_reset,
 749	TP_PROTO(
 750		const struct nfsd_net *nn,
 751		const struct svc_rqst *rqstp,
 752		int error
 753	),
 754	TP_ARGS(nn, rqstp, error),
 755	TP_STRUCT__entry(
 756		__field(unsigned long long, boot_time)
 757		__field(u32, xid)
 758		__field(int, error)
 759		__array(unsigned char, verifier, NFS4_VERIFIER_SIZE)
 760	),
 761	TP_fast_assign(
 762		__entry->boot_time = nn->boot_time;
 763		__entry->xid = be32_to_cpu(rqstp->rq_xid);
 764		__entry->error = error;
 765
 766		/* avoid seqlock inside TP_fast_assign */
 767		memcpy(__entry->verifier, nn->writeverf,
 768		       NFS4_VERIFIER_SIZE);
 769	),
 770	TP_printk("boot_time=%16llx xid=0x%08x error=%d new verifier=0x%s",
 771		__entry->boot_time, __entry->xid, __entry->error,
 772		__print_hex_str(__entry->verifier, NFS4_VERIFIER_SIZE)
 773	)
 774);
 775
 776TRACE_EVENT(nfsd_clid_cred_mismatch,
 777	TP_PROTO(
 778		const struct nfs4_client *clp,
 779		const struct svc_rqst *rqstp
 780	),
 781	TP_ARGS(clp, rqstp),
 782	TP_STRUCT__entry(
 783		__field(u32, cl_boot)
 784		__field(u32, cl_id)
 785		__field(unsigned long, cl_flavor)
 786		__field(unsigned long, new_flavor)
 787		__sockaddr(addr, rqstp->rq_xprt->xpt_remotelen)
 788	),
 789	TP_fast_assign(
 790		__entry->cl_boot = clp->cl_clientid.cl_boot;
 791		__entry->cl_id = clp->cl_clientid.cl_id;
 792		__entry->cl_flavor = clp->cl_cred.cr_flavor;
 793		__entry->new_flavor = rqstp->rq_cred.cr_flavor;
 794		__assign_sockaddr(addr, &rqstp->rq_xprt->xpt_remote,
 795				  rqstp->rq_xprt->xpt_remotelen);
 796	),
 797	TP_printk("client %08x:%08x flavor=%s, conflict=%s from addr=%pISpc",
 798		__entry->cl_boot, __entry->cl_id,
 799		show_nfsd_authflavor(__entry->cl_flavor),
 800		show_nfsd_authflavor(__entry->new_flavor),
 801		__get_sockaddr(addr)
 802	)
 803)
 804
 805TRACE_EVENT(nfsd_clid_verf_mismatch,
 806	TP_PROTO(
 807		const struct nfs4_client *clp,
 808		const struct svc_rqst *rqstp,
 809		const nfs4_verifier *verf
 810	),
 811	TP_ARGS(clp, rqstp, verf),
 812	TP_STRUCT__entry(
 813		__field(u32, cl_boot)
 814		__field(u32, cl_id)
 815		__array(unsigned char, cl_verifier, NFS4_VERIFIER_SIZE)
 816		__array(unsigned char, new_verifier, NFS4_VERIFIER_SIZE)
 817		__sockaddr(addr, rqstp->rq_xprt->xpt_remotelen)
 818	),
 819	TP_fast_assign(
 820		__entry->cl_boot = clp->cl_clientid.cl_boot;
 821		__entry->cl_id = clp->cl_clientid.cl_id;
 822		memcpy(__entry->cl_verifier, (void *)&clp->cl_verifier,
 823		       NFS4_VERIFIER_SIZE);
 824		memcpy(__entry->new_verifier, (void *)verf,
 825		       NFS4_VERIFIER_SIZE);
 826		__assign_sockaddr(addr, &rqstp->rq_xprt->xpt_remote,
 827				  rqstp->rq_xprt->xpt_remotelen);
 828	),
 829	TP_printk("client %08x:%08x verf=0x%s, updated=0x%s from addr=%pISpc",
 830		__entry->cl_boot, __entry->cl_id,
 831		__print_hex_str(__entry->cl_verifier, NFS4_VERIFIER_SIZE),
 832		__print_hex_str(__entry->new_verifier, NFS4_VERIFIER_SIZE),
 833		__get_sockaddr(addr)
 834	)
 835);
 836
 837DECLARE_EVENT_CLASS(nfsd_clid_class,
 838	TP_PROTO(const struct nfs4_client *clp),
 839	TP_ARGS(clp),
 840	TP_STRUCT__entry(
 841		__field(u32, cl_boot)
 842		__field(u32, cl_id)
 843		__array(unsigned char, addr, sizeof(struct sockaddr_in6))
 844		__field(unsigned long, flavor)
 845		__array(unsigned char, verifier, NFS4_VERIFIER_SIZE)
 846		__string_len(name, name, clp->cl_name.len)
 847	),
 848	TP_fast_assign(
 849		__entry->cl_boot = clp->cl_clientid.cl_boot;
 850		__entry->cl_id = clp->cl_clientid.cl_id;
 851		memcpy(__entry->addr, &clp->cl_addr,
 852			sizeof(struct sockaddr_in6));
 853		__entry->flavor = clp->cl_cred.cr_flavor;
 854		memcpy(__entry->verifier, (void *)&clp->cl_verifier,
 855		       NFS4_VERIFIER_SIZE);
 856		__assign_str_len(name, clp->cl_name.data, clp->cl_name.len);
 857	),
 858	TP_printk("addr=%pISpc name='%s' verifier=0x%s flavor=%s client=%08x:%08x",
 859		__entry->addr, __get_str(name),
 860		__print_hex_str(__entry->verifier, NFS4_VERIFIER_SIZE),
 861		show_nfsd_authflavor(__entry->flavor),
 862		__entry->cl_boot, __entry->cl_id)
 863);
 864
 865#define DEFINE_CLID_EVENT(name) \
 866DEFINE_EVENT(nfsd_clid_class, nfsd_clid_##name, \
 867	TP_PROTO(const struct nfs4_client *clp), \
 868	TP_ARGS(clp))
 869
 870DEFINE_CLID_EVENT(fresh);
 871DEFINE_CLID_EVENT(confirmed_r);
 872
 873/*
 874 * from fs/nfsd/filecache.h
 875 */
 876#define show_nf_flags(val)						\
 877	__print_flags(val, "|",						\
 878		{ 1 << NFSD_FILE_HASHED,	"HASHED" },		\
 879		{ 1 << NFSD_FILE_PENDING,	"PENDING" },		\
 880		{ 1 << NFSD_FILE_REFERENCED,	"REFERENCED" },		\
 881		{ 1 << NFSD_FILE_GC,		"GC" })
 882
 883DECLARE_EVENT_CLASS(nfsd_file_class,
 884	TP_PROTO(struct nfsd_file *nf),
 885	TP_ARGS(nf),
 886	TP_STRUCT__entry(
 887		__field(void *, nf_inode)
 888		__field(int, nf_ref)
 889		__field(unsigned long, nf_flags)
 890		__field(unsigned char, nf_may)
 891		__field(struct file *, nf_file)
 892	),
 893	TP_fast_assign(
 894		__entry->nf_inode = nf->nf_inode;
 895		__entry->nf_ref = refcount_read(&nf->nf_ref);
 896		__entry->nf_flags = nf->nf_flags;
 897		__entry->nf_may = nf->nf_may;
 898		__entry->nf_file = nf->nf_file;
 899	),
 900	TP_printk("inode=%p ref=%d flags=%s may=%s nf_file=%p",
 901		__entry->nf_inode,
 902		__entry->nf_ref,
 903		show_nf_flags(__entry->nf_flags),
 904		show_nfsd_may_flags(__entry->nf_may),
 905		__entry->nf_file)
 906)
 907
 908#define DEFINE_NFSD_FILE_EVENT(name) \
 909DEFINE_EVENT(nfsd_file_class, name, \
 910	TP_PROTO(struct nfsd_file *nf), \
 911	TP_ARGS(nf))
 912
 913DEFINE_NFSD_FILE_EVENT(nfsd_file_free);
 914DEFINE_NFSD_FILE_EVENT(nfsd_file_unhash);
 915DEFINE_NFSD_FILE_EVENT(nfsd_file_put);
 916DEFINE_NFSD_FILE_EVENT(nfsd_file_closing);
 917DEFINE_NFSD_FILE_EVENT(nfsd_file_unhash_and_queue);
 918
 919TRACE_EVENT(nfsd_file_alloc,
 920	TP_PROTO(
 921		const struct nfsd_file *nf
 922	),
 923	TP_ARGS(nf),
 924	TP_STRUCT__entry(
 925		__field(const void *, nf_inode)
 926		__field(unsigned long, nf_flags)
 927		__field(unsigned long, nf_may)
 928		__field(unsigned int, nf_ref)
 929	),
 930	TP_fast_assign(
 931		__entry->nf_inode = nf->nf_inode;
 932		__entry->nf_flags = nf->nf_flags;
 933		__entry->nf_ref = refcount_read(&nf->nf_ref);
 934		__entry->nf_may = nf->nf_may;
 935	),
 936	TP_printk("inode=%p ref=%u flags=%s may=%s",
 937		__entry->nf_inode, __entry->nf_ref,
 938		show_nf_flags(__entry->nf_flags),
 939		show_nfsd_may_flags(__entry->nf_may)
 940	)
 941);
 942
 943TRACE_EVENT(nfsd_file_acquire,
 944	TP_PROTO(
 945		const struct svc_rqst *rqstp,
 946		const struct inode *inode,
 947		unsigned int may_flags,
 948		const struct nfsd_file *nf,
 949		__be32 status
 950	),
 951
 952	TP_ARGS(rqstp, inode, may_flags, nf, status),
 953
 954	TP_STRUCT__entry(
 955		__field(u32, xid)
 956		__field(const void *, inode)
 957		__field(unsigned long, may_flags)
 958		__field(unsigned int, nf_ref)
 959		__field(unsigned long, nf_flags)
 960		__field(unsigned long, nf_may)
 961		__field(const void *, nf_file)
 962		__field(u32, status)
 963	),
 964
 965	TP_fast_assign(
 966		__entry->xid = be32_to_cpu(rqstp->rq_xid);
 967		__entry->inode = inode;
 968		__entry->may_flags = may_flags;
 969		__entry->nf_ref = nf ? refcount_read(&nf->nf_ref) : 0;
 970		__entry->nf_flags = nf ? nf->nf_flags : 0;
 971		__entry->nf_may = nf ? nf->nf_may : 0;
 972		__entry->nf_file = nf ? nf->nf_file : NULL;
 973		__entry->status = be32_to_cpu(status);
 974	),
 975
 976	TP_printk("xid=0x%x inode=%p may_flags=%s ref=%u nf_flags=%s nf_may=%s nf_file=%p status=%u",
 977			__entry->xid, __entry->inode,
 978			show_nfsd_may_flags(__entry->may_flags),
 979			__entry->nf_ref, show_nf_flags(__entry->nf_flags),
 980			show_nfsd_may_flags(__entry->nf_may),
 981			__entry->nf_file, __entry->status
 982	)
 983);
 984
 985TRACE_EVENT(nfsd_file_insert_err,
 986	TP_PROTO(
 987		const struct svc_rqst *rqstp,
 988		const struct inode *inode,
 989		unsigned int may_flags,
 990		long error
 991	),
 992	TP_ARGS(rqstp, inode, may_flags, error),
 993	TP_STRUCT__entry(
 994		__field(u32, xid)
 995		__field(const void *, inode)
 996		__field(unsigned long, may_flags)
 997		__field(long, error)
 998	),
 999	TP_fast_assign(
1000		__entry->xid = be32_to_cpu(rqstp->rq_xid);
1001		__entry->inode = inode;
1002		__entry->may_flags = may_flags;
1003		__entry->error = error;
1004	),
1005	TP_printk("xid=0x%x inode=%p may_flags=%s error=%ld",
1006		__entry->xid, __entry->inode,
1007		show_nfsd_may_flags(__entry->may_flags),
1008		__entry->error
1009	)
1010);
1011
1012TRACE_EVENT(nfsd_file_cons_err,
1013	TP_PROTO(
1014		const struct svc_rqst *rqstp,
1015		const struct inode *inode,
1016		unsigned int may_flags,
1017		const struct nfsd_file *nf
1018	),
1019	TP_ARGS(rqstp, inode, may_flags, nf),
1020	TP_STRUCT__entry(
1021		__field(u32, xid)
1022		__field(const void *, inode)
1023		__field(unsigned long, may_flags)
1024		__field(unsigned int, nf_ref)
1025		__field(unsigned long, nf_flags)
1026		__field(unsigned long, nf_may)
1027		__field(const void *, nf_file)
1028	),
1029	TP_fast_assign(
1030		__entry->xid = be32_to_cpu(rqstp->rq_xid);
1031		__entry->inode = inode;
1032		__entry->may_flags = may_flags;
1033		__entry->nf_ref = refcount_read(&nf->nf_ref);
1034		__entry->nf_flags = nf->nf_flags;
1035		__entry->nf_may = nf->nf_may;
1036		__entry->nf_file = nf->nf_file;
1037	),
1038	TP_printk("xid=0x%x inode=%p may_flags=%s ref=%u nf_flags=%s nf_may=%s nf_file=%p",
1039		__entry->xid, __entry->inode,
1040		show_nfsd_may_flags(__entry->may_flags), __entry->nf_ref,
1041		show_nf_flags(__entry->nf_flags),
1042		show_nfsd_may_flags(__entry->nf_may), __entry->nf_file
1043	)
1044);
1045
1046DECLARE_EVENT_CLASS(nfsd_file_open_class,
1047	TP_PROTO(const struct nfsd_file *nf, __be32 status),
1048	TP_ARGS(nf, status),
1049	TP_STRUCT__entry(
1050		__field(void *, nf_inode)	/* cannot be dereferenced */
1051		__field(int, nf_ref)
1052		__field(unsigned long, nf_flags)
1053		__field(unsigned long, nf_may)
1054		__field(void *, nf_file)	/* cannot be dereferenced */
1055	),
1056	TP_fast_assign(
1057		__entry->nf_inode = nf->nf_inode;
1058		__entry->nf_ref = refcount_read(&nf->nf_ref);
1059		__entry->nf_flags = nf->nf_flags;
1060		__entry->nf_may = nf->nf_may;
1061		__entry->nf_file = nf->nf_file;
1062	),
1063	TP_printk("inode=%p ref=%d flags=%s may=%s file=%p",
1064		__entry->nf_inode,
1065		__entry->nf_ref,
1066		show_nf_flags(__entry->nf_flags),
1067		show_nfsd_may_flags(__entry->nf_may),
1068		__entry->nf_file)
1069)
1070
1071#define DEFINE_NFSD_FILE_OPEN_EVENT(name)					\
1072DEFINE_EVENT(nfsd_file_open_class, name,					\
1073	TP_PROTO(							\
1074		const struct nfsd_file *nf,				\
1075		__be32 status						\
1076	),								\
1077	TP_ARGS(nf, status))
1078
1079DEFINE_NFSD_FILE_OPEN_EVENT(nfsd_file_open);
1080DEFINE_NFSD_FILE_OPEN_EVENT(nfsd_file_opened);
1081
1082TRACE_EVENT(nfsd_file_is_cached,
1083	TP_PROTO(
1084		const struct inode *inode,
1085		int found
1086	),
1087	TP_ARGS(inode, found),
1088	TP_STRUCT__entry(
1089		__field(const struct inode *, inode)
1090		__field(int, found)
1091	),
1092	TP_fast_assign(
1093		__entry->inode = inode;
1094		__entry->found = found;
1095	),
1096	TP_printk("inode=%p is %scached",
1097		__entry->inode,
1098		__entry->found ? "" : "not "
1099	)
1100);
1101
1102TRACE_EVENT(nfsd_file_fsnotify_handle_event,
1103	TP_PROTO(struct inode *inode, u32 mask),
1104	TP_ARGS(inode, mask),
1105	TP_STRUCT__entry(
1106		__field(struct inode *, inode)
1107		__field(unsigned int, nlink)
1108		__field(umode_t, mode)
1109		__field(u32, mask)
1110	),
1111	TP_fast_assign(
1112		__entry->inode = inode;
1113		__entry->nlink = inode->i_nlink;
1114		__entry->mode = inode->i_mode;
1115		__entry->mask = mask;
1116	),
1117	TP_printk("inode=%p nlink=%u mode=0%ho mask=0x%x", __entry->inode,
1118			__entry->nlink, __entry->mode, __entry->mask)
1119);
1120
1121DECLARE_EVENT_CLASS(nfsd_file_gc_class,
1122	TP_PROTO(
1123		const struct nfsd_file *nf
1124	),
1125	TP_ARGS(nf),
1126	TP_STRUCT__entry(
1127		__field(void *, nf_inode)
1128		__field(void *, nf_file)
1129		__field(int, nf_ref)
1130		__field(unsigned long, nf_flags)
1131	),
1132	TP_fast_assign(
1133		__entry->nf_inode = nf->nf_inode;
1134		__entry->nf_file = nf->nf_file;
1135		__entry->nf_ref = refcount_read(&nf->nf_ref);
1136		__entry->nf_flags = nf->nf_flags;
1137	),
1138	TP_printk("inode=%p ref=%d nf_flags=%s nf_file=%p",
1139		__entry->nf_inode, __entry->nf_ref,
1140		show_nf_flags(__entry->nf_flags),
1141		__entry->nf_file
1142	)
1143);
1144
1145#define DEFINE_NFSD_FILE_GC_EVENT(name)					\
1146DEFINE_EVENT(nfsd_file_gc_class, name,					\
1147	TP_PROTO(							\
1148		const struct nfsd_file *nf				\
1149	),								\
1150	TP_ARGS(nf))
1151
1152DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_lru_add);
1153DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_lru_add_disposed);
1154DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_lru_del);
1155DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_lru_del_disposed);
1156DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_gc_in_use);
1157DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_gc_writeback);
1158DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_gc_referenced);
1159DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_gc_disposed);
1160
1161DECLARE_EVENT_CLASS(nfsd_file_lruwalk_class,
1162	TP_PROTO(
1163		unsigned long removed,
1164		unsigned long remaining
1165	),
1166	TP_ARGS(removed, remaining),
1167	TP_STRUCT__entry(
1168		__field(unsigned long, removed)
1169		__field(unsigned long, remaining)
1170	),
1171	TP_fast_assign(
1172		__entry->removed = removed;
1173		__entry->remaining = remaining;
1174	),
1175	TP_printk("%lu entries removed, %lu remaining",
1176		__entry->removed, __entry->remaining)
1177);
1178
1179#define DEFINE_NFSD_FILE_LRUWALK_EVENT(name)				\
1180DEFINE_EVENT(nfsd_file_lruwalk_class, name,				\
1181	TP_PROTO(							\
1182		unsigned long removed,					\
1183		unsigned long remaining					\
1184	),								\
1185	TP_ARGS(removed, remaining))
1186
1187DEFINE_NFSD_FILE_LRUWALK_EVENT(nfsd_file_gc_removed);
1188DEFINE_NFSD_FILE_LRUWALK_EVENT(nfsd_file_shrinker_removed);
1189
1190TRACE_EVENT(nfsd_file_close,
1191	TP_PROTO(
1192		const struct inode *inode
1193	),
1194	TP_ARGS(inode),
1195	TP_STRUCT__entry(
1196		__field(const void *, inode)
1197	),
1198	TP_fast_assign(
1199		__entry->inode = inode;
1200	),
1201	TP_printk("inode=%p",
1202		__entry->inode
1203	)
1204);
1205
1206#include "cache.h"
1207
1208TRACE_DEFINE_ENUM(RC_DROPIT);
1209TRACE_DEFINE_ENUM(RC_REPLY);
1210TRACE_DEFINE_ENUM(RC_DOIT);
1211
1212#define show_drc_retval(x)						\
1213	__print_symbolic(x,						\
1214		{ RC_DROPIT, "DROPIT" },				\
1215		{ RC_REPLY, "REPLY" },					\
1216		{ RC_DOIT, "DOIT" })
1217
1218TRACE_EVENT(nfsd_drc_found,
1219	TP_PROTO(
1220		const struct nfsd_net *nn,
1221		const struct svc_rqst *rqstp,
1222		int result
1223	),
1224	TP_ARGS(nn, rqstp, result),
1225	TP_STRUCT__entry(
1226		__field(unsigned long long, boot_time)
1227		__field(unsigned long, result)
1228		__field(u32, xid)
1229	),
1230	TP_fast_assign(
1231		__entry->boot_time = nn->boot_time;
1232		__entry->result = result;
1233		__entry->xid = be32_to_cpu(rqstp->rq_xid);
1234	),
1235	TP_printk("boot_time=%16llx xid=0x%08x result=%s",
1236		__entry->boot_time, __entry->xid,
1237		show_drc_retval(__entry->result))
1238
1239);
1240
1241TRACE_EVENT(nfsd_drc_mismatch,
1242	TP_PROTO(
1243		const struct nfsd_net *nn,
1244		const struct nfsd_cacherep *key,
1245		const struct nfsd_cacherep *rp
1246	),
1247	TP_ARGS(nn, key, rp),
1248	TP_STRUCT__entry(
1249		__field(unsigned long long, boot_time)
1250		__field(u32, xid)
1251		__field(u32, cached)
1252		__field(u32, ingress)
1253	),
1254	TP_fast_assign(
1255		__entry->boot_time = nn->boot_time;
1256		__entry->xid = be32_to_cpu(key->c_key.k_xid);
1257		__entry->cached = (__force u32)key->c_key.k_csum;
1258		__entry->ingress = (__force u32)rp->c_key.k_csum;
1259	),
1260	TP_printk("boot_time=%16llx xid=0x%08x cached-csum=0x%08x ingress-csum=0x%08x",
1261		__entry->boot_time, __entry->xid, __entry->cached,
1262		__entry->ingress)
1263);
1264
1265TRACE_EVENT(nfsd_cb_args,
1266	TP_PROTO(
1267		const struct nfs4_client *clp,
1268		const struct nfs4_cb_conn *conn
1269	),
1270	TP_ARGS(clp, conn),
1271	TP_STRUCT__entry(
1272		__field(u32, cl_boot)
1273		__field(u32, cl_id)
1274		__field(u32, prog)
1275		__field(u32, ident)
1276		__sockaddr(addr, conn->cb_addrlen)
1277	),
1278	TP_fast_assign(
1279		__entry->cl_boot = clp->cl_clientid.cl_boot;
1280		__entry->cl_id = clp->cl_clientid.cl_id;
1281		__entry->prog = conn->cb_prog;
1282		__entry->ident = conn->cb_ident;
1283		__assign_sockaddr(addr, &conn->cb_addr, conn->cb_addrlen);
1284	),
1285	TP_printk("addr=%pISpc client %08x:%08x prog=%u ident=%u",
1286		__get_sockaddr(addr), __entry->cl_boot, __entry->cl_id,
1287		__entry->prog, __entry->ident)
1288);
1289
1290TRACE_EVENT(nfsd_cb_nodelegs,
1291	TP_PROTO(const struct nfs4_client *clp),
1292	TP_ARGS(clp),
1293	TP_STRUCT__entry(
1294		__field(u32, cl_boot)
1295		__field(u32, cl_id)
1296	),
1297	TP_fast_assign(
1298		__entry->cl_boot = clp->cl_clientid.cl_boot;
1299		__entry->cl_id = clp->cl_clientid.cl_id;
1300	),
1301	TP_printk("client %08x:%08x", __entry->cl_boot, __entry->cl_id)
1302)
1303
1304#define show_cb_state(val)						\
1305	__print_symbolic(val,						\
1306		{ NFSD4_CB_UP,		"UP" },				\
1307		{ NFSD4_CB_UNKNOWN,	"UNKNOWN" },			\
1308		{ NFSD4_CB_DOWN,	"DOWN" },			\
1309		{ NFSD4_CB_FAULT,	"FAULT"})
1310
1311DECLARE_EVENT_CLASS(nfsd_cb_class,
1312	TP_PROTO(const struct nfs4_client *clp),
1313	TP_ARGS(clp),
1314	TP_STRUCT__entry(
1315		__field(unsigned long, state)
1316		__field(u32, cl_boot)
1317		__field(u32, cl_id)
1318		__sockaddr(addr, clp->cl_cb_conn.cb_addrlen)
1319	),
1320	TP_fast_assign(
1321		__entry->state = clp->cl_cb_state;
1322		__entry->cl_boot = clp->cl_clientid.cl_boot;
1323		__entry->cl_id = clp->cl_clientid.cl_id;
1324		__assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr,
1325				  clp->cl_cb_conn.cb_addrlen)
1326	),
1327	TP_printk("addr=%pISpc client %08x:%08x state=%s",
1328		__get_sockaddr(addr), __entry->cl_boot, __entry->cl_id,
1329		show_cb_state(__entry->state))
1330);
1331
1332#define DEFINE_NFSD_CB_EVENT(name)			\
1333DEFINE_EVENT(nfsd_cb_class, nfsd_cb_##name,		\
1334	TP_PROTO(const struct nfs4_client *clp),	\
1335	TP_ARGS(clp))
1336
1337DEFINE_NFSD_CB_EVENT(state);
 
1338DEFINE_NFSD_CB_EVENT(probe);
1339DEFINE_NFSD_CB_EVENT(lost);
1340DEFINE_NFSD_CB_EVENT(shutdown);
 
 
 
1341
1342TRACE_DEFINE_ENUM(RPC_AUTH_NULL);
1343TRACE_DEFINE_ENUM(RPC_AUTH_UNIX);
1344TRACE_DEFINE_ENUM(RPC_AUTH_GSS);
1345TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5);
1346TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5I);
1347TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5P);
1348
1349#define show_nfsd_authflavor(val)					\
1350	__print_symbolic(val,						\
1351		{ RPC_AUTH_NULL,		"none" },		\
1352		{ RPC_AUTH_UNIX,		"sys" },		\
1353		{ RPC_AUTH_GSS,			"gss" },		\
1354		{ RPC_AUTH_GSS_KRB5,		"krb5" },		\
1355		{ RPC_AUTH_GSS_KRB5I,		"krb5i" },		\
1356		{ RPC_AUTH_GSS_KRB5P,		"krb5p" })
1357
1358TRACE_EVENT(nfsd_cb_setup,
1359	TP_PROTO(const struct nfs4_client *clp,
1360		 const char *netid,
1361		 rpc_authflavor_t authflavor
1362	),
1363	TP_ARGS(clp, netid, authflavor),
1364	TP_STRUCT__entry(
1365		__field(u32, cl_boot)
1366		__field(u32, cl_id)
1367		__field(unsigned long, authflavor)
1368		__sockaddr(addr, clp->cl_cb_conn.cb_addrlen)
1369		__string(netid, netid)
1370	),
1371	TP_fast_assign(
1372		__entry->cl_boot = clp->cl_clientid.cl_boot;
1373		__entry->cl_id = clp->cl_clientid.cl_id;
1374		__assign_str(netid, netid);
1375		__entry->authflavor = authflavor;
1376		__assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr,
1377				  clp->cl_cb_conn.cb_addrlen)
1378	),
1379	TP_printk("addr=%pISpc client %08x:%08x proto=%s flavor=%s",
1380		__get_sockaddr(addr), __entry->cl_boot, __entry->cl_id,
1381		__get_str(netid), show_nfsd_authflavor(__entry->authflavor))
1382);
1383
1384TRACE_EVENT(nfsd_cb_setup_err,
1385	TP_PROTO(
1386		const struct nfs4_client *clp,
1387		long error
1388	),
1389	TP_ARGS(clp, error),
1390	TP_STRUCT__entry(
1391		__field(long, error)
1392		__field(u32, cl_boot)
1393		__field(u32, cl_id)
1394		__sockaddr(addr, clp->cl_cb_conn.cb_addrlen)
1395	),
1396	TP_fast_assign(
1397		__entry->error = error;
1398		__entry->cl_boot = clp->cl_clientid.cl_boot;
1399		__entry->cl_id = clp->cl_clientid.cl_id;
1400		__assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr,
1401				  clp->cl_cb_conn.cb_addrlen)
1402	),
1403	TP_printk("addr=%pISpc client %08x:%08x error=%ld",
1404		__get_sockaddr(addr), __entry->cl_boot, __entry->cl_id,
1405		__entry->error)
1406);
1407
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1408TRACE_EVENT_CONDITION(nfsd_cb_recall,
1409	TP_PROTO(
1410		const struct nfs4_stid *stid
1411	),
1412	TP_ARGS(stid),
1413	TP_CONDITION(stid->sc_client),
1414	TP_STRUCT__entry(
1415		__field(u32, cl_boot)
1416		__field(u32, cl_id)
1417		__field(u32, si_id)
1418		__field(u32, si_generation)
1419		__sockaddr(addr, stid->sc_client->cl_cb_conn.cb_addrlen)
1420	),
1421	TP_fast_assign(
1422		const stateid_t *stp = &stid->sc_stateid;
1423		const struct nfs4_client *clp = stid->sc_client;
1424
1425		__entry->cl_boot = stp->si_opaque.so_clid.cl_boot;
1426		__entry->cl_id = stp->si_opaque.so_clid.cl_id;
1427		__entry->si_id = stp->si_opaque.so_id;
1428		__entry->si_generation = stp->si_generation;
1429		__assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr,
1430				  clp->cl_cb_conn.cb_addrlen)
1431	),
1432	TP_printk("addr=%pISpc client %08x:%08x stateid %08x:%08x",
1433		__get_sockaddr(addr), __entry->cl_boot, __entry->cl_id,
1434		__entry->si_id, __entry->si_generation)
1435);
1436
1437TRACE_EVENT(nfsd_cb_notify_lock,
1438	TP_PROTO(
1439		const struct nfs4_lockowner *lo,
1440		const struct nfsd4_blocked_lock *nbl
1441	),
1442	TP_ARGS(lo, nbl),
1443	TP_STRUCT__entry(
1444		__field(u32, cl_boot)
1445		__field(u32, cl_id)
1446		__field(u32, fh_hash)
1447		__sockaddr(addr, lo->lo_owner.so_client->cl_cb_conn.cb_addrlen)
1448	),
1449	TP_fast_assign(
1450		const struct nfs4_client *clp = lo->lo_owner.so_client;
1451
1452		__entry->cl_boot = clp->cl_clientid.cl_boot;
1453		__entry->cl_id = clp->cl_clientid.cl_id;
1454		__entry->fh_hash = knfsd_fh_hash(&nbl->nbl_fh);
1455		__assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr,
1456				  clp->cl_cb_conn.cb_addrlen)
1457	),
1458	TP_printk("addr=%pISpc client %08x:%08x fh_hash=0x%08x",
1459		__get_sockaddr(addr), __entry->cl_boot, __entry->cl_id,
1460		__entry->fh_hash)
1461);
1462
1463TRACE_EVENT(nfsd_cb_offload,
1464	TP_PROTO(
1465		const struct nfs4_client *clp,
1466		const stateid_t *stp,
1467		const struct knfsd_fh *fh,
1468		u64 count,
1469		__be32 status
1470	),
1471	TP_ARGS(clp, stp, fh, count, status),
1472	TP_STRUCT__entry(
1473		__field(u32, cl_boot)
1474		__field(u32, cl_id)
1475		__field(u32, si_id)
1476		__field(u32, si_generation)
1477		__field(u32, fh_hash)
1478		__field(int, status)
1479		__field(u64, count)
1480		__sockaddr(addr, clp->cl_cb_conn.cb_addrlen)
1481	),
1482	TP_fast_assign(
1483		__entry->cl_boot = stp->si_opaque.so_clid.cl_boot;
1484		__entry->cl_id = stp->si_opaque.so_clid.cl_id;
1485		__entry->si_id = stp->si_opaque.so_id;
1486		__entry->si_generation = stp->si_generation;
1487		__entry->fh_hash = knfsd_fh_hash(fh);
1488		__entry->status = be32_to_cpu(status);
1489		__entry->count = count;
1490		__assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr,
1491				  clp->cl_cb_conn.cb_addrlen)
1492	),
1493	TP_printk("addr=%pISpc client %08x:%08x stateid %08x:%08x fh_hash=0x%08x count=%llu status=%d",
1494		__get_sockaddr(addr), __entry->cl_boot, __entry->cl_id,
1495		__entry->si_id, __entry->si_generation,
1496		__entry->fh_hash, __entry->count, __entry->status)
1497);
1498
1499TRACE_EVENT(nfsd_cb_recall_any,
1500	TP_PROTO(
1501		const struct nfsd4_cb_recall_any *ra
1502	),
1503	TP_ARGS(ra),
1504	TP_STRUCT__entry(
1505		__field(u32, cl_boot)
1506		__field(u32, cl_id)
1507		__field(u32, keep)
1508		__field(unsigned long, bmval0)
1509		__sockaddr(addr, ra->ra_cb.cb_clp->cl_cb_conn.cb_addrlen)
1510	),
1511	TP_fast_assign(
1512		__entry->cl_boot = ra->ra_cb.cb_clp->cl_clientid.cl_boot;
1513		__entry->cl_id = ra->ra_cb.cb_clp->cl_clientid.cl_id;
1514		__entry->keep = ra->ra_keep;
1515		__entry->bmval0 = ra->ra_bmval[0];
1516		__assign_sockaddr(addr, &ra->ra_cb.cb_clp->cl_addr,
1517				  ra->ra_cb.cb_clp->cl_cb_conn.cb_addrlen);
1518	),
1519	TP_printk("addr=%pISpc client %08x:%08x keep=%u bmval0=%s",
1520		__get_sockaddr(addr), __entry->cl_boot, __entry->cl_id,
1521		__entry->keep, show_rca_mask(__entry->bmval0)
1522	)
1523);
1524
1525DECLARE_EVENT_CLASS(nfsd_cb_done_class,
1526	TP_PROTO(
1527		const stateid_t *stp,
1528		const struct rpc_task *task
1529	),
1530	TP_ARGS(stp, task),
1531	TP_STRUCT__entry(
1532		__field(u32, cl_boot)
1533		__field(u32, cl_id)
1534		__field(u32, si_id)
1535		__field(u32, si_generation)
1536		__field(int, status)
1537	),
1538	TP_fast_assign(
1539		__entry->cl_boot = stp->si_opaque.so_clid.cl_boot;
1540		__entry->cl_id = stp->si_opaque.so_clid.cl_id;
1541		__entry->si_id = stp->si_opaque.so_id;
1542		__entry->si_generation = stp->si_generation;
1543		__entry->status = task->tk_status;
1544	),
1545	TP_printk("client %08x:%08x stateid %08x:%08x status=%d",
1546		__entry->cl_boot, __entry->cl_id, __entry->si_id,
1547		__entry->si_generation, __entry->status
1548	)
1549);
1550
1551#define DEFINE_NFSD_CB_DONE_EVENT(name)			\
1552DEFINE_EVENT(nfsd_cb_done_class, name,			\
1553	TP_PROTO(					\
1554		const stateid_t *stp,			\
1555		const struct rpc_task *task		\
1556	),						\
1557	TP_ARGS(stp, task))
1558
1559DEFINE_NFSD_CB_DONE_EVENT(nfsd_cb_recall_done);
1560DEFINE_NFSD_CB_DONE_EVENT(nfsd_cb_notify_lock_done);
1561DEFINE_NFSD_CB_DONE_EVENT(nfsd_cb_layout_done);
1562DEFINE_NFSD_CB_DONE_EVENT(nfsd_cb_offload_done);
 
1563
1564TRACE_EVENT(nfsd_cb_recall_any_done,
1565	TP_PROTO(
1566		const struct nfsd4_callback *cb,
1567		const struct rpc_task *task
1568	),
1569	TP_ARGS(cb, task),
1570	TP_STRUCT__entry(
1571		__field(u32, cl_boot)
1572		__field(u32, cl_id)
1573		__field(int, status)
1574	),
1575	TP_fast_assign(
1576		__entry->status = task->tk_status;
1577		__entry->cl_boot = cb->cb_clp->cl_clientid.cl_boot;
1578		__entry->cl_id = cb->cb_clp->cl_clientid.cl_id;
1579	),
1580	TP_printk("client %08x:%08x status=%d",
1581		__entry->cl_boot, __entry->cl_id, __entry->status
1582	)
1583);
1584
1585TRACE_EVENT(nfsd_ctl_unlock_ip,
1586	TP_PROTO(
1587		const struct net *net,
1588		const char *address
1589	),
1590	TP_ARGS(net, address),
1591	TP_STRUCT__entry(
1592		__field(unsigned int, netns_ino)
1593		__string(address, address)
1594	),
1595	TP_fast_assign(
1596		__entry->netns_ino = net->ns.inum;
1597		__assign_str(address, address);
1598	),
1599	TP_printk("address=%s",
1600		__get_str(address)
1601	)
1602);
1603
1604TRACE_EVENT(nfsd_ctl_unlock_fs,
1605	TP_PROTO(
1606		const struct net *net,
1607		const char *path
1608	),
1609	TP_ARGS(net, path),
1610	TP_STRUCT__entry(
1611		__field(unsigned int, netns_ino)
1612		__string(path, path)
1613	),
1614	TP_fast_assign(
1615		__entry->netns_ino = net->ns.inum;
1616		__assign_str(path, path);
1617	),
1618	TP_printk("path=%s",
1619		__get_str(path)
1620	)
1621);
1622
1623TRACE_EVENT(nfsd_ctl_filehandle,
1624	TP_PROTO(
1625		const struct net *net,
1626		const char *domain,
1627		const char *path,
1628		int maxsize
1629	),
1630	TP_ARGS(net, domain, path, maxsize),
1631	TP_STRUCT__entry(
1632		__field(unsigned int, netns_ino)
1633		__field(int, maxsize)
1634		__string(domain, domain)
1635		__string(path, path)
1636	),
1637	TP_fast_assign(
1638		__entry->netns_ino = net->ns.inum;
1639		__entry->maxsize = maxsize;
1640		__assign_str(domain, domain);
1641		__assign_str(path, path);
1642	),
1643	TP_printk("domain=%s path=%s maxsize=%d",
1644		__get_str(domain), __get_str(path), __entry->maxsize
1645	)
1646);
1647
1648TRACE_EVENT(nfsd_ctl_threads,
1649	TP_PROTO(
1650		const struct net *net,
1651		int newthreads
1652	),
1653	TP_ARGS(net, newthreads),
1654	TP_STRUCT__entry(
1655		__field(unsigned int, netns_ino)
1656		__field(int, newthreads)
1657	),
1658	TP_fast_assign(
1659		__entry->netns_ino = net->ns.inum;
1660		__entry->newthreads = newthreads;
1661	),
1662	TP_printk("newthreads=%d",
1663		__entry->newthreads
1664	)
1665);
1666
1667TRACE_EVENT(nfsd_ctl_pool_threads,
1668	TP_PROTO(
1669		const struct net *net,
1670		int pool,
1671		int nrthreads
1672	),
1673	TP_ARGS(net, pool, nrthreads),
1674	TP_STRUCT__entry(
1675		__field(unsigned int, netns_ino)
1676		__field(int, pool)
1677		__field(int, nrthreads)
1678	),
1679	TP_fast_assign(
1680		__entry->netns_ino = net->ns.inum;
1681		__entry->pool = pool;
1682		__entry->nrthreads = nrthreads;
1683	),
1684	TP_printk("pool=%d nrthreads=%d",
1685		__entry->pool, __entry->nrthreads
1686	)
1687);
1688
1689TRACE_EVENT(nfsd_ctl_version,
1690	TP_PROTO(
1691		const struct net *net,
1692		const char *mesg
1693	),
1694	TP_ARGS(net, mesg),
1695	TP_STRUCT__entry(
1696		__field(unsigned int, netns_ino)
1697		__string(mesg, mesg)
1698	),
1699	TP_fast_assign(
1700		__entry->netns_ino = net->ns.inum;
1701		__assign_str(mesg, mesg);
1702	),
1703	TP_printk("%s",
1704		__get_str(mesg)
1705	)
1706);
1707
1708TRACE_EVENT(nfsd_ctl_ports_addfd,
1709	TP_PROTO(
1710		const struct net *net,
1711		int fd
1712	),
1713	TP_ARGS(net, fd),
1714	TP_STRUCT__entry(
1715		__field(unsigned int, netns_ino)
1716		__field(int, fd)
1717	),
1718	TP_fast_assign(
1719		__entry->netns_ino = net->ns.inum;
1720		__entry->fd = fd;
1721	),
1722	TP_printk("fd=%d",
1723		__entry->fd
1724	)
1725);
1726
1727TRACE_EVENT(nfsd_ctl_ports_addxprt,
1728	TP_PROTO(
1729		const struct net *net,
1730		const char *transport,
1731		int port
1732	),
1733	TP_ARGS(net, transport, port),
1734	TP_STRUCT__entry(
1735		__field(unsigned int, netns_ino)
1736		__field(int, port)
1737		__string(transport, transport)
1738	),
1739	TP_fast_assign(
1740		__entry->netns_ino = net->ns.inum;
1741		__entry->port = port;
1742		__assign_str(transport, transport);
1743	),
1744	TP_printk("transport=%s port=%d",
1745		__get_str(transport), __entry->port
1746	)
1747);
1748
1749TRACE_EVENT(nfsd_ctl_maxblksize,
1750	TP_PROTO(
1751		const struct net *net,
1752		int bsize
1753	),
1754	TP_ARGS(net, bsize),
1755	TP_STRUCT__entry(
1756		__field(unsigned int, netns_ino)
1757		__field(int, bsize)
1758	),
1759	TP_fast_assign(
1760		__entry->netns_ino = net->ns.inum;
1761		__entry->bsize = bsize;
1762	),
1763	TP_printk("bsize=%d",
1764		__entry->bsize
1765	)
1766);
1767
1768TRACE_EVENT(nfsd_ctl_maxconn,
1769	TP_PROTO(
1770		const struct net *net,
1771		int maxconn
1772	),
1773	TP_ARGS(net, maxconn),
1774	TP_STRUCT__entry(
1775		__field(unsigned int, netns_ino)
1776		__field(int, maxconn)
1777	),
1778	TP_fast_assign(
1779		__entry->netns_ino = net->ns.inum;
1780		__entry->maxconn = maxconn;
1781	),
1782	TP_printk("maxconn=%d",
1783		__entry->maxconn
1784	)
1785);
1786
1787TRACE_EVENT(nfsd_ctl_time,
1788	TP_PROTO(
1789		const struct net *net,
1790		const char *name,
1791		size_t namelen,
1792		int time
1793	),
1794	TP_ARGS(net, name, namelen, time),
1795	TP_STRUCT__entry(
1796		__field(unsigned int, netns_ino)
1797		__field(int, time)
1798		__string_len(name, name, namelen)
1799	),
1800	TP_fast_assign(
1801		__entry->netns_ino = net->ns.inum;
1802		__entry->time = time;
1803		__assign_str_len(name, name, namelen);
1804	),
1805	TP_printk("file=%s time=%d\n",
1806		__get_str(name), __entry->time
1807	)
1808);
1809
1810TRACE_EVENT(nfsd_ctl_recoverydir,
1811	TP_PROTO(
1812		const struct net *net,
1813		const char *recdir
1814	),
1815	TP_ARGS(net, recdir),
1816	TP_STRUCT__entry(
1817		__field(unsigned int, netns_ino)
1818		__string(recdir, recdir)
1819	),
1820	TP_fast_assign(
1821		__entry->netns_ino = net->ns.inum;
1822		__assign_str(recdir, recdir);
1823	),
1824	TP_printk("recdir=%s",
1825		__get_str(recdir)
1826	)
1827);
1828
1829TRACE_EVENT(nfsd_end_grace,
1830	TP_PROTO(
1831		const struct net *net
1832	),
1833	TP_ARGS(net),
1834	TP_STRUCT__entry(
1835		__field(unsigned int, netns_ino)
1836	),
1837	TP_fast_assign(
1838		__entry->netns_ino = net->ns.inum;
1839	),
1840	TP_printk("nn=%d", __entry->netns_ino
1841	)
1842);
1843
1844DECLARE_EVENT_CLASS(nfsd_copy_class,
1845	TP_PROTO(
1846		const struct nfsd4_copy *copy
1847	),
1848	TP_ARGS(copy),
1849	TP_STRUCT__entry(
1850		__field(bool, intra)
1851		__field(bool, async)
1852		__field(u32, src_cl_boot)
1853		__field(u32, src_cl_id)
1854		__field(u32, src_so_id)
1855		__field(u32, src_si_generation)
1856		__field(u32, dst_cl_boot)
1857		__field(u32, dst_cl_id)
1858		__field(u32, dst_so_id)
1859		__field(u32, dst_si_generation)
 
 
 
 
1860		__field(u64, src_cp_pos)
1861		__field(u64, dst_cp_pos)
1862		__field(u64, cp_count)
1863		__sockaddr(addr, sizeof(struct sockaddr_in6))
1864	),
1865	TP_fast_assign(
1866		const stateid_t *src_stp = &copy->cp_src_stateid;
1867		const stateid_t *dst_stp = &copy->cp_dst_stateid;
 
1868
1869		__entry->intra = test_bit(NFSD4_COPY_F_INTRA, &copy->cp_flags);
1870		__entry->async = !test_bit(NFSD4_COPY_F_SYNCHRONOUS, &copy->cp_flags);
1871		__entry->src_cl_boot = src_stp->si_opaque.so_clid.cl_boot;
1872		__entry->src_cl_id = src_stp->si_opaque.so_clid.cl_id;
1873		__entry->src_so_id = src_stp->si_opaque.so_id;
1874		__entry->src_si_generation = src_stp->si_generation;
1875		__entry->dst_cl_boot = dst_stp->si_opaque.so_clid.cl_boot;
1876		__entry->dst_cl_id = dst_stp->si_opaque.so_clid.cl_id;
1877		__entry->dst_so_id = dst_stp->si_opaque.so_id;
1878		__entry->dst_si_generation = dst_stp->si_generation;
 
 
 
 
1879		__entry->src_cp_pos = copy->cp_src_pos;
1880		__entry->dst_cp_pos = copy->cp_dst_pos;
1881		__entry->cp_count = copy->cp_count;
1882		__assign_sockaddr(addr, &copy->cp_clp->cl_addr,
1883				sizeof(struct sockaddr_in6));
1884	),
1885	TP_printk("client=%pISpc intra=%d async=%d "
1886		"src_stateid[si_generation:0x%x cl_boot:0x%x cl_id:0x%x so_id:0x%x] "
1887		"dst_stateid[si_generation:0x%x cl_boot:0x%x cl_id:0x%x so_id:0x%x] "
 
1888		"cp_src_pos=%llu cp_dst_pos=%llu cp_count=%llu",
1889		__get_sockaddr(addr), __entry->intra, __entry->async,
1890		__entry->src_si_generation, __entry->src_cl_boot,
1891		__entry->src_cl_id, __entry->src_so_id,
1892		__entry->dst_si_generation, __entry->dst_cl_boot,
1893		__entry->dst_cl_id, __entry->dst_so_id,
 
 
1894		__entry->src_cp_pos, __entry->dst_cp_pos, __entry->cp_count
1895	)
1896);
1897
1898#define DEFINE_COPY_EVENT(name)				\
1899DEFINE_EVENT(nfsd_copy_class, nfsd_copy_##name,	\
1900	TP_PROTO(const struct nfsd4_copy *copy),	\
1901	TP_ARGS(copy))
1902
1903DEFINE_COPY_EVENT(inter);
1904DEFINE_COPY_EVENT(intra);
1905DEFINE_COPY_EVENT(do_async);
1906
1907TRACE_EVENT(nfsd_copy_done,
1908	TP_PROTO(
1909		const struct nfsd4_copy *copy,
1910		__be32 status
1911	),
1912	TP_ARGS(copy, status),
1913	TP_STRUCT__entry(
1914		__field(int, status)
1915		__field(bool, intra)
1916		__field(bool, async)
1917		__sockaddr(addr, sizeof(struct sockaddr_in6))
1918	),
1919	TP_fast_assign(
1920		__entry->status = be32_to_cpu(status);
1921		__entry->intra = test_bit(NFSD4_COPY_F_INTRA, &copy->cp_flags);
1922		__entry->async = !test_bit(NFSD4_COPY_F_SYNCHRONOUS, &copy->cp_flags);
1923		__assign_sockaddr(addr, &copy->cp_clp->cl_addr,
1924				sizeof(struct sockaddr_in6));
1925	),
1926	TP_printk("addr=%pISpc status=%d intra=%d async=%d ",
1927		__get_sockaddr(addr), __entry->status, __entry->intra, __entry->async
1928	)
1929);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1930
1931#endif /* _NFSD_TRACE_H */
1932
1933#undef TRACE_INCLUDE_PATH
1934#define TRACE_INCLUDE_PATH .
1935#define TRACE_INCLUDE_FILE trace
1936#include <trace/define_trace.h>