Debian Codegraph @

tapset/linux/nfsd.stp

raw
1 // nfs tapset
2 // Copyright (C) 2006-2007 IBM Corp.
3 // Copyright (C) 2007 Intel Corporation.
4 // Copyright (C) 2007 Bull S.A.S
5 // Copyright (C) 2010,2014-2019 Red Hat Inc.
6 //
7 // This file is part of systemtap, and is free software. You can
8 // redistribute it and/or modify it under the terms of the GNU General
9 // Public License (GPL); either version 2, or (at your option) any
10 // later version.
11
12
13 %{
14 #include <linux/stat.h>
15
16 #include <linux/sunrpc/svc.h>
17
18 #include <linux/nfs3.h>
19 #include <linux/nfs4.h>
20 %}
21
22 /*
23 *1 : nfsd.proc2.lookup
24 *2 : nfsd.proc3.lookup
25 *3 : nfsd.proc2.read
26 *4 : nfsd.proc3.read
27 *5 : nfsd.proc2.write
28 *6 : nfsd.proc3.write
29 *7 : nfsd.proc3.commit
30 *8 : nfsd.proc2.create
31 *9 : nfsd.proc3.create
32 *10: nfsd.proc2.remove
33 *11: nfsd.proc3.remove
34 *12 :nfsd.proc2.rename.ffh
35 *13 :nfsd.proc2.rename.tfh
36 *14 :nfsd.proc3.rename.ffh
37 *15 :nfsd.proc3.rename.tfh
38 */
39
40 # In newer kernels, the 'rq_argp' and 'rq_resp' pointers in a
41 # 'svc_rqst' structure are a void pointers that we need to cast to the
42 # right nfsd private types, based on the protocol version. These
43 # macros make all the casting easier.
44
45 @define nfsd2_createargs(ptr)
46 %(
47 @cast(@ptr, "nfsd_createargs", "kernel:nfsd")
48 %)
49 @define nfsd2_diropargs(ptr)
50 %(
51 @cast(@ptr, "nfsd_diropargs", "kernel:nfsd")
52 %)
53 @define nfsd2_readargs(ptr)
54 %(
55 @cast(@ptr, "nfsd_readargs", "kernel:nfsd")
56 %)
57 @define nfsd2_renameargs(ptr)
58 %(
59 @cast(@ptr, "nfsd_renameargs", "kernel:nfsd")
60 %)
61 @define nfsd2_writeargs(ptr)
62 %(
63 @cast(@ptr, "nfsd_writeargs", "kernel:nfsd")
64 %)
65
66 @define nfsd3_commitargs(ptr)
67 %(
68 @cast(@ptr, "nfsd3_commitargs", "kernel:nfsd")
69 %)
70 @define nfsd3_createargs(ptr)
71 %(
72 @cast(@ptr, "nfsd3_createargs", "kernel:nfsd")
73 %)
74 @define nfsd3_diropargs(ptr)
75 %(
76 @cast(@ptr, "nfsd3_diropargs", "kernel:nfsd")
77 %)
78 @define nfsd3_readargs(ptr)
79 %(
80 @cast(@ptr, "nfsd3_readargs", "kernel:nfsd")
81 %)
82 @define nfsd3_renameargs(ptr)
83 %(
84 @cast(@ptr, "nfsd3_renameargs", "kernel:nfsd")
85 %)
86 @define nfsd3_writeargs(ptr)
87 %(
88 @cast(@ptr, "nfsd3_writeargs", "kernel:nfsd")
89 %)
90 @define nfsd3_writeres(ptr)
91 %(
92 @cast(@ptr, "nfsd3_writeres", "kernel:nfsd")
93 %)
94
95 @define nfsd4_compound_state(ptr)
96 %(
97 @cast(@ptr, "nfsd4_compound_state", "kernel:nfsd")
98 %)
99
100
101 /* Get file handle data from struct svc_fh. */
102 @__private30 function __svc_fh:string(fhp:long)
103 {
104 svc_fh = &@cast(fhp, "svc_fh", "kernel:nfsd")->fh_handle
105 return sprintf("%d: %08x %08x %08x %08x %08x %08x", svc_fh->fh_size,
106 svc_fh->fh_base->fh_pad[0], svc_fh->fh_base->fh_pad[1],
107 svc_fh->fh_base->fh_pad[2], svc_fh->fh_base->fh_pad[3],
108 svc_fh->fh_base->fh_pad[4], svc_fh->fh_base->fh_pad[5])
109 }
110
111 function nfs3_cmode:string(cmode:long) %{ /* pure */
112 int cmode = (int)(long)STAP_ARG_cmode;
113
114 switch (cmode) {
115 case NFS3_CREATE_UNCHECKED:
116 snprintf(STAP_RETVALUE, MAXSTRINGLEN, "UNCHECKED");
117 break;
118 case NFS3_CREATE_GUARDED:
119 snprintf(STAP_RETVALUE, MAXSTRINGLEN, "GUARDED");
120 break;
121 case NFS3_CREATE_EXCLUSIVE:
122 snprintf(STAP_RETVALUE, MAXSTRINGLEN, "EXCLUSIVE");
123 break;
124 default:
125 snprintf(STAP_RETVALUE, MAXSTRINGLEN, "Bad Value(%d)",
126 cmode);
127 }
128 CATCH_DEREF_FAULT();
129 %}
130
131 function nfs4_ctype:string(cmode:long) %{ /* pure */
132 int cmode = (int)(long)STAP_ARG_cmode;
133
134 switch (cmode) {
135 case NF4BAD:
136 snprintf(STAP_RETVALUE, MAXSTRINGLEN, "NF4BAD");
137 break;
138 case NF4REG:
139 snprintf(STAP_RETVALUE, MAXSTRINGLEN, "NF4REG");
140 break;
141 case NF4DIR:
142 snprintf(STAP_RETVALUE, MAXSTRINGLEN, "NF4DIR");
143 break;
144 case NF4BLK:
145 snprintf(STAP_RETVALUE, MAXSTRINGLEN, "NF4BLK");
146 break;
147 case NF4CHR:
148 snprintf(STAP_RETVALUE, MAXSTRINGLEN, "NF4CHR");
149 break;
150 case NF4LNK:
151 snprintf(STAP_RETVALUE, MAXSTRINGLEN, "NF4LNK");
152 break;
153 case NF4SOCK:
154 snprintf(STAP_RETVALUE, MAXSTRINGLEN, "NF4SOCK");
155 break;
156 case NF4FIFO:
157 snprintf(STAP_RETVALUE, MAXSTRINGLEN, "NF4FIFO");
158 break;
159 case NF4ATTRDIR:
160 snprintf(STAP_RETVALUE, MAXSTRINGLEN, "NF4ATTRDIR");
161 break;
162 case NF4NAMEDATTR:
163 snprintf(STAP_RETVALUE, MAXSTRINGLEN, "NF4NAMEDATTR");
164 break;
165 default:
166 snprintf(STAP_RETVALUE, MAXSTRINGLEN,
167 "Bad Value(%d)", cmode);
168 }
169 CATCH_DEREF_FAULT();
170 %}
171
172 function ftype:string(type:long) %{ /* pure */
173 int type = (int)(long)STAP_ARG_type;
174
175 if (S_ISLNK(type)) {
176 snprintf(STAP_RETVALUE, MAXSTRINGLEN,
177 "0%o (ISLNK)", type);
178 } else if (S_ISREG(type)) {
179 snprintf(STAP_RETVALUE, MAXSTRINGLEN,
180 "0%o (ISREG)", type);
181 } else if (S_ISDIR(type)) {
182 snprintf(STAP_RETVALUE, MAXSTRINGLEN,
183 "0%o (ISDIR)", type);
184 } else if (S_ISCHR(type)) {
185 snprintf(STAP_RETVALUE, MAXSTRINGLEN,
186 "0%o (ISCHR)", type);
187 } else if (S_ISBLK(type)) {
188 snprintf(STAP_RETVALUE, MAXSTRINGLEN,
189 "0%o (ISBLK)", type);
190 } else if (S_ISFIFO(type)) {
191 snprintf(STAP_RETVALUE, MAXSTRINGLEN,
192 "0%o (ISFIFO)", type);
193 } else if (S_ISSOCK(type)) {
194 snprintf(STAP_RETVALUE, MAXSTRINGLEN,
195 "0%o (ISSOCK)", type);
196 } else {
197 snprintf(STAP_RETVALUE, MAXSTRINGLEN,
198 "0%o (Unknown)", type);
199 }
200 %}
201
202 @__private30 function __rqstp_uid:long(rqstp:long)
203 %{ /* pure */
204 // Notice we're using the 'init_user_ns' here, not
205 // 'current_user_ns()'. This matches up with the use in
206 // net/sunrpc/auth_generic.c.
207 struct svc_rqst *rqstp
208 = (struct svc_rqst *)(uintptr_t)STAP_ARG_rqstp;
209 #ifndef STAPCONF_LINUX_UIDGID_H
210 uid_t cr_uid = KUIDT_INIT(kread(&(rqstp->rq_cred.cr_uid)));
211 #else
212 kuid_t cr_uid;
213 /* Make sure the cr_uid struct is valid to read. */
214 (void)kderef_buffer(NULL, &(rqstp->rq_cred.cr_uid), sizeof(kuid_t));
215 cr_uid = KUIDT_INIT(__kuid_val(rqstp->rq_cred.cr_uid));
216 #endif
217 #if defined(CONFIG_USER_NS) || (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
218 STAP_RETVALUE = from_kuid_munged(&init_user_ns, cr_uid);
219 #else
220 STAP_RETVALUE = cr_uid;
221 #endif
222 CATCH_DEREF_FAULT();
223 %}
224
225 @__private30 function __rqstp_gid:long(rqstp:long)
226 %{ /* pure */
227 // Notice we're using the 'init_user_ns' here, not
228 // 'current_user_ns()'. This matches up with the use in
229 // net/sunrpc/auth_generic.c.
230 struct svc_rqst *rqstp
231 = (struct svc_rqst *)(uintptr_t)STAP_ARG_rqstp;
232 #ifndef STAPCONF_LINUX_UIDGID_H
233 gid_t cr_gid = KGIDT_INIT(kread(&(rqstp->rq_cred.cr_gid)));
234 #else
235 kgid_t cr_gid;
236 /* Make sure the cr_gid struct is valid to read. */
237 (void)kderef_buffer(NULL, &(rqstp->rq_cred.cr_gid), sizeof(kgid_t));
238 cr_gid = KGIDT_INIT(__kgid_val(rqstp->rq_cred.cr_gid));
239 #endif
240 #if defined(CONFIG_USER_NS) || (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
241 STAP_RETVALUE = from_kgid_munged(&init_user_ns, cr_gid);
242 #else
243 STAP_RETVALUE = cr_gid;
244 #endif
245 CATCH_DEREF_FAULT();
246 %}
247
248 /**
249 * probe nfsd.dispatch - NFS server receives an operation from client
250 *
251 * @client_ip: the ip address of client
252 * @proto: transfer protocol
253 * @version: nfs version
254 * @xid: transmission id
255 * @prog: program number
256 * @proc: procedure number
257 */
258 probe nfsd.dispatch = kernel.function("nfsd_dispatch") !,
259 module("nfsd").function("nfsd_dispatch") ?
260 {
261 client_ip = addr_from_rqst_str($rqstp)
262 proto = $rqstp->rq_prot
263 version = $rqstp->rq_vers
264
265 xid = $rqstp->rq_xid
266 prog = $rqstp->rq_prog
267 proc = $rqstp->rq_proc
268
269 name = "nfsd.dispatch"
270 argstr = sprintf("%d,%d",version,proto)
271 }
272
273 probe nfsd.dispatch.return = kernel.function("nfsd_dispatch").return !,
274 module("nfsd").function("nfsd_dispatch").return ?
275 {
276 name = "nfsd.dispatch.return"
277 retstr = sprintf("%d",$return)
278 }
279
280 probe nfsd.proc.entries = nfsd.proc.lookup,
281 nfsd.proc.read,
282 nfsd.proc.write,
283 nfsd.proc.commit,
284 nfsd.proc.remove,
285 nfsd.proc.rename,
286 nfsd.proc.create
287 {}
288
289 probe nfsd.proc.return = nfsd.proc.lookup.return,
290 nfsd.proc.read.return,
291 nfsd.proc.write.return,
292 nfsd.proc.commit.return,
293 nfsd.proc.remove.return,
294 nfsd.proc.rename.return,
295 nfsd.proc.create.return
296 {}
297
298 /**
299 * probe nfsd.proc.lookup - NFS server opening or searching for a file for client
300 *
301 * @client_ip: the ip address of client
302 * @proto: transfer protocol
303 * @version: nfs version
304 * @fh: file handle of parent dir (the first part is the length of the file handle)
305 * @filename: file name
306 * @filelen: the length of file name
307 * @uid: requester's user id
308 * @gid: requester's group id
309 */
310 probe nfsd.proc.lookup =
311 nfsd.proc4.lookup ?,
312 nfsd.proc3.lookup,
313 nfsd.proc2.lookup ?
314 {}
315
316 probe nfsd.proc.lookup.return =
317 nfsd.proc4.lookup.return ?,
318 nfsd.proc3.lookup.return,
319 nfsd.proc2.lookup.return ?
320 {}
321
322 probe nfsd.proc2.lookup = kernel.function("nfsd_proc_lookup") !,
323 module("nfsd").function("nfsd_proc_lookup") ?
324 {
325 client_ip = addr_from_rqst_str($rqstp)
326 proto = $rqstp->rq_prot
327 version = 2
328
329 if (@defined($rqstp->rq_argp)) {
330 fh = & @nfsd2_diropargs($rqstp->rq_argp)->fh
331 filelen = @nfsd2_diropargs($rqstp->rq_argp)->len
332 filename = kernel_string_n(@nfsd2_diropargs($rqstp->rq_argp)->name,
333 @nfsd2_diropargs($rqstp->rq_argp)->len)
334 }
335 else {
336 fh = & @nfsd2_diropargs($argp)->fh
337 filelen = $argp->len
338 filename = kernel_string_n($argp->name, $argp->len)
339 }
340
341 uid = __rqstp_uid($rqstp)
342 gid = __rqstp_gid($rqstp)
343
344 name = "nfsd.proc2.lookup"
345 argstr = sprintf("%s", filename)
346 }
347
348 probe nfsd.proc2.lookup.return =
349 kernel.function("nfsd_proc_lookup").return !,
350 module("nfsd").function("nfsd_proc_lookup").return ?
351 {
352 client_ip = addr_from_rqst_str(@entry($rqstp))
353
354 name = "nfsd.proc2.lookup.return"
355 version = 2
356 retstr = sprintf("%s", nfsderror($return))
357 }
358
359 probe nfsd.proc3.lookup = kernel.function("nfsd3_proc_lookup") !,
360 module("nfsd").function("nfsd3_proc_lookup") ?
361 {
362 client_ip = addr_from_rqst_str($rqstp)
363 proto = $rqstp->rq_prot
364 version = 3
365
366 if (@defined($rqstp->rq_argp)) {
367 fh = & @nfsd3_diropargs($rqstp->rq_argp)->fh
368 filelen = @nfsd3_diropargs($rqstp->rq_argp)->len
369 filename = kernel_string_n(@nfsd3_diropargs($rqstp->rq_argp)->name,
370 @nfsd3_diropargs($rqstp->rq_argp)->len)
371 }
372 else {
373 fh = & @nfsd3_diropargs($argp)->fh
374 filelen = $argp->len
375 filename = kernel_string_n($argp->name, $argp->len)
376 }
377
378 uid = __rqstp_uid($rqstp)
379 gid = __rqstp_gid($rqstp)
380
381 name = "nfsd.proc3.lookup"
382 argstr = sprintf("%s", filename)
383 }
384
385 probe nfsd.proc3.lookup.return =
386 kernel.function("nfsd3_proc_lookup").return !,
387 module("nfsd").function("nfsd3_proc_lookup").return ?
388 {
389 client_ip = addr_from_rqst_str(@entry($rqstp))
390
391 name = "nfsd.proc3.lookup.return"
392 version = 3
393 retstr = sprintf("%s", nfsderror($return))
394 }
395
396 /*
397 * Several of the nfsd.proc4.* entry probes use '.call'. Why? On
398 * kernels <= 2.6.18 (i.e. RHEL4 and RHEL5), those are inline
399 * functions. Besides having different arguments, because those
400 * functions are inline systemtap has trouble finding their arguments
401 * (PR 1155). Finally, those functions are just simple wrappers
402 * around their nfsd_* counterparts (for example, nfsd4_lookup() is a
403 * wrapper for nfsd_lookup). As a comment in fs/nfsd/nfs4proc.c says:
404 *
405 * Note: some routines in this file are just trivial wrappers
406 * (e.g. nfsd4_lookup()) defined solely for the sake of consistent
407 * naming.
408 *
409 * So, we'll just ignore those inline wrappers by specifying
410 * '.call'. which means the function must be a "real" (non-inline)
411 * function.
412 */
413
414 probe nfsd.proc4.lookup = kernel.function("nfsd4_lookup").call !,
415 module("nfsd").function("nfsd4_lookup").call ?
416 {
417 client_ip = addr_from_rqst_str($rqstp)
418 proto = $rqstp->rq_prot
419 version = 4
420 fh = & @nfsd4_compound_state($cstate)->current_fh
421
422 if (@defined($u)) {
423 filelen = $u->lookup->lo_len
424 filename = kernel_string_n($u->lookup->lo_name,
425 $u->lookup->lo_len)
426 }
427 else {
428 filelen = $lookup->lo_len
429 filename = kernel_string_n($lookup->lo_name, $lookup->lo_len)
430 }
431
432 uid = __rqstp_uid($rqstp)
433 gid = __rqstp_gid($rqstp)
434
435 name = "nfsd.proc4.lookup"
436 argstr = sprintf("%s", filename)
437 }
438
439 probe nfsd.proc4.lookup.return =
440 kernel.function("nfsd4_lookup").return !,
441 module("nfsd").function("nfsd4_lookup").return ?
442 {
443 client_ip = addr_from_rqst_str(@entry($rqstp))
444
445 name = "nfsd.proc4.lookup.return"
446 version = 4
447 retstr = sprintf("%s", nfsderror($return))
448 }
449
450 /**
451 * probe nfsd.proc.read - NFS server reading file for client
452 *
453 * @client_ip: the ip address of client
454 * @proto: transfer protocol
455 * @version: nfs version
456 * @fh: file handle (the first part is the length of the file handle)
457 * @size: read bytes
458 * @count: read bytes
459 * @offset: the offset of file
460 * @vec: struct kvec, includes buf address in kernel address and length of each buffer
461 * @vlen: read blocks
462 * @uid: requester's user id
463 * @gid: requester's group id
464 */
465 probe nfsd.proc.read =
466 nfsd.proc4.read ?,
467 nfsd.proc3.read,
468 nfsd.proc2.read ?
469 {}
470
471 probe nfsd.proc.read.return =
472 nfsd.proc4.read.return ?,
473 nfsd.proc3.read.return,
474 nfsd.proc2.read.return ?
475 {}
476
477 probe nfsd.proc2.read = kernel.function("nfsd_proc_read") !,
478 module("nfsd").function("nfsd_proc_read") ?
479 {
480 client_ip = addr_from_rqst_str($rqstp)
481 proto = $rqstp->rq_prot
482 version = 2
483 if (@defined($rqstp->rq_argp)) {
484 fh = & @nfsd2_readargs($rqstp->rq_argp)->fh
485 count = @nfsd2_readargs($rqstp->rq_argp)->count
486 offset = @nfsd2_readargs($rqstp->rq_argp)->offset
487 vec = $rqstp->rq_vec
488 vlen = @nfsd2_readargs($rqstp->rq_argp)->vlen
489 }
490 else {
491 fh = & @nfsd2_readargs($argp)->fh
492 count = $argp->count
493 offset = $argp->offset
494 vec = @choose_defined($rqstp->rq_vec, $argp->vec)
495 vlen = $argp->vlen
496 }
497
498 uid = __rqstp_uid($rqstp)
499 gid = __rqstp_gid($rqstp)
500
501 name = "nfsd.proc2.read"
502 argstr = sprintf("%d,%d",count,offset)
503
504 size = count
505 units = "bytes"
506 }
507
508 probe nfsd.proc2.read.return =
509 kernel.function("nfsd_proc_read").return !,
510 module("nfsd").function("nfsd_proc_read").return ?
511 {
512 client_ip = addr_from_rqst_str(@entry($rqstp))
513
514 name = "nfsd.proc2.read.return"
515 version = 2
516 retstr = sprintf("%s", nfsderror($return))
517 }
518
519 probe nfsd.proc3.read = kernel.function("nfsd3_proc_read") !,
520 module("nfsd").function("nfsd3_proc_read") ?
521 {
522 client_ip = addr_from_rqst_str($rqstp)
523 proto = $rqstp->rq_prot
524 version = 3
525 if (@defined($rqstp->rq_argp)) {
526 fh = & @nfsd3_readargs($rqstp->rq_argp)->fh
527 count = @nfsd3_readargs($rqstp->rq_argp)->count
528 offset = @nfsd3_readargs($rqstp->rq_argp)->offset
529 vec = $rqstp->rq_vec
530 vlen = @nfsd3_readargs($rqstp->rq_argp)->vlen
531 }
532 else {
533 fh = & @nfsd3_readargs($argp)->fh
534 count = $argp->count
535 offset = $argp->offset
536 vec = @choose_defined($rqstp->rq_vec, $argp->vec)
537 vlen = $argp->vlen
538 }
539
540 uid = __rqstp_uid($rqstp)
541 gid = __rqstp_gid($rqstp)
542
543 name = "nfsd.proc3.read"
544 argstr = sprintf("%d,%d",count,offset)
545
546 size = count
547 units = "bytes"
548 }
549
550 probe nfsd.proc3.read.return =
551 kernel.function("nfsd3_proc_read").return !,
552 module("nfsd").function("nfsd3_proc_read").return ?
553 {
554 client_ip = addr_from_rqst_str(@entry($rqstp))
555
556 name = "nfsd.proc3.read.return"
557 version = 3
558 retstr = sprintf("%s", nfsderror($return))
559 }
560
561 probe nfsd.proc4.read = kernel.function("nfsd4_read").call !,
562 module("nfsd").function("nfsd4_read").call ?
563 {
564 client_ip = addr_from_rqst_str($rqstp)
565 proto = $rqstp->rq_prot
566 version = 4
567 fh = & @nfsd4_compound_state($cstate)->current_fh
568
569 if (@defined($u)) {
570 count = $u->read->rd_length
571 offset = $u->read->rd_offset
572 vec = $rqstp->rq_vec
573 vlen = $u->read->rd_vlen
574 } else {
575 count = $read->rd_length
576 offset = $read->rd_offset
577 vec = $rqstp->rq_vec
578 vlen = $read->rd_vlen
579 }
580
581 uid = __rqstp_uid($rqstp)
582 gid = __rqstp_gid($rqstp)
583
584 name = "nfsd.proc4.read"
585 argstr = sprintf("%d,%d",count,offset)
586
587 size = count
588 units = "bytes"
589 }
590
591 probe nfsd.proc4.read.return = kernel.function("nfsd4_read").return !,
592 module("nfsd").function("nfsd4_read").return ?
593 {
594 client_ip = addr_from_rqst_str(@entry($rqstp))
595
596 name = "nfsd.proc4.read.return"
597 version = 4
598 retstr = sprintf("%s", nfsderror($return))
599 }
600
601 /**
602 * probe nfsd.proc.write - NFS server writing data to file for client
603 *
604 * @client_ip: the ip address of client
605 * @proto: transfer protocol
606 * @version: nfs version
607 * @fh: file handle (the first part is the length of the file handle)
608 * @size: read bytes
609 * @count: read bytes
610 * @offset: the offset of file
611 * @vec: struct kvec, includes buf address in kernel address and length of each buffer
612 * @vlen: read blocks
613 * @stable: argp->stable
614 * @uid: requester's user id
615 * @gid: requester's group id
616 */
617 probe nfsd.proc.write =
618 nfsd.proc4.write ?,
619 nfsd.proc3.write,
620 nfsd.proc2.write ?
621 {}
622
623 probe nfsd.proc.write.return =
624 nfsd.proc4.write.return ?,
625 nfsd.proc3.write.return,
626 nfsd.proc2.write.return ?
627 {}
628
629 probe nfsd.proc2.write = kernel.function("nfsd_proc_write") !,
630 module("nfsd").function("nfsd_proc_write") ?
631 {
632 client_ip = addr_from_rqst_str($rqstp)
633 proto = $rqstp->rq_prot
634 version = 2
635 if (@defined($rqstp->rq_argp)) {
636 fh = & @nfsd2_writeargs($rqstp->rq_argp)->fh
637 count = @nfsd2_writeargs($rqstp->rq_argp)->len
638 offset = @nfsd2_writeargs($rqstp->rq_argp)->offset
639 vec = $rqstp->rq_vec
640 vlen = @choose_defined(@nfsd2_writeargs($rqstp->rq_argp)->vlen, 0)
641 }
642 else {
643 fh = & @nfsd2_writeargs($argp)->fh
644 count = $argp->len
645 offset = $argp->offset
646 vec = @choose_defined($rqstp->rq_vec, $argp->vec)
647 vlen = @choose_defined($argp->vlen, 0)
648 }
649
650 stable = 1 # hardcoded in nfsd_proc_write()
651
652 uid = __rqstp_uid($rqstp)
653 gid = __rqstp_gid($rqstp)
654
655 name = "nfsd.proc2.write"
656 argstr = sprintf("%d,%d",count,offset)
657
658 size = count
659 units = "bytes"
660 }
661
662 probe nfsd.proc2.write.return =
663 kernel.function("nfsd_proc_write").return !,
664 module("nfsd").function("nfsd_proc_write").return ?
665 {
666 client_ip = addr_from_rqst_str(@entry($rqstp))
667
668 name = "nfsd.proc2.write.return"
669 version = 2
670 retstr = sprintf("%s", nfsderror($return))
671 if (@defined(@entry($rqstp->rq_argp))) {
672 count = ($return == 0
673 ? @entry(@nfsd2_writeargs($rqstp->rq_argp)->len)
674 : $return)
675 }
676 else {
677 count = ($return == 0 ? @entry($argp->len) : $return)
678 }
679 stable = 1
680 }
681
682 probe nfsd.proc3.write = kernel.function("nfsd3_proc_write") !,
683 module("nfsd").function("nfsd3_proc_write") ?
684 {
685 client_ip = addr_from_rqst_str($rqstp)
686 proto = $rqstp->rq_prot
687 version = 3
688 if (@defined($rqstp->rq_argp)) {
689 fh = & @nfsd3_writeargs($rqstp->rq_argp)->fh
690 count = @nfsd3_writeargs($rqstp->rq_argp)->count
691 offset = @nfsd3_writeargs($rqstp->rq_argp)->offset
692 vec = $rqstp->rq_vec
693 vlen = @choose_defined(@nfsd3_writeargs($rqstp->rq_argp)->vlen, 0)
694 stable = @nfsd3_writeargs($rqstp->rq_argp)->stable
695 }
696 else {
697 fh = & @nfsd3_writeargs($argp)->fh
698 count = $argp->count
699 offset = $argp->offset
700 vec = @choose_defined($rqstp->rq_vec, $argp->vec)
701 vlen = @choose_defined($argp->vlen, 0)
702 stable = $argp->stable
703 }
704
705 uid = __rqstp_uid($rqstp)
706 gid = __rqstp_gid($rqstp)
707
708 name = "nfsd.proc3.write"
709 argstr = sprintf("%d,%d",count,offset)
710
711 size = count
712 units = "bytes"
713 }
714
715 probe nfsd.proc3.write.return =
716 kernel.function("nfsd3_proc_write").return !,
717 module("nfsd").function("nfsd3_proc_write").return ?
718 {
719 client_ip = addr_from_rqst_str(@entry($rqstp))
720
721 name = "nfsd.proc3.write.return"
722 version = 3
723 retstr = sprintf("%s", nfsderror($return))
724 if (@defined(@entry($rqstp->rq_resp))) {
725 count = @entry(@nfsd3_writeres($rqstp->rq_resp)->count)
726 stable = @entry(@nfsd3_writeres($rqstp->rq_resp)->committed)
727 }
728 else {
729 count = @entry($resp->count)
730 stable = @entry($resp->committed)
731 }
732 }
733
734 probe nfsd.proc4.write = kernel.function("nfsd4_write").call !,
735 module("nfsd").function("nfsd4_write").call ?
736 {
737 client_ip = addr_from_rqst_str($rqstp)
738 proto = $rqstp->rq_prot
739 version = 4
740 fh = & @nfsd4_compound_state($cstate)->current_fh
741 vec = $rqstp->rq_vec
742 if (@defined($u)) {
743 count = $u->write->wr_buflen
744 offset = $u->write->wr_offset
745 vlen = @choose_defined($u->write->wr_vlen, 0)
746 stable = $u->write->wr_stable_how
747 }
748 else {
749 count = $write->wr_buflen
750 offset = $write->wr_offset
751 vlen = @choose_defined($write->wr_vlen, 0)
752 stable = $write->wr_stable_how
753 }
754
755 uid = __rqstp_uid($rqstp)
756 gid = __rqstp_gid($rqstp)
757
758 name = "nfsd.proc4.write"
759 argstr = sprintf("%d,%d",count,offset)
760
761 size = count
762 units = "bytes"
763 }
764
765 probe nfsd.proc4.write.return =
766 kernel.function("nfsd4_write").return !,
767 module("nfsd").function("nfsd4_write").return ?
768 {
769 client_ip = addr_from_rqst_str(@entry($rqstp))
770
771 name = "nfsd.proc4.write.return"
772 version = 4
773 if (@defined(@entry($u))) {
774 count = @entry($u->write->wr_bytes_written)
775 stable = @entry($u->write->wr_how_written)
776 }
777 else {
778 count = @entry($write->wr_bytes_written)
779 stable = @entry($write->wr_how_written)
780 }
781
782 retstr = sprintf("%s", nfsderror($return))
783 }
784
785 /**
786 * probe nfsd.proc.commit - NFS server performing a commit operation for client
787 *
788 * @client_ip: the ip address of client
789 * @proto: transfer protocol
790 * @version: nfs version
791 * @fh: file handle (the first part is the length of the file handle)
792 * @size: read bytes
793 * @count: read bytes
794 * @offset: the offset of file
795 * @uid: requester's user id
796 * @gid: requester's group id
797 */
798 probe nfsd.proc.commit =
799 nfsd.proc4.commit ?,
800 nfsd.proc3.commit
801 {}
802
803 probe nfsd.proc.commit.return =
804 nfsd.proc4.commit.return ?,
805 nfsd.proc3.commit.return
806 {}
807
808 probe nfsd.proc3.commit = kernel.function("nfsd3_proc_commit") !,
809 module("nfsd").function("nfsd3_proc_commit") ?
810 {
811 client_ip = addr_from_rqst_str($rqstp)
812 proto = $rqstp->rq_prot
813 version = 3
814
815 if (@defined($rqstp->rq_argp)) {
816 fh = & @nfsd3_commitargs($rqstp->rq_argp)->fh
817 count = @nfsd3_commitargs($rqstp->rq_argp)->count
818 offset = @nfsd3_commitargs($rqstp->rq_argp)->offset
819 }
820 else {
821 fh = & @nfsd3_commitargs($argp)->fh
822 count = $argp->count
823 offset = $argp->offset
824 }
825
826 uid = __rqstp_uid($rqstp)
827 gid = __rqstp_gid($rqstp)
828
829 name = "nfsd.proc3.commit"
830 argstr = sprintf("%d,%d",count,offset)
831
832 size = count
833 units = "bytes"
834 }
835
836 probe nfsd.proc3.commit.return =
837 kernel.function("nfsd3_proc_commit").return !,
838 module("nfsd").function("nfsd3_proc_commit").return ?
839 {
840 client_ip = addr_from_rqst_str(@entry($rqstp))
841
842 name = "nfsd.proc3.commit.return"
843 version = 3
844 retstr = sprintf("%s", nfsderror($return))
845 }
846
847 probe nfsd.proc4.commit = kernel.function("nfsd4_commit").call !,
848 module("nfsd").function("nfsd4_commit").call ?
849 {
850 client_ip = addr_from_rqst_str($rqstp)
851 proto = $rqstp->rq_prot
852 version = 4
853 fh = & @nfsd4_compound_state($cstate)->current_fh
854 if (@defined($u)) {
855 count = $u->commit->co_count
856 offset = $u->commit->co_offset
857 } else {
858 count = $commit->co_count
859 offset = $commit->co_offset
860 }
861
862 uid = __rqstp_uid($rqstp)
863 gid = __rqstp_gid($rqstp)
864
865 name = "nfsd.proc4.commit"
866 argstr = sprintf("%d,%d",count,offset)
867
868 size = count
869 units = "bytes"
870 }
871
872 probe nfsd.proc4.commit.return =
873 kernel.function("nfsd4_commit").return !,
874 module("nfsd").function("nfsd4_commit").return ?
875 {
876 client_ip = addr_from_rqst_str(@entry($rqstp))
877
878 name = "nfsd.proc4.commit.return"
879 version = 4
880 retstr = sprintf("%s", nfsderror($return))
881 }
882
883 /**
884 * probe nfsd.proc.create - NFS server creating a file for client
885 *
886 * @client_ip: the ip address of client
887 * @proto: transfer protocol
888 * @version: nfs version
889 * @fh: file handle (the first part is the length of the file handle)
890 * @filename: file name
891 * @filelen: length of file name
892 * @uid: requester's user id
893 * @gid: requester's group id
894 */
895 probe nfsd.proc.create =
896 nfsd.proc4.create ?,
897 nfsd.proc3.create,
898 nfsd.proc2.create ?
899 {}
900 probe nfsd.proc.create.return =
901 nfsd.proc4.create.return ?,
902 nfsd.proc3.create.return,
903 nfsd.proc2.create.return ?
904 {}
905
906 probe nfsd.proc2.create = kernel.function("nfsd_proc_create") !,
907 module("nfsd").function("nfsd_proc_create") ?
908 {
909 client_ip = addr_from_rqst_str($rqstp)
910 proto = $rqstp->rq_prot
911 version = 2
912
913 if (@defined($rqstp->rq_argp)) {
914 fh = & @nfsd2_createargs($rqstp->rq_argp)->fh
915 filelen = @nfsd2_createargs($rqstp->rq_argp)->len
916 filename = kernel_string_n(@nfsd2_createargs($rqstp->rq_argp)->name,
917 @nfsd2_createargs($rqstp->rq_argp)->len)
918 }
919 else {
920 fh = & @nfsd2_createargs($argp)->fh
921 filelen = $argp->len
922 filename = kernel_string_n($argp->name, $argp->len)
923 }
924
925 createmode = 0 # gets computed by nfsd_proc_create
926
927 uid = __rqstp_uid($rqstp)
928 gid = __rqstp_gid($rqstp)
929
930 name = "nfsd.proc2.create"
931 argstr = sprintf("%s", filename)
932 }
933
934 probe nfsd.proc2.create.return =
935 kernel.function("nfsd_proc_create").return !,
936 module("nfsd").function("nfsd_proc_create").return ?
937 {
938 client_ip = addr_from_rqst_str(@entry($rqstp))
939
940 name = "nfsd.proc2.create.return"
941 version = 2
942 retstr = sprintf("%s", nfsderror($return))
943 }
944
945 probe nfsd.proc3.create = kernel.function("nfsd3_proc_create") !,
946 module("nfsd").function("nfsd3_proc_create") ?
947 {
948 client_ip = addr_from_rqst_str($rqstp)
949 proto = $rqstp->rq_prot
950 version = 3
951
952 if (@defined($rqstp->rq_argp)) {
953 fh = & @nfsd3_createargs($rqstp->rq_argp)->fh
954 filelen = @nfsd3_createargs($rqstp->rq_argp)->len
955 filename = kernel_string_n(@nfsd3_createargs($rqstp->rq_argp)->name,
956 @nfsd3_createargs($rqstp->rq_argp)->len)
957 createmode = @nfsd3_createargs($rqstp->rq_argp)->createmode
958 }
959 else {
960 fh = & @nfsd3_createargs($argp)->fh
961 filelen = $argp->len
962 filename = kernel_string_n($argp->name, $argp->len)
963 createmode = $argp->createmode
964 }
965
966 uid = __rqstp_uid($rqstp)
967 gid = __rqstp_gid($rqstp)
968
969 name = "nfsd.proc3.create"
970 argstr = sprintf("%s (mode=%s)", filename, nfs3_cmode(createmode))
971 }
972
973 probe nfsd.proc3.create.return =
974 kernel.function("nfsd3_proc_create").return !,
975 module("nfsd").function("nfsd3_proc_create").return ?
976 {
977 client_ip = addr_from_rqst_str(@entry($rqstp))
978
979 name = "nfsd.proc3.create.return"
980 version = 3
981 retstr = sprintf("%s", nfsderror($return))
982 }
983
984 probe nfsd.proc4.create = kernel.function("nfsd4_create").call !,
985 module("nfsd").function("nfsd4_create").call ?
986 {
987 client_ip = addr_from_rqst_str($rqstp)
988 proto = $rqstp->rq_prot
989 version = 4
990 fh = (@defined($cstate)
991 ? & @nfsd4_compound_state($cstate)->current_fh
992 : $current_fh)
993 if (@defined($u)) {
994 filelen = $u->create->cr_namelen
995 filename = kernel_string_n($u->create->cr_name,
996 $u->create->cr_namelen)
997 createmode = $u->create->cr_type
998 }
999 else {
1000 filelen = $create->cr_namelen
1001 filename = kernel_string_n($create->cr_name, $create->cr_namelen)
1002 createmode = $create->cr_type
1003 }
1004
1005 uid = __rqstp_uid($rqstp)
1006 gid = __rqstp_gid($rqstp)
1007
1008 name = "nfsd.proc4.create"
1009 argstr = sprintf("%s (type=%s)", filename, nfs4_ctype(createmode))
1010
1011 }
1012
1013 probe nfsd.proc4.create.return =
1014 kernel.function("nfsd4_create").return !,
1015 module("nfsd").function("nfsd4_create").return ?
1016 {
1017 client_ip = addr_from_rqst_str(@entry($rqstp))
1018
1019 name = "nfsd.proc4.create.return"
1020 version = 4
1021 retstr = sprintf("%s", nfsderror($return))
1022 }
1023
1024 /**
1025 * probe nfsd.proc.remove - NFS server removing a file for client
1026 *
1027 * @client_ip: the ip address of client
1028 * @proto: transfer protocol
1029 * @version: nfs version
1030 * @fh: file handle (the first part is the length of the file handle)
1031 * @filename: file name
1032 * @filelen: length of file name
1033 * @uid: requester's user id
1034 * @gid: requester's group id
1035 */
1036 probe nfsd.proc.remove =
1037 nfsd.proc4.remove ?,
1038 nfsd.proc3.remove,
1039 nfsd.proc2.remove ?
1040 {}
1041 probe nfsd.proc.remove.return =
1042 nfsd.proc4.remove.return ?,
1043 nfsd.proc3.remove.return,
1044 nfsd.proc2.remove.return ?
1045 {}
1046
1047 probe nfsd.proc2.remove = kernel.function("nfsd_proc_remove") !,
1048 module("nfsd").function("nfsd_proc_remove") ?
1049 {
1050 client_ip = addr_from_rqst_str($rqstp)
1051 proto = $rqstp->rq_prot
1052 version = 2
1053 if (@defined($rqstp->rq_argp)) {
1054 fh = & @nfsd2_diropargs($rqstp->rq_argp)->fh
1055 filelen = @nfsd2_diropargs($rqstp->rq_argp)->len
1056 filename = kernel_string_n(@nfsd2_diropargs($rqstp->rq_argp)->name,
1057 @nfsd2_diropargs($rqstp->rq_argp)->len)
1058 }
1059 else {
1060 fh = & @nfsd2_diropargs($argp)->fh
1061 filelen = $argp->len
1062 filename = kernel_string_n($argp->name, $argp->len)
1063 }
1064 uid = __rqstp_uid($rqstp)
1065 gid = __rqstp_gid($rqstp)
1066
1067 name = "nfsd.proc2.remove"
1068 argstr = sprintf("%s", filename)
1069 }
1070
1071 probe nfsd.proc2.remove.return =
1072 kernel.function("nfsd_proc_remove").return !,
1073 module("nfsd").function("nfsd_proc_remove").return ?
1074 {
1075 client_ip = addr_from_rqst_str(@entry($rqstp))
1076
1077 name = "nfsd.proc2.remove.return"
1078 version = 2
1079 retstr = sprintf("%s", nfsderror($return))
1080 }
1081
1082 probe nfsd.proc3.remove = kernel.function("nfsd3_proc_remove") !,
1083 module("nfsd").function("nfsd3_proc_remove") ?
1084 {
1085 client_ip = addr_from_rqst_str($rqstp)
1086 proto = $rqstp->rq_prot
1087 version = 3
1088 if (@defined($rqstp->rq_argp)) {
1089 fh = & @nfsd3_diropargs($rqstp->rq_argp)->fh
1090 filelen = @nfsd3_diropargs($rqstp->rq_argp)->len
1091 filename = kernel_string_n(@nfsd3_diropargs($rqstp->rq_argp)->name,
1092 @nfsd3_diropargs($rqstp->rq_argp)->len)
1093 }
1094 else {
1095 fh = & @nfsd3_diropargs($argp)->fh
1096 filelen = $argp->len
1097 filename = kernel_string_n($argp->name, $argp->len)
1098 }
1099
1100 uid = __rqstp_uid($rqstp)
1101 gid = __rqstp_gid($rqstp)
1102
1103 name = "nfsd.proc3.remove"
1104 argstr = sprintf("%s", filename)
1105 }
1106
1107 probe nfsd.proc3.remove.return =
1108 kernel.function("nfsd3_proc_remove").return !,
1109 module("nfsd").function("nfsd3_proc_remove").return ?
1110 {
1111 client_ip = addr_from_rqst_str(@entry($rqstp))
1112
1113 name = "nfsd.proc3.remove.return"
1114 version = 3
1115 retstr = sprintf("%s", nfsderror($return))
1116 }
1117
1118 probe nfsd.proc4.remove = kernel.function("nfsd4_remove").call !,
1119 module("nfsd").function("nfsd4_remove").call ?
1120 {
1121 client_ip = addr_from_rqst_str($rqstp)
1122 proto = $rqstp->rq_prot
1123 version = 4
1124 fh = & @nfsd4_compound_state($cstate)->current_fh
1125 if (@defined($u)) {
1126 filelen = $u->remove->rm_namelen
1127 filename = kernel_string_n($u->remove->rm_name,
1128 $u->remove->rm_namelen)
1129 }
1130 else {
1131 filelen = $remove->rm_namelen
1132 filename = kernel_string_n($remove->rm_name,
1133 $remove->rm_namelen)
1134 }
1135
1136 uid = __rqstp_uid($rqstp)
1137 gid = __rqstp_gid($rqstp)
1138
1139 name = "nfsd.proc4.remove"
1140 argstr = sprintf("%s", filename)
1141 }
1142
1143 probe nfsd.proc4.remove.return =
1144 kernel.function("nfsd4_remove").return !,
1145 module("nfsd").function("nfsd4_remove").return ?
1146 {
1147 client_ip = addr_from_rqst_str(@entry($rqstp))
1148
1149 name = "nfsd.proc4.remove.return"
1150 version = 4
1151 retstr = sprintf("%s", nfsderror($return))
1152 }
1153
1154 /**
1155 * probe nfsd.proc.rename - NFS Server renaming a file for client
1156 *
1157 * @client_ip: the ip address of client
1158 * @fh: file handler of old path
1159 * @tfh: file handler of new path
1160 * @filename: old file name
1161 * @tname: new file name
1162 * @flen: length of old file name
1163 * @tlen: length of new file name
1164 * @uid: requester's user id
1165 * @gid: requester's group id
1166 */
1167 probe nfsd.proc.rename =
1168 nfsd.proc4.rename ?,
1169 nfsd.proc3.rename,
1170 nfsd.proc2.rename ?
1171 {}
1172
1173 probe nfsd.proc.rename.return =
1174 nfsd.proc4.rename.return ?,
1175 nfsd.proc3.rename.return,
1176 nfsd.proc2.rename.return ?
1177 {}
1178
1179 probe nfsd.proc2.rename = kernel.function("nfsd_proc_rename") !,
1180 module("nfsd").function("nfsd_proc_rename") ?
1181 {
1182 client_ip = addr_from_rqst_str($rqstp)
1183 proto = $rqstp->rq_prot
1184 version = 2
1185
1186 if (@defined($rqstp->rq_argp)) {
1187 fh = & @nfsd2_renameargs($rqstp->rq_argp)->ffh
1188 tfh = & @nfsd2_renameargs($rqstp->rq_argp)->tfh
1189 filelen = @nfsd2_renameargs($rqstp->rq_argp)->flen
1190 filename = kernel_string_n(@nfsd2_renameargs($rqstp->rq_argp)->fname,
1191 @nfsd2_renameargs($rqstp->rq_argp)->flen)
1192 tlen = @nfsd2_renameargs($rqstp->rq_argp)->tlen
1193 tname = kernel_string_n(@nfsd2_renameargs($rqstp->rq_argp)->tname,
1194 @nfsd2_renameargs($rqstp->rq_argp)->tlen)
1195 }
1196 else {
1197 fh = & @nfsd2_renameargs($argp)->ffh
1198 tfh = & @nfsd2_renameargs($argp)->tfh
1199 filelen = $argp->flen
1200 filename = kernel_string_n($argp->fname, $argp->flen)
1201 tlen = $argp->tlen
1202 tname = kernel_string_n($argp->tname, $argp->tlen)
1203 }
1204
1205 uid = __rqstp_uid($rqstp)
1206 gid = __rqstp_gid($rqstp)
1207
1208 name = "nfsd.proc2.rename"
1209 argstr = sprintf("%s to %s", filename, tname)
1210 }
1211
1212 probe nfsd.proc2.rename.return =
1213 kernel.function("nfsd_proc_rename").return !,
1214 module("nfsd").function("nfsd_proc_rename").return ?
1215 {
1216 client_ip = addr_from_rqst_str(@entry($rqstp))
1217
1218 name = "nfsd.proc2.rename.return"
1219 version = 2
1220 retstr = sprintf("%s", nfsderror($return))
1221 }
1222
1223 probe nfsd.proc3.rename = kernel.function("nfsd3_proc_rename") !,
1224 module("nfsd").function("nfsd3_proc_rename") ?
1225 {
1226 client_ip = addr_from_rqst_str($rqstp)
1227 proto = $rqstp->rq_prot
1228 version = 3
1229
1230 if (@defined($rqstp->rq_argp)) {
1231 fh = & @nfsd3_renameargs($rqstp->rq_argp)->ffh
1232 tfh = & @nfsd3_renameargs($rqstp->rq_argp)->tfh
1233 filelen = @nfsd3_renameargs($rqstp->rq_argp)->flen
1234 filename = kernel_string_n(@nfsd3_renameargs($rqstp->rq_argp)->fname,
1235 @nfsd3_renameargs($rqstp->rq_argp)->flen)
1236 tlen = @nfsd3_renameargs($rqstp->rq_argp)->tlen
1237 tname = kernel_string_n(@nfsd3_renameargs($rqstp->rq_argp)->tname,
1238 @nfsd3_renameargs($rqstp->rq_argp)->tlen)
1239 }
1240 else {
1241 fh = & @nfsd3_renameargs($argp)->ffh
1242 tfh = & @nfsd3_renameargs($argp)->tfh
1243 filelen = $argp->flen
1244 filename = kernel_string_n($argp->fname, $argp->flen)
1245 tlen = $argp->tlen
1246 tname = kernel_string_n($argp->tname, $argp->tlen)
1247 }
1248
1249 uid = __rqstp_uid($rqstp)
1250 gid = __rqstp_gid($rqstp)
1251
1252 name = "nfsd.proc3.rename"
1253 argstr = sprintf("%s to %s", filename, tname)
1254 }
1255
1256 probe nfsd.proc3.rename.return =
1257 kernel.function("nfsd3_proc_rename").return !,
1258 module("nfsd").function("nfsd3_proc_rename").return ?
1259 {
1260 client_ip = addr_from_rqst_str(@entry($rqstp))
1261
1262 name = "nfsd.proc3.rename.return"
1263 version = 3
1264 retstr = sprintf("%s", nfsderror($return))
1265 }
1266
1267 probe nfsd.proc4.rename = kernel.function("nfsd4_rename").call !,
1268 module("nfsd").function("nfsd4_rename").call ?
1269 {
1270 client_ip = addr_from_rqst_str($rqstp)
1271 proto = $rqstp->rq_prot
1272 version = 4
1273 fh = & @nfsd4_compound_state($cstate)->save_fh
1274 tfh = & @nfsd4_compound_state($cstate)->current_fh
1275
1276 if (@defined($rename)) {
1277 filelen = $rename->rn_snamelen
1278 filename = kernel_string_n($rename->rn_sname,
1279 $rename->rn_snamelen)
1280 tlen = $rename->rn_tnamelen
1281 tname = kernel_string_n($rename->rn_tname, $rename->rn_tnamelen)
1282 } else {
1283 filelen = $u->rename->rn_snamelen
1284 filename = kernel_string_n($u->rename->rn_sname,
1285 $u->rename->rn_snamelen)
1286 tlen = $u->rename->rn_tnamelen
1287 tname = kernel_string_n($u->rename->rn_tname,
1288 $u->rename->rn_tnamelen)
1289 }
1290
1291 uid = __rqstp_uid($rqstp)
1292 gid = __rqstp_gid($rqstp)
1293
1294 name = "nfsd.proc4.rename"
1295 argstr = sprintf("%s to %s", filename, tname)
1296 }
1297
1298 probe nfsd.proc4.rename.return =
1299 kernel.function("nfsd4_rename").return !,
1300 module("nfsd").function("nfsd4_rename").return ?
1301 {
1302 client_ip = addr_from_rqst_str(@entry($rqstp))
1303
1304 name = "nfsd.proc4.rename.return"
1305 version = 4
1306 retstr = sprintf("%s", nfsderror($return))
1307 }
1308
1309 probe nfsd.entries = nfsd.open,
1310 nfsd.read,
1311 nfsd.write,
1312 nfsd.lookup,
1313 nfsd.commit,
1314 nfsd.create,
1315 nfsd.createv3 ?,
1316 nfsd.unlink,
1317 nfsd.rename,
1318 nfsd.close ?
1319 {}
1320
1321 probe nfsd.return = nfsd.open.return,
1322 nfsd.read.return,
1323 nfsd.write.return,
1324 nfsd.lookup.return,
1325 nfsd.commit.return,
1326 nfsd.create.return,
1327 nfsd.createv3.return ?,
1328 nfsd.unlink.return,
1329 nfsd.rename.return,
1330 nfsd.close.return ?
1331 {}
1332
1333 /**
1334 * probe nfsd.open - NFS server opening a file for client
1335 *
1336 * @client_ip: the ip address of client
1337 * @fh: file handle (the first part is the length of the file handle)
1338 * @access: indicates the type of open (read/write/commit/readdir...)
1339 * @type: type of file (regular file or dir)
1340 */
1341 probe nfsd.open = kernel.function("nfsd_open@fs/nfsd/vfs.c") !,
1342 module("nfsd").function("nfsd_open@fs/nfsd/vfs.c") ?
1343 {
1344 client_ip = addr_from_rqst_str($rqstp)
1345 fh = __svc_fh($fhp)
1346
1347 access = @choose_defined($access, $may_flags)
1348 type = $type
1349
1350 name = "nfsd.open"
1351 argstr = sprintf("access: %d type: %s", access, ftype(type))
1352 }
1353
1354 probe nfsd.open.return = kernel.function("nfsd_open@fs/nfsd/vfs.c").return !,
1355 module("nfsd").function("nfsd_open@fs/nfsd/vfs.c").return ?
1356 {
1357 client_ip = addr_from_rqst_str(@entry($rqstp))
1358 fh = __svc_fh(@entry($fhp))
1359
1360 name = "nfsd.open.return"
1361 retstr = sprintf("%s", nfsderror($return))
1362 }
1363
1364 /**
1365 * probe nfsd.close - NFS server closing a file for client
1366 *
1367 * @filename: file name
1368 *
1369 * This probe point does not exist in kernels starting with 4.2.
1370 */
1371 probe nfsd.close = __nfsd.call_close ?, __nfsd.inlined_close ?
1372 {
1373 client_ip ="N/A"
1374 name = "nfsd.close"
1375 argstr = sprintf("%s",filename)
1376 }
1377 /*
1378 * Why split nfsd.close up into '__nfsd.call_close' and
1379 * '__nfds.inlined_close'? We need the '@choose_defined()' since
1380 * SystemTap has trouble accessing the arguments of inlined functions
1381 * (PR 1155). But, if we only used '@choose_defined()', we wouldn't
1382 * automatically notice a change in the argument name.
1383 */
1384 probe __nfsd.call_close = kernel.function("nfsd_close").call !,
1385 module("nfsd").function("nfsd_close").call ?
1386 {
1387 filename = __file_filename($filp)
1388 }
1389 probe __nfsd.inlined_close = kernel.function("nfsd_close").inline !,
1390 module("nfsd").function("nfsd_close").inline ?
1391 {
1392 filename = __file_filename(@choose_defined($filp, 0))
1393 }
1394
1395 probe nfsd.close.return = kernel.function("nfsd_close").return !,
1396 module("nfsd").function("nfsd_close").return ?
1397 {
1398 name = "nfsd.close.return"
1399 retstr = "N/A"
1400 }
1401
1402 /**
1403 * probe nfsd.read - NFS server reading data from a file for client
1404 *
1405 * @client_ip: the ip address of client
1406 * @fh: file handle (the first part is the length of the file handle)
1407 * @file: argument file, indicates if the file has been opened.
1408 * @size: read bytes
1409 * @count: read bytes
1410 * @offset: the offset of file
1411 * @vec: struct kvec, includes buf address in kernel address and length of each buffer
1412 * @vlen: read blocks
1413 */
1414 probe nfsd.read = kernel.function("nfsd_read") !,
1415 module("nfsd").function("nfsd_read") ?
1416 {
1417 client_ip = addr_from_rqst_str($rqstp)
1418 fh = __svc_fh($fhp)
1419
1420 file = @choose_defined($file, 0)
1421 count = kernel_long($count)
1422 offset = $offset
1423 vec = $vec
1424 vlen = $vlen
1425
1426 name = "nfsd.read"
1427 argstr = sprintf("count: %d offset: %d",count,offset)
1428
1429 size = count
1430 units = "bytes"
1431 }
1432
1433 probe nfsd.read.return = kernel.function("nfsd_read").return !,
1434 module("nfsd").function("nfsd_read").return ?
1435 {
1436 client_ip = addr_from_rqst_str(@entry($rqstp))
1437 fh = __svc_fh(@entry($fhp))
1438
1439 name = "nfsd.read.return"
1440 retstr = sprintf("%s", nfsderror($return))
1441 }
1442
1443 /**
1444 * probe nfsd.write - NFS server writing data to a file for client
1445 *
1446 * @client_ip: the ip address of client
1447 * @fh: file handle (the first part is the length of the file handle)
1448 * @file: argument file, indicates if the file has been opened.
1449 * @size: read bytes
1450 * @count: read bytes
1451 * @offset: the offset of file
1452 * @vec: struct kvec, includes buf address in kernel address and length of each buffer
1453 * @vlen: read blocks
1454 */
1455 probe nfsd.write = kernel.function("nfsd_write") !,
1456 module("nfsd").function("nfsd_write") ?
1457 {
1458 client_ip = addr_from_rqst_str($rqstp)
1459 fh = __svc_fh($fhp)
1460
1461 file = @choose_defined($file, 0)
1462 %( kernel_v >= "2.6.30" %?
1463 count = kernel_long($cnt)
1464 %:
1465 count = $cnt
1466 %)
1467 offset = $offset
1468 vec = $vec
1469 vlen = $vlen
1470
1471 name = "nfsd.write"
1472 argstr = sprintf("count: %d offset: %d",count,offset)
1473
1474 size = count
1475 units = "bytes"
1476 }
1477
1478 probe nfsd.write.return = kernel.function("nfsd_write").return !,
1479 module("nfsd").function("nfsd_write").return ?
1480 {
1481 client_ip = addr_from_rqst_str(@entry($rqstp))
1482 fh = __svc_fh(@entry($fhp))
1483
1484 name = "nfsd.write.return"
1485 retstr = sprintf("%s", nfsderror($return))
1486 }
1487
1488 /**
1489 * probe nfsd.commit - NFS server committing all pending writes to stable storage
1490 *
1491 * @client_ip: the ip address of client
1492 * @fh: file handle (the first part is the length of the file handle)
1493 * @flag: indicates whether this execution is a sync operation
1494 * @size: read bytes
1495 * @count: read bytes
1496 * @offset: the offset of file
1497 */
1498 probe nfsd.commit = kernel.function("nfsd_commit") !,
1499 module("nfsd").function("nfsd_commit") ?
1500 {
1501 client_ip = addr_from_rqst_str($rqstp)
1502 fh = __svc_fh($fhp)
1503
1504 count = $count
1505 offset = $offset
1506 flag = $fhp->fh_export->ex_flags
1507
1508 name = "nfsd.commit"
1509 argstr = sprintf("count: %d offset: %d",count,offset)
1510
1511 size = count
1512 units = "bytes"
1513 }
1514
1515 probe nfsd.commit.return = kernel.function("nfsd_commit").return !,
1516 module("nfsd").function("nfsd_commit").return ?
1517 {
1518 client_ip = addr_from_rqst_str(@entry($rqstp))
1519 fh = __svc_fh(@entry($fhp))
1520
1521 name = "nfsd.commit.return"
1522 retstr = sprintf("%s", nfsderror($return))
1523 }
1524
1525 /**
1526 * probe nfsd.lookup - NFS server opening or searching file for a file for client
1527 *
1528 * @client_ip: the ip address of client
1529 * @fh: file handle of parent dir(the first part is the length of the file handle)
1530 * @filename: file name
1531 * @filelen: the length of file name
1532 */
1533 probe nfsd.lookup = kernel.function("nfsd_lookup") !,
1534 module("nfsd").function("nfsd_lookup") ?
1535 {
1536 client_ip = addr_from_rqst_str($rqstp)
1537 fh = __svc_fh($fhp)
1538
1539 filelen = $len
1540 filename = kernel_string_n($name, $len)
1541
1542 name = "nfsd.lookup"
1543 argstr = sprintf("name: %s", kernel_string_n($name, $len))
1544 }
1545
1546 probe nfsd.lookup.return = kernel.function("nfsd_lookup").return !,
1547 module("nfsd").function("nfsd_lookup").return ?
1548 {
1549 client_ip = addr_from_rqst_str(@entry($rqstp))
1550 fh = __svc_fh(@entry($fhp))
1551
1552 name = "nfsd.lookup.return"
1553 retstr = sprintf("%s", nfsderror($return))
1554 }
1555
1556 /**
1557 * probe nfsd.create - NFS server creating a file(regular,dir,device,fifo) for client
1558 *
1559 * @client_ip: the ip address of client
1560 * @fh: file handle (the first part is the length of the file handle)
1561 * @filename: file name
1562 * @filelen: the length of file name
1563 * @type: file type(regular,dir,device,fifo ...)
1564 * @iap_valid: Attribute flags
1565 * @iap_mode: file access mode
1566 *
1567 * Sometimes nfsd will call nfsd_create_v3 instead of this this probe point.
1568 */
1569 probe nfsd.create = kernel.function("nfsd_create") !,
1570 module("nfsd").function("nfsd_create") ?
1571 {
1572 client_ip = addr_from_rqst_str($rqstp)
1573 fh = __svc_fh($fhp)
1574
1575 filelen = $flen
1576 filename = kernel_string_n($fname, $flen)
1577 type = $type
1578 iap_valid = $iap->ia_valid
1579 iap_mode = $iap->ia_mode
1580
1581 name = "nfsd.create"
1582 argstr = sprintf("name: %s type: %s", kernel_string_n($fname, $flen),
1583 ftype(type))
1584 }
1585
1586 probe nfsd.create.return = kernel.function("nfsd_create").return !,
1587 module("nfsd").function("nfsd_create").return ?
1588 {
1589 client_ip = addr_from_rqst_str(@entry($rqstp))
1590 fh = __svc_fh(@entry($fhp))
1591
1592 name = "nfsd.create.return"
1593 retstr = sprintf("%s", nfsderror($return))
1594 }
1595
1596 /**
1597 * probe nfsd.createv3 - NFS server creating a regular file or set file attributes for client
1598 *
1599 * @client_ip: the ip address of client
1600 * @fh: file handle (the first part is the length of the file handle)
1601 * @filename: file name
1602 * @filelen: the length of file name
1603 * @iap_valid: Attribute flags
1604 * @iap_mode: file access mode
1605 * @createmode: create mode .The possible values could be: NFS3_CREATE_EXCLUSIVE, NFS3_CREATE_UNCHECKED, or NFS3_CREATE_GUARDED
1606 * @truncp: trunp arguments, indicates if the file shouldbe truncate
1607 * @verifier: file attributes (atime,mtime,mode). It's used to reset file attributes for CREATE_EXCLUSIVE
1608 *
1609 * This probepoints is only called by nfsd3_proc_create and
1610 * nfsd4_open when op_claim_type is NFS4_OPEN_CLAIM_NULL.
1611 */
1612 probe nfsd.createv3 = kernel.function("do_nfsd_create") !,
1613 module("nfsd").function("do_nfsd_create") !,
1614 kernel.function("nfsd_create_v3") !,
1615 module("nfsd").function("nfsd_create_v3") ?
1616 {
1617 client_ip = addr_from_rqst_str($rqstp)
1618 fh = __svc_fh($fhp)
1619
1620 filelen = $flen
1621 filename = kernel_string_n($fname, $flen)
1622 iap_valid = $iap->ia_valid
1623 iap_mode = $iap->ia_mode
1624 truncp = $truncp
1625 verifier = $verifier
1626 createmode = $createmode
1627
1628 name = "nfsd.createv3"
1629 argstr = sprintf("name: %s mode: %s", kernel_string_n($fname, $flen),
1630 nfs3_cmode(createmode))
1631 }
1632
1633 probe nfsd.createv3.return =
1634 kernel.function("do_nfsd_create").return !,
1635 module("nfsd").function("do_nfsd_create").return !,
1636 kernel.function("nfsd_create_v3").return !,
1637 module("nfsd").function("nfsd_create_v3").return ?
1638 {
1639 client_ip = addr_from_rqst_str(@entry($rqstp))
1640 fh = __svc_fh(@entry($fhp))
1641
1642 name = "nfsd.createv3.return"
1643 retstr = sprintf("%s", nfsderror($return))
1644 }
1645
1646 /**
1647 * probe nfsd.unlink - NFS server removing a file or a directory for client
1648 *
1649 * @client_ip: the ip address of client
1650 * @fh: file handle (the first part is the length of the file handle)
1651 * @filename: file name
1652 * @filelen: the length of file name
1653 * @type: file type (file or dir)
1654 */
1655 probe nfsd.unlink = kernel.function("nfsd_unlink") !,
1656 module("nfsd").function("nfsd_unlink") ?
1657 {
1658 client_ip = addr_from_rqst_str($rqstp)
1659 fh = __svc_fh($fhp)
1660
1661 filelen = $flen
1662 filename = kernel_string_n($fname, $flen)
1663 type = $type
1664
1665 name = "nfsd.unlink"
1666 argstr = sprintf("name: %s", kernel_string_n($fname, $flen))
1667 }
1668
1669 probe nfsd.unlink.return = kernel.function("nfsd_unlink").return !,
1670 module("nfsd").function("nfsd_unlink").return ?
1671 {
1672 client_ip = addr_from_rqst_str(@entry($rqstp))
1673 fh = __svc_fh(@entry($fhp))
1674
1675 name = "nfsd.unlink.return"
1676 retstr = sprintf("%s", nfsderror($return))
1677 }
1678
1679 /**
1680 * probe nfsd.rename -NFS server renaming a file for client
1681 *
1682 * @client_ip: the ip address of client
1683 * @fh: file handler of old path
1684 * @tfh: file handler of new path
1685 * @filename: old file name
1686 * @tname: new file name
1687 * @flen: length of old file name
1688 * @tlen: length of new file name
1689 */
1690 probe nfsd.rename = kernel.function("nfsd_rename") !,
1691 module("nfsd").function("nfsd_rename") ?
1692 {
1693 client_ip = addr_from_rqst_str($rqstp)
1694
1695 fh = __svc_fh($ffhp)
1696 tfh = __svc_fh($tfhp)
1697
1698 filelen = $flen
1699 filename = kernel_string_n($fname, $flen)
1700 tlen = $tlen
1701 tname = kernel_string_n($tname, $tlen)
1702
1703 name = "nfsd.rename"
1704 argstr = sprintf("%s to %s", kernel_string_n($fname, $flen),
1705 kernel_string_n($tname, $tlen))
1706 }
1707
1708 probe nfsd.rename.return = kernel.function("nfsd_rename").return !,
1709 module("nfsd").function("nfsd_rename").return ?
1710 {
1711 client_ip = addr_from_rqst_str(@entry($rqstp))
1712 fh = __svc_fh(@entry($ffhp))
1713
1714 name = "nfsd.rename.return"
1715 retstr = sprintf("%s", nfsderror($return))
1716 }