public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 00/10]  Update nfs tapset for nfs header changes, to use @cast  instead of embedded-c
@ 2010-02-25 22:17 Steve Dickson
  2010-02-25 22:18 ` [PATCH 01/10] Added new nfsderror() function Steve Dickson
                   ` (10 more replies)
  0 siblings, 11 replies; 21+ messages in thread
From: Steve Dickson @ 2010-02-25 22:17 UTC (permalink / raw)
  To: Systemtap Mailing list

The following patch series fixes a couple problems with the NFS
server probes. 

With the 2.6.33 kernel a number of header files disappears from
the kernel-devel rpm. So the @cast mechanism was used to access
those the structures that where in the vanishing header files.  

Added the NFS v4 version of each probe. 

Finally, to allow more granular filtering, I added the clients
IP address to all the probes. This will allow a user to filter
the probe output on a particular client which I believe
will be very useful... 

steved.

Steve Dickson (10):
  Added new nfsderror() function
  Updated nfsd.proc.lookup probes
  Updated nfsd.proc.read probes
  Updated nfsd.proc.write probes
  Updated nfsd.proc.create probes
  Updated nfsd.proc.remove probes
  Updated nfsd.proc.remove probes
  Removed the nfsd.proc4.compound and nfsd.proc.compound.return probes
  General clean up on the upper level probes
  Allow better filtering with IP address and File handle

 tapset/nfsd.stp      |  666 ++++++++++++++++++++++++++++++++++----------------
 tapset/nfsderrno.stp |  238 ++++++++++++++++++
 tapset/rpc.stp       |   24 ++
 3 files changed, 723 insertions(+), 205 deletions(-)
 create mode 100644 tapset/nfsderrno.stp

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 01/10]  Added new nfsderror() function
  2010-02-25 22:17 [PATCH 00/10] Update nfs tapset for nfs header changes, to use @cast instead of embedded-c Steve Dickson
@ 2010-02-25 22:18 ` Steve Dickson
  2010-02-25 22:20 ` [PATCH 02/10] Updated nfsd.proc.lookup probes Steve Dickson
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Steve Dickson @ 2010-02-25 22:18 UTC (permalink / raw)
  To: Systemtap Mailing list

commit 2c903939fc80280b4883768fa7e4dc14ea6377d5
Author: Steve Dickson <steved@redhat.com>
Date:   Tue Feb 23 11:15:05 2010 -0500

    Added new nfsderror() function
    
    The nfsderror() function takes the error numbers used
    by the NFS server and converts them into a text representation
    of the given error number.
    
    Signed-off-by: Steve Dickson <steved@redhat.com>

diff --git a/tapset/nfsderrno.stp b/tapset/nfsderrno.stp
new file mode 100644
index 0000000..6ac4cac
--- /dev/null
+++ b/tapset/nfsderrno.stp
@@ -0,0 +1,238 @@
+// nfsd errnos tapset
+// Copyright (C) 2010 Red Hat Inc.
+//
+// This file is part of systemtap, and is free software.  You can
+// redistribute it and/or modify it under the terms of the GNU General
+// Public License (GPL); either version 2, or (at your option) any
+// later version.
+
+%{
+#include <linux/nfs.h>
+#include <linux/nfs4.h>
+
+#define	nfs_ok			cpu_to_be32(NFS_OK)
+#define	nfserr_perm		cpu_to_be32(NFSERR_PERM)
+#define	nfserr_noent		cpu_to_be32(NFSERR_NOENT)
+#define	nfserr_io		cpu_to_be32(NFSERR_IO)
+#define	nfserr_nxio		cpu_to_be32(NFSERR_NXIO)
+#define	nfserr_eagain		cpu_to_be32(NFSERR_EAGAIN)
+#define	nfserr_acces		cpu_to_be32(NFSERR_ACCES)
+#define	nfserr_exist		cpu_to_be32(NFSERR_EXIST)
+#define	nfserr_xdev		cpu_to_be32(NFSERR_XDEV)
+#define	nfserr_nodev		cpu_to_be32(NFSERR_NODEV)
+#define	nfserr_notdir		cpu_to_be32(NFSERR_NOTDIR)
+#define	nfserr_isdir		cpu_to_be32(NFSERR_ISDIR)
+#define	nfserr_inval		cpu_to_be32(NFSERR_INVAL)
+#define	nfserr_fbig		cpu_to_be32(NFSERR_FBIG)
+#define	nfserr_nospc		cpu_to_be32(NFSERR_NOSPC)
+#define	nfserr_rofs		cpu_to_be32(NFSERR_ROFS)
+#define	nfserr_mlink		cpu_to_be32(NFSERR_MLINK)
+#define	nfserr_opnotsupp	cpu_to_be32(NFSERR_OPNOTSUPP)
+#define	nfserr_nametoolong	cpu_to_be32(NFSERR_NAMETOOLONG)
+#define	nfserr_notempty		cpu_to_be32(NFSERR_NOTEMPTY)
+#define	nfserr_dquot		cpu_to_be32(NFSERR_DQUOT)
+#define	nfserr_stale		cpu_to_be32(NFSERR_STALE)
+#define	nfserr_remote		cpu_to_be32(NFSERR_REMOTE)
+#define	nfserr_wflush		cpu_to_be32(NFSERR_WFLUSH)
+#define	nfserr_badhandle	cpu_to_be32(NFSERR_BADHANDLE)
+#define	nfserr_notsync		cpu_to_be32(NFSERR_NOT_SYNC)
+#define	nfserr_badcookie	cpu_to_be32(NFSERR_BAD_COOKIE)
+#define	nfserr_notsupp		cpu_to_be32(NFSERR_NOTSUPP)
+#define	nfserr_toosmall		cpu_to_be32(NFSERR_TOOSMALL)
+#define	nfserr_serverfault	cpu_to_be32(NFSERR_SERVERFAULT)
+#define	nfserr_badtype		cpu_to_be32(NFSERR_BADTYPE)
+#define	nfserr_jukebox		cpu_to_be32(NFSERR_JUKEBOX)
+#define	nfserr_denied		cpu_to_be32(NFSERR_DENIED)
+#define	nfserr_deadlock		cpu_to_be32(NFSERR_DEADLOCK)
+#define nfserr_expired          cpu_to_be32(NFSERR_EXPIRED)
+#define	nfserr_bad_cookie	cpu_to_be32(NFSERR_BAD_COOKIE)
+#define	nfserr_same		cpu_to_be32(NFSERR_SAME)
+#define	nfserr_clid_inuse	cpu_to_be32(NFSERR_CLID_INUSE)
+#define	nfserr_stale_clientid	cpu_to_be32(NFSERR_STALE_CLIENTID)
+#define	nfserr_resource		cpu_to_be32(NFSERR_RESOURCE)
+#define	nfserr_moved		cpu_to_be32(NFSERR_MOVED)
+#define	nfserr_nofilehandle	cpu_to_be32(NFSERR_NOFILEHANDLE)
+#define	nfserr_minor_vers_mismatch	cpu_to_be32(NFSERR_MINOR_VERS_MISMATCH)
+#define nfserr_share_denied	cpu_to_be32(NFSERR_SHARE_DENIED)
+#define nfserr_stale_stateid	cpu_to_be32(NFSERR_STALE_STATEID)
+#define nfserr_old_stateid	cpu_to_be32(NFSERR_OLD_STATEID)
+#define nfserr_bad_stateid	cpu_to_be32(NFSERR_BAD_STATEID)
+#define nfserr_bad_seqid	cpu_to_be32(NFSERR_BAD_SEQID)
+#define	nfserr_symlink		cpu_to_be32(NFSERR_SYMLINK)
+#define	nfserr_not_same		cpu_to_be32(NFSERR_NOT_SAME)
+#define	nfserr_restorefh	cpu_to_be32(NFSERR_RESTOREFH)
+#define	nfserr_attrnotsupp	cpu_to_be32(NFSERR_ATTRNOTSUPP)
+#define	nfserr_bad_xdr		cpu_to_be32(NFSERR_BAD_XDR)
+#define	nfserr_openmode		cpu_to_be32(NFSERR_OPENMODE)
+#define	nfserr_locks_held	cpu_to_be32(NFSERR_LOCKS_HELD)
+#define	nfserr_op_illegal	cpu_to_be32(NFSERR_OP_ILLEGAL)
+#define	nfserr_grace		cpu_to_be32(NFSERR_GRACE)
+#define	nfserr_no_grace		cpu_to_be32(NFSERR_NO_GRACE)
+#define	nfserr_reclaim_bad	cpu_to_be32(NFSERR_RECLAIM_BAD)
+#define	nfserr_badname		cpu_to_be32(NFSERR_BADNAME)
+#define	nfserr_cb_path_down	cpu_to_be32(NFSERR_CB_PATH_DOWN)
+#define	nfserr_locked		cpu_to_be32(NFSERR_LOCKED)
+#define	nfserr_wrongsec		cpu_to_be32(NFSERR_WRONGSEC)
+#define nfserr_badiomode		cpu_to_be32(NFS4ERR_BADIOMODE)
+#define nfserr_badlayout		cpu_to_be32(NFS4ERR_BADLAYOUT)
+#define nfserr_bad_session_digest	cpu_to_be32(NFS4ERR_BAD_SESSION_DIGEST)
+#define nfserr_badsession		cpu_to_be32(NFS4ERR_BADSESSION)
+#define nfserr_badslot			cpu_to_be32(NFS4ERR_BADSLOT)
+#define nfserr_complete_already		cpu_to_be32(NFS4ERR_COMPLETE_ALREADY)
+#define nfserr_conn_not_bound_to_session cpu_to_be32(NFS4ERR_CONN_NOT_BOUND_TO_SESSION)
+#define nfserr_deleg_already_wanted	cpu_to_be32(NFS4ERR_DELEG_ALREADY_WANTED)
+#define nfserr_back_chan_busy		cpu_to_be32(NFS4ERR_BACK_CHAN_BUSY)
+#define nfserr_layouttrylater		cpu_to_be32(NFS4ERR_LAYOUTTRYLATER)
+#define nfserr_layoutunavailable	cpu_to_be32(NFS4ERR_LAYOUTUNAVAILABLE)
+#define nfserr_nomatching_layout	cpu_to_be32(NFS4ERR_NOMATCHING_LAYOUT)
+#define nfserr_recallconflict		cpu_to_be32(NFS4ERR_RECALLCONFLICT)
+#define nfserr_unknown_layouttype	cpu_to_be32(NFS4ERR_UNKNOWN_LAYOUTTYPE)
+#define nfserr_seq_misordered		cpu_to_be32(NFS4ERR_SEQ_MISORDERED)
+#define nfserr_sequence_pos		cpu_to_be32(NFS4ERR_SEQUENCE_POS)
+#define nfserr_req_too_big		cpu_to_be32(NFS4ERR_REQ_TOO_BIG)
+#define nfserr_rep_too_big		cpu_to_be32(NFS4ERR_REP_TOO_BIG)
+#define nfserr_rep_too_big_to_cache	cpu_to_be32(NFS4ERR_REP_TOO_BIG_TO_CACHE)
+#define nfserr_retry_uncached_rep	cpu_to_be32(NFS4ERR_RETRY_UNCACHED_REP)
+#define nfserr_unsafe_compound		cpu_to_be32(NFS4ERR_UNSAFE_COMPOUND)
+#define nfserr_too_many_ops		cpu_to_be32(NFS4ERR_TOO_MANY_OPS)
+#define nfserr_op_not_in_session	cpu_to_be32(NFS4ERR_OP_NOT_IN_SESSION)
+#define nfserr_hash_alg_unsupp		cpu_to_be32(NFS4ERR_HASH_ALG_UNSUPP)
+#define nfserr_clientid_busy		cpu_to_be32(NFS4ERR_CLIENTID_BUSY)
+#define nfserr_pnfs_io_hole		cpu_to_be32(NFS4ERR_PNFS_IO_HOLE)
+#define nfserr_seq_false_retry		cpu_to_be32(NFS4ERR_SEQ_FALSE_RETRY)
+#define nfserr_bad_high_slot		cpu_to_be32(NFS4ERR_BAD_HIGH_SLOT)
+#define nfserr_deadsession		cpu_to_be32(NFS4ERR_DEADSESSION)
+#define nfserr_encr_alg_unsupp		cpu_to_be32(NFS4ERR_ENCR_ALG_UNSUPP)
+#define nfserr_pnfs_no_layout		cpu_to_be32(NFS4ERR_PNFS_NO_LAYOUT)
+#define nfserr_not_only_op		cpu_to_be32(NFS4ERR_NOT_ONLY_OP)
+#define nfserr_wrong_cred		cpu_to_be32(NFS4ERR_WRONG_CRED)
+#define nfserr_wrong_type		cpu_to_be32(NFS4ERR_WRONG_TYPE)
+#define nfserr_dirdeleg_unavail		cpu_to_be32(NFS4ERR_DIRDELEG_UNAVAIL)
+#define nfserr_reject_deleg		cpu_to_be32(NFS4ERR_REJECT_DELEG)
+#define nfserr_returnconflict		cpu_to_be32(NFS4ERR_RETURNCONFLICT)
+#define nfserr_deleg_revoked		cpu_to_be32(NFS4ERR_DELEG_REVOKED)
+%}
+
+function nfsderror:string(err:long) 
+%{
+	static struct {
+		int	nfserr;
+		char *string;
+	} nfs_errtbl[] = {
+		{nfs_ok, "NFS_OK"},
+		{nfserr_perm, "NFSERR_PERM"},
+		{nfserr_noent, "NFSERR_NOENT"},
+		{nfserr_io, "NFSERR_IO"},
+		{nfserr_nxio, "NFSERR_NXIO"},
+		{nfserr_eagain, "NFSERR_EAGAIN"},
+		{nfserr_acces, "NFSERR_ACCES"},
+		{nfserr_exist, "NFSERR_EXIST"},
+		{nfserr_xdev, "NFSERR_XDEV"},
+		{nfserr_nodev, "NFSERR_NODEV"},
+		{nfserr_notdir, "NFSERR_NOTDIR"},
+		{nfserr_isdir, "NFSERR_ISDIR"},
+		{nfserr_inval, "NFSERR_INVAL"},
+		{nfserr_fbig, "NFSERR_FBIG"},
+		{nfserr_nospc, "NFSERR_NOSPC"},
+		{nfserr_rofs, "NFSERR_ROFS"},
+		{nfserr_mlink, "NFSERR_MLINK"},
+		{nfserr_opnotsupp, "NFSERR_OPNOTSUPP"},
+		{nfserr_nametoolong, "NFSERR_NAMETOOLONG"},
+		{nfserr_notempty, "NFSERR_NOTEMPTY"},
+		{nfserr_dquot, "NFSERR_DQUOT"},
+		{nfserr_stale, "NFSERR_STALE"},
+		{nfserr_remote, "NFSERR_REMOTE"},
+		{nfserr_wflush, "NFSERR_WFLUSH"},
+		{nfserr_badhandle, "NFSERR_BADHANDLE"},
+		{nfserr_notsync, "NFSERR_NOT_SYNC"},
+		{nfserr_badcookie, "NFSERR_BAD_COOKIE"},
+		{nfserr_notsupp, "NFSERR_NOTSUPP"},
+		{nfserr_toosmall, "NFSERR_TOOSMALL"},
+		{nfserr_serverfault, "NFSERR_SERVERFAULT"},
+		{nfserr_badtype, "NFSERR_BADTYPE"},
+		{nfserr_jukebox, "NFSERR_JUKEBOX"},
+		{nfserr_denied, "NFSERR_DENIED"},
+		{nfserr_deadlock, "NFSERR_DEADLOCK"},
+		{nfserr_expired, "NFSERR_EXPIRED"},
+		{nfserr_bad_cookie, "NFSERR_BAD_COOKIE"},
+		{nfserr_same, "NFSERR_SAME"},
+		{nfserr_clid_inuse, "NFSERR_CLID_INUSE"},
+		{nfserr_stale_clientid, "NFSERR_STALE_CLIENTID"},
+		{nfserr_resource, "NFSERR_RESOURCE"},
+		{nfserr_moved, "NFSERR_MOVED"},
+		{nfserr_nofilehandle, "NFSERR_NOFILEHANDLE"},
+		{nfserr_minor_vers_mismatch, "NFSERR_MINOR_VERS_MISMATCH"},
+		{nfserr_share_denied, "NFSERR_SHARE_DENIED"},
+		{nfserr_stale_stateid, "NFSERR_STALE_STATEID"},
+		{nfserr_old_stateid, "NFSERR_OLD_STATEID"},
+		{nfserr_bad_stateid, "NFSERR_BAD_STATEID"},
+		{nfserr_bad_seqid, "NFSERR_BAD_SEQID"},
+		{nfserr_symlink , "NFSERR_SYMLINK"},
+		{nfserr_not_same , "NFSERR_NOT_SAME"},
+		{nfserr_restorefh , "NFSERR_RESTOREFH"},
+		{nfserr_attrnotsupp, "NFSERR_ATTRNOTSUPP"},
+		{nfserr_bad_xdr, "NFSERR_BAD_XDR"},
+		{nfserr_openmode, "NFSERR_OPENMODE"},
+		{nfserr_locks_held, "NFSERR_LOCKS_HELD"},
+		{nfserr_op_illegal, "NFSERR_OP_ILLEGAL"},
+		{nfserr_grace, "NFSERR_GRACE"},
+		{nfserr_no_grace, "NFSERR_NO_GRACE"},
+		{nfserr_reclaim_bad, "NFSERR_RECLAIM_BAD"},
+		{nfserr_badname, "NFSERR_BADNAME"},
+		{nfserr_cb_path_down, "NFSERR_CB_PATH_DOWN"},
+		{nfserr_locked, "NFSERR_LOCKED"},
+		{nfserr_wrongsec, "NFSERR_WRONGSEC"},
+		{nfserr_badiomode, "NFS4ERR_BADIOMODE"},
+		{nfserr_badlayout, "NFS4ERR_BADLAYOUT"},
+		{nfserr_bad_session_digest, "NFS4ERR_BAD_SESSION_DIGEST"},
+		{nfserr_badsession, "NFS4ERR_BADSESSION"},
+		{nfserr_badslot, "NFS4ERR_BADSLOT"},
+		{nfserr_complete_already, "NFS4ERR_COMPLETE_ALREADY"},
+		{nfserr_conn_not_bound_to_session, "NFS4ERR_CONN_NOT_BOUND_TO_SESSION"},
+		{nfserr_deleg_already_wanted, "NFS4ERR_DELEG_ALREADY_WANTED"},
+		{nfserr_back_chan_busy, "NFS4ERR_BACK_CHAN_BUSY"},
+		{nfserr_layouttrylater, "NFS4ERR_LAYOUTTRYLATER"},
+		{nfserr_layoutunavailable, "NFS4ERR_LAYOUTUNAVAILABLE"},
+		{nfserr_nomatching_layout, "NFS4ERR_NOMATCHING_LAYOUT"},
+		{nfserr_recallconflict, "NFS4ERR_RECALLCONFLICT"},
+		{nfserr_unknown_layouttype, "NFS4ERR_UNKNOWN_LAYOUTTYPE"},
+		{nfserr_seq_misordered, "NFS4ERR_SEQ_MISORDERED"},
+		{nfserr_sequence_pos, "NFS4ERR_SEQUENCE_POS"},
+		{nfserr_req_too_big, "NFS4ERR_REQ_TOO_BIG"},
+		{nfserr_rep_too_big, "NFS4ERR_REP_TOO_BIG"},
+		{nfserr_rep_too_big_to_cache, "NFS4ERR_REP_TOO_BIG_TO_CACHE"},
+		{nfserr_retry_uncached_rep, "NFS4ERR_RETRY_UNCACHED_REP"},
+		{nfserr_unsafe_compound, "NFS4ERR_UNSAFE_COMPOUND"},
+		{nfserr_too_many_ops, "NFS4ERR_TOO_MANY_OPS"},
+		{nfserr_op_not_in_session, "NFS4ERR_OP_NOT_IN_SESSION"},
+		{nfserr_hash_alg_unsupp, "NFS4ERR_HASH_ALG_UNSUPP"},
+		{nfserr_clientid_busy, "NFS4ERR_CLIENTID_BUSY"},
+		{nfserr_pnfs_io_hole, "NFS4ERR_PNFS_IO_HOLE"},
+		{nfserr_seq_false_retry, "NFS4ERR_SEQ_FALSE_RETRY"},
+		{nfserr_bad_high_slot, "NFS4ERR_BAD_HIGH_SLOT"},
+		{nfserr_deadsession, "NFS4ERR_DEADSESSION"},
+		{nfserr_encr_alg_unsupp, "NFS4ERR_ENCR_ALG_UNSUPP"},
+		{nfserr_pnfs_no_layout, "NFS4ERR_PNFS_NO_LAYOUT"},
+		{nfserr_not_only_op, "NFS4ERR_NOT_ONLY_OP"},
+		{nfserr_wrong_cred, "NFS4ERR_WRONG_CRED"},
+		{nfserr_wrong_type, "NFS4ERR_WRONG_TYPE"},
+		{nfserr_dirdeleg_unavail, "NFS4ERR_DIRDELEG_UNAVAIL"},
+		{nfserr_reject_deleg, "NFS4ERR_REJECT_DELEG"},
+		{nfserr_returnconflict, "NFS4ERR_RETURNCONFLICT"},
+		{nfserr_deleg_revoked, "NFS4ERR_DELEG_REVOKED"},
+	};
+	int	i;
+	int tabsz = (sizeof(nfs_errtbl)/sizeof(nfs_errtbl[0]));
+
+	for (i = 0; i < tabsz; i++) {
+		if (nfs_errtbl[i].nfserr == THIS->err) {
+			break;
+		}
+	}
+	if (i == tabsz)
+		snprintf(THIS->__retvalue, MAXSTRINGLEN, "nfsderr %d", ntohl(THIS->err));
+	else
+		snprintf(THIS->__retvalue, MAXSTRINGLEN, 
+			"nfsderr %d(%s)", ntohl(nfs_errtbl[i].nfserr), nfs_errtbl[i].string);
+
+%}

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 02/10]   Updated nfsd.proc.lookup probes
  2010-02-25 22:17 [PATCH 00/10] Update nfs tapset for nfs header changes, to use @cast instead of embedded-c Steve Dickson
  2010-02-25 22:18 ` [PATCH 01/10] Added new nfsderror() function Steve Dickson
@ 2010-02-25 22:20 ` Steve Dickson
  2010-02-26 20:25   ` David Smith
  2010-02-25 22:21 ` [PATCH 03/10] Updated nfsd.proc.read probes Steve Dickson
                   ` (8 subsequent siblings)
  10 siblings, 1 reply; 21+ messages in thread
From: Steve Dickson @ 2010-02-25 22:20 UTC (permalink / raw)
  To: Systemtap Mailing list

commit 472a70b44b5858c60373aa45a119ad66b804061b
Author: Steve Dickson <steved@redhat.com>
Date:   Tue Feb 23 11:29:06 2010 -0500

    Updated nfsd.proc.lookup probes
    
    Converted the nfsd.proc.lookup probes to used
    the @cast() mechanism.
    
    Created the nfsd.proc4.lookup probes
    
    Signed-off-by: Steve Dickson <steved@redhat.com>

diff --git a/tapset/nfsd.stp b/tapset/nfsd.stp
index df8efa8..92f682f 100644
--- a/tapset/nfsd.stp
+++ b/tapset/nfsd.stp
@@ -11,10 +11,6 @@
 
 %{
 #include <linux/sunrpc/svc.h>
-#include <linux/nfsd/nfsd.h>
-#include <linux/nfsd/cache.h>
-#include <linux/nfsd/xdr.h>
-#include <linux/nfsd/xdr3.h>
 %}
 
 /*
@@ -35,75 +31,6 @@
  *15 :nfsd.proc3.rename.tfh
  */
 
-/*Get file handler from argp,the index indicates the type of argp*/
-function __get_fh:long(argp:long,index:long) %{ /* pure */
-	int index = (int)((long)THIS->index);
-	struct nfsd_diropargs * argp = NULL ;
-	struct nfsd3_diropargs * argp3 = NULL ;
-	struct nfsd_readargs * argpr = NULL;
-	struct nfsd3_readargs * argpr3 = NULL;
-	struct nfsd_writeargs * argpw = NULL;
-	struct nfsd3_writeargs * argpw3 = NULL;
-	struct nfsd3_commitargs * argpc3 = NULL;
-	struct nfsd_createargs *argpcr = NULL;
-	struct nfsd3_createargs *argpcr3 = NULL;
-	struct nfsd_diropargs *argpre = NULL;
-	struct nfsd3_diropargs *argpre3 = NULL;
-	struct nfsd_renameargs *argpren = NULL;
-	struct nfsd3_renameargs *argpren3 = NULL;
-	struct svc_fh * fhp = NULL;
-
-	switch(index)
-	{
-	case 1: argp = (struct nfsd_diropargs *)((long)THIS->argp);
-		fhp = &argp->fh;
-		break;
-	case 2: argp3 = (struct nfsd3_diropargs *)((long)THIS->argp);
-		fhp = &argp3->fh;
-		break;
-	case 3: argpr = (struct nfsd_readargs * )((long)THIS->argp);
-		fhp = &argpr->fh;
-		break;
-	case 4: argpr3 = (struct nfsd3_readargs * )((long)THIS->argp);
-		fhp = &argpr3->fh;
-		break;
-	case 5: argpw = (struct nfsd_writeargs * )((long)THIS->argp);
-		fhp = &argpw->fh;
-		break;
-	case 6: argpw3 = (struct nfsd3_writeargs * )((long)THIS->argp);
-		fhp = &argpw3->fh;
-		break;
-	case 7: argpc3 = (struct nfsd3_commitargs * )((long)THIS->argp);
-		fhp = &argpc3->fh;
-		break;
-	case 8: argpcr = (struct nfsd_createargs * )((long)THIS->argp);
-		fhp = &argpcr->fh;
-		break;
-	case 9: argpcr3 = (struct nfsd3_createargs * )((long)THIS->argp);
-		fhp = &argpcr3->fh;
-		break;
-	case 10: argpre = (struct nfsd_diropargs * )((long)THIS->argp);
-		fhp = &argpre->fh;
-		break;
-	case 11: argpre3 = (struct nfsd3_diropargs * )((long)THIS->argp);
-		fhp = &argpre3->fh;
-		break;
-	case 12: argpren = (struct nfsd_renameargs * )((long)THIS->argp);
-		fhp = &argpren->ffh;
-		break;
-	case 13: argpren = (struct nfsd_renameargs * )((long)THIS->argp);
-		fhp = &argpren->tfh;
-		break;
-	case 14: argpren3 = (struct nfsd3_renameargs * )((long)THIS->argp);
-		fhp = &argpren3->ffh;
-		break;
-	case 15: argpren3 = (struct nfsd3_renameargs * )((long)THIS->argp);
-		fhp = &argpren3->tfh;
-		break;
-	}
-	
-	THIS->__retvalue = (long)fhp;
-%}
 /*Get file handler from struct svc_fh */
 function __svc_fh:string(fh :long) %{  /* pure */
 	struct svc_fh * fhp = (struct svc_fh *) (long)(THIS->fh);
@@ -194,11 +121,13 @@ probe nfsd.proc.return = nfsd.proc.lookup.return,
 *  filelen  : the length of file name
 */
 probe nfsd.proc.lookup = nfsd.proc2.lookup,
-                         nfsd.proc3.lookup
+                         nfsd.proc3.lookup,
+                         nfsd.proc4.lookup
 {}
 
 probe nfsd.proc.lookup.return = nfsd.proc2.lookup.return,
-                         nfsd.proc3.lookup.return
+                         nfsd.proc3.lookup.return,
+                         nfsd.proc4.lookup.return
 {}
 
 probe nfsd.proc2.lookup = kernel.function("nfsd_proc_lookup") !,
@@ -207,7 +136,7 @@ probe nfsd.proc2.lookup = kernel.function("nfsd_proc_lookup") !,
 	client_ip = addr_from_rqst($rqstp)
 	proto = $rqstp->rq_prot
         version = 2
-	fh = __get_fh($argp,1)
+	fh = & @cast($argp, "nfsd_diropargs", "kernel:nfsd")->fh
 
 	filelen = $argp->len
 	filename = kernel_string_n($argp->name, filelen)
@@ -222,7 +151,7 @@ probe nfsd.proc2.lookup.return = kernel.function("nfsd_proc_lookup").return !,
 {
 	name = "nfsd.proc2.lookup.return"
 	version = 2
-	retstr = sprintf("%d",$return)
+	retstr = sprintf("%s", nfsderror($return))
 }
 
 probe nfsd.proc3.lookup = kernel.function("nfsd3_proc_lookup") !,
@@ -231,7 +160,7 @@ probe nfsd.proc3.lookup = kernel.function("nfsd3_proc_lookup") !,
 	client_ip = addr_from_rqst($rqstp)
 	proto = $rqstp->rq_prot
         version = 3
-	fh = __get_fh($argp,1)
+	fh = & @cast($argp, "nfsd_diropargs", "kernel:nfsd")->fh
 
 	filelen = $argp->len
 	filename  = kernel_string_n($argp->name, filelen)
@@ -245,9 +174,31 @@ probe nfsd.proc3.lookup.return = kernel.function("nfsd3_proc_lookup").return !,
 {
 	name = "nfsd.proc3.lookup.return"
 	version = 3
-	retstr = sprintf("%d",$return)
+	retstr = sprintf("%s", nfsderror($return))
 }
 
+probe nfsd.proc4.lookup = kernel.function("nfsd4_lookup") !,
+                          module("nfsd").function("nfsd4_lookup") ?
+{
+	client_ip = addr_from_rqst($rqstp)
+	proto = $rqstp->rq_prot
+	version = 4
+	fh = & @cast($cstate, "nfsd4_compound_state", "kernel:nfsd")->current_fh
+
+	filelen = $lookup->lo_len
+	filename  = kernel_string_n($lookup->lo_name, filelen)
+
+	name = "nfsd.proc4.lookup"
+	argstr = sprintf("%s",filename)
+} 
+
+probe nfsd.proc4.lookup.return = kernel.function("nfsd4_lookup").return !,
+                          module("nfsd").function("nfsd4_lookup").return ?
+{
+	name = "nfsd.proc4.lookup.return"
+	version = 4
+	retstr = sprintf("%s",nfsderror($return))
+}
 
 /*
 *probe nfsd.proc.read

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 03/10] Updated nfsd.proc.read probes
  2010-02-25 22:17 [PATCH 00/10] Update nfs tapset for nfs header changes, to use @cast instead of embedded-c Steve Dickson
  2010-02-25 22:18 ` [PATCH 01/10] Added new nfsderror() function Steve Dickson
  2010-02-25 22:20 ` [PATCH 02/10] Updated nfsd.proc.lookup probes Steve Dickson
@ 2010-02-25 22:21 ` Steve Dickson
  2010-02-25 22:22 ` [PATCH 04/10] Updated nfsd.proc.write probes Steve Dickson
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Steve Dickson @ 2010-02-25 22:21 UTC (permalink / raw)
  To: Systemtap Mailing list

commit adc1a13049227d3d1478030bdd48ce19cdfeff32
Author: Steve Dickson <steved@redhat.com>
Date:   Tue Feb 23 11:47:19 2010 -0500

    Updated nfsd.proc.read probes
    
    Converted the nfsd.proc.read probes to used
    the @cast() mechanism.
    
    Created the nfsd.proc4.read probes
    
    Signed-off-by: Steve Dickson <steved@redhat.com>

diff --git a/tapset/nfsd.stp b/tapset/nfsd.stp
index 92f682f..84f1c56 100644
--- a/tapset/nfsd.stp
+++ b/tapset/nfsd.stp
@@ -197,7 +197,7 @@ probe nfsd.proc4.lookup.return = kernel.function("nfsd4_lookup").return !,
 {
 	name = "nfsd.proc4.lookup.return"
 	version = 4
-	retstr = sprintf("%s",nfsderror($return))
+	retstr = sprintf("%s", nfsderror($return))
 }
 
 /*
@@ -217,11 +217,13 @@ probe nfsd.proc4.lookup.return = kernel.function("nfsd4_lookup").return !,
 *  vlen : read blocks 
 */
 probe nfsd.proc.read = nfsd.proc2.read,
-                       nfsd.proc3.read
+                       nfsd.proc3.read,
+                       nfsd.proc4.read
 {}
 
 probe nfsd.proc.read.return = nfsd.proc2.read.return,
-                       nfsd.proc3.read.return
+                       nfsd.proc3.read.return,
+                       nfsd.proc4.read.return
 {
 
 }
@@ -232,7 +234,7 @@ probe nfsd.proc2.read = kernel.function("nfsd_proc_read")!,
 	client_ip =  addr_from_rqst($rqstp)
 	proto = $rqstp->rq_prot
         version = 2
-	fh = __get_fh($argp,3)
+	fh = & @cast($argp, "nfsd_readargs", "kernel:nfsd")->fh
 
 	count = $argp->count 
 	offset = $argp->offset 
@@ -246,8 +248,8 @@ probe nfsd.proc2.read = kernel.function("nfsd_proc_read")!,
 	name = "nfsd.proc2.read"
 	argstr = sprintf("%d,%d",count,offset)
 
-        size = count
-        units = "bytes"
+	size = count
+	units = "bytes"
 }
 
  
@@ -256,7 +258,7 @@ probe nfsd.proc2.read.return = kernel.function("nfsd_proc_read").return!,
 {
 	name = "nfsd.proc2.read.return"
 	version = 2
-	retstr = sprintf("%d",$return)
+	retstr = sprintf("%s", nfsderror($return))
 }
 
 probe nfsd.proc3.read = kernel.function("nfsd3_proc_read")!,
@@ -264,8 +266,8 @@ probe nfsd.proc3.read = kernel.function("nfsd3_proc_read")!,
 {
 	client_ip =  addr_from_rqst($rqstp)
 	proto = $rqstp->rq_prot
-        version = 3
-	fh = __get_fh($argp,4)
+	version = 3
+	fh = & @cast($argp, "nfsd3_readargs", "kernel:nfsd")->fh
 
 	count = $argp->count 
 	offset = $argp->offset 
@@ -279,8 +281,8 @@ probe nfsd.proc3.read = kernel.function("nfsd3_proc_read")!,
 	name = "nfsd.proc3.read"
 	argstr = sprintf("%d,%d",count,offset)
 
-        size = count
-        units = "bytes"
+	size = count
+	units = "bytes"
 }
 
  
@@ -289,7 +291,34 @@ probe nfsd.proc3.read.return = kernel.function("nfsd3_proc_read").return!,
 {
 	name = "nfsd.proc3.read.return"
 	version = 3
-	retstr = sprintf("%d",$return)
+	retstr = sprintf("%s", nfsderror($return))
+}
+
+probe nfsd.proc4.read = kernel.function("nfsd4_read") !,
+                          module("nfsd").function("nfsd4_read") ?
+{
+	client_ip = addr_from_rqst($rqstp)
+	proto = $rqstp->rq_prot
+	version = 4
+	fh = & @cast($cstate, "nfsd4_compound_state", "kernel:nfsd")->current_fh
+
+	count = $read->rd_length
+	offset = $read->rd_offset
+	vec = $read->rd_vlen
+
+	name = "nfsd.proc4.read"
+	argstr = sprintf("%d,%d",count,offset)
+
+	size = count
+	units = "bytes"
+}
+
+probe nfsd.proc4.read.return = kernel.function("nfsd4_read").return!,
+                        module("nfsd").function("nfsd4_read").return?
+{
+	name = "nfsd.proc4.read.return"
+	version = 4
+	retstr = sprintf("%s", nfsderror($return))
 }
 
 /*

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 04/10]  Updated nfsd.proc.write probes
  2010-02-25 22:17 [PATCH 00/10] Update nfs tapset for nfs header changes, to use @cast instead of embedded-c Steve Dickson
                   ` (2 preceding siblings ...)
  2010-02-25 22:21 ` [PATCH 03/10] Updated nfsd.proc.read probes Steve Dickson
@ 2010-02-25 22:22 ` Steve Dickson
  2010-02-26 20:30   ` David Smith
  2010-02-25 22:23 ` [PATCH 05/10] Updated nfsd.proc.create probes Steve Dickson
                   ` (6 subsequent siblings)
  10 siblings, 1 reply; 21+ messages in thread
From: Steve Dickson @ 2010-02-25 22:22 UTC (permalink / raw)
  To: Systemtap Mailing list

commit 1a3da2a334dc24b2efb1d7f165fe81af2261524f
Author: Steve Dickson <steved@redhat.com>
Date:   Tue Feb 23 11:48:15 2010 -0500

    Updated nfsd.proc.write probes
    
    Converted the nfsd.proc.write probes to used
    the @cast() mechanism.
    
    Created the nfsd.proc4.write probes
    
    Signed-off-by: Steve Dickson <steved@redhat.com>

diff --git a/tapset/nfsd.stp b/tapset/nfsd.stp
index 84f1c56..b501773 100644
--- a/tapset/nfsd.stp
+++ b/tapset/nfsd.stp
@@ -224,9 +224,7 @@ probe nfsd.proc.read = nfsd.proc2.read,
 probe nfsd.proc.read.return = nfsd.proc2.read.return,
                        nfsd.proc3.read.return,
                        nfsd.proc4.read.return
-{
-
-}
+{}
 
 probe nfsd.proc2.read = kernel.function("nfsd_proc_read")!,
                         module("nfsd").function("nfsd_proc_read")?
@@ -339,14 +337,14 @@ probe nfsd.proc4.read.return = kernel.function("nfsd4_read").return!,
 *  stable : argp->stable(only in nfs.proc3.write)
 */
 probe nfsd.proc.write = nfsd.proc2.write,
-                       nfsd.proc3.write
+                        nfsd.proc3.write,
+                        nfsd.proc4.write
 {}
 
 probe nfsd.proc.write.return = nfsd.proc2.write.return,
-                       nfsd.proc3.write.return
-{
-
-}
+                       nfsd.proc3.write.return,
+                       nfsd.proc4.write.return
+{}
 
 probe nfsd.proc2.write = kernel.function("nfsd_proc_write")!,
                         module("nfsd").function("nfsd_proc_write")?
@@ -354,7 +352,7 @@ probe nfsd.proc2.write = kernel.function("nfsd_proc_write")!,
 	client_ip =  addr_from_rqst($rqstp)
 	proto = $rqstp->rq_prot
         version = 2
-	fh = __get_fh($argp,5)
+	fh = & @cast($argp, "nfsd_writeargs", "kernel:nfsd")->fh
 
 	count = $argp->len
 	offset = $argp->offset 
@@ -368,8 +366,8 @@ probe nfsd.proc2.write = kernel.function("nfsd_proc_write")!,
 	name = "nfsd.proc2.write"
 	argstr = sprintf("%d,%d",count,offset)
 
-        size = count
-        units = "bytes"
+	size = count
+	units = "bytes"
 }
 
  
@@ -378,7 +376,7 @@ probe nfsd.proc2.write.return = kernel.function("nfsd_proc_write").return!,
 {
 	name = "nfsd.proc2.write.return"
 	version = 2
-	retstr = sprintf("%d",$return)
+	retstr = sprintf("%s", nfsderror($return))
 }
 
 probe nfsd.proc3.write = kernel.function("nfsd3_proc_write")!,
@@ -387,7 +385,7 @@ probe nfsd.proc3.write = kernel.function("nfsd3_proc_write")!,
 	client_ip =  addr_from_rqst($rqstp)
 	proto = $rqstp->rq_prot
         version = 3
-	fh = __get_fh($argp,6)
+	fh = & @cast($argp, "nfsd3_writeargs", "kernel:nfsd")->fh
 
 	count = $argp->count 
 	offset = $argp->offset 
@@ -402,8 +400,8 @@ probe nfsd.proc3.write = kernel.function("nfsd3_proc_write")!,
 	name = "nfsd.proc3.write"
 	argstr = sprintf("%d,%d",count,offset)
 
-        size = count
-        units = "bytes"
+	size = count
+	units = "bytes"
 }
 
  
@@ -412,9 +410,40 @@ probe nfsd.proc3.write.return = kernel.function("nfsd3_proc_write").return!,
 {
 	name = "nfsd.proc3.write.return"
 	version = 3
-	retstr = sprintf("%d",$return)
+	retstr = sprintf("%s", nfsderror($return))
+	count = $resp->count
+	stable = $resp->committed
 }
 
+probe nfsd.proc4.write = kernel.function("nfsd4_write") !,
+                          module("nfsd").function("nfsd4_write") ?
+{
+	client_ip = addr_from_rqst($rqstp)
+	proto = $rqstp->rq_prot
+	version = 4
+	fh = & @cast($cstate, "nfsd4_compound_state", "kernel:nfsd")->current_fh
+	count = $write->wr_buflen
+	offset = $write->wr_offset
+	vlen = $write->wr_vlen
+	stable = $write->wr_stable_how
+
+	name = "nfsd.proc4.write"
+	argstr = sprintf("%d,%d",count,offset)
+
+	size = count
+	units = "bytes"
+} 
+
+probe nfsd.proc4.write.return = kernel.function("nfsd4_write").return!,
+                        module("nfsd").function("nfsd4_write").return?
+{
+	name = "nfsd.proc4.write.return"
+	version = 4
+	count = $write->wr_bytes_written
+	stable = $write->wr_how_written
+
+	retstr = sprintf("%s", nfsderror($return))
+}
 /*
 *probe nfsd.proc.commit
 *  Fires when client does a commit operation,which is
@@ -444,7 +473,7 @@ probe nfsd.proc3.commit = kernel.function("nfsd3_proc_commit")!,
 	client_ip =  addr_from_rqst($rqstp)
 	proto = $rqstp->rq_prot
         version = 3
-	fh = __get_fh($argp,7) 
+	fh = & @cast($argp, "struct nfsd3_commitargs", "kernel:nfsd")->fh
 
 	count = $argp->count 
 	offset = $argp->offset 
@@ -452,8 +481,8 @@ probe nfsd.proc3.commit = kernel.function("nfsd3_proc_commit")!,
 	name = "nfsd.proc3.commit"
 	argstr = sprintf("%d,%d",count,offset)
 
-        size = count
-        units = "bytes"
+	size = count
+	units = "bytes"
 }
 
 probe nfsd.proc3.commit.return = kernel.function("nfsd3_proc_commit").return!,
@@ -461,7 +490,32 @@ probe nfsd.proc3.commit.return = kernel.function("nfsd3_proc_commit").return!,
 {
 	name = "nfsd.proc3.commit.return"
 	version = 3
-	retstr = sprintf("%d",$return)
+	retstr = sprintf("%s", nfsderror($return))
+}
+
+probe nfsd.proc4.commit = kernel.function("nfsd4_commit") !,
+                          module("nfsd").function("nfsd4_commit") ?
+{
+	client_ip = addr_from_rqst($rqstp)
+	proto = $rqstp->rq_prot
+	version = 4
+	fh = & @cast($cstate, "nfsd4_compound_state", "kernel:nfsd")->current_fh
+	count = $commit->co_offset 
+	offset = $commit->co_offset 
+
+	name = "nfsd.proc4.commit"
+	argstr = sprintf("%d,%d",count,offset)
+
+	size = count
+	units = "bytes"
+} 
+
+probe nfsd.proc4.write.commit = kernel.function("nfsd4_commit").return!,
+                        module("nfsd").function("nfsd4_commit").return?
+{
+	name = "nfsd.proc4.commit.return"
+	version = 4
+	retstr = sprintf("%s", nfsderror($return))
 }
 
 /*

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 05/10] Updated nfsd.proc.create probes
  2010-02-25 22:17 [PATCH 00/10] Update nfs tapset for nfs header changes, to use @cast instead of embedded-c Steve Dickson
                   ` (3 preceding siblings ...)
  2010-02-25 22:22 ` [PATCH 04/10] Updated nfsd.proc.write probes Steve Dickson
@ 2010-02-25 22:23 ` Steve Dickson
  2010-03-01  3:29   ` Wenji Huang
  2010-02-25 22:24 ` [PATCH 06/10] Updated nfsd.proc.remove probes Steve Dickson
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 21+ messages in thread
From: Steve Dickson @ 2010-02-25 22:23 UTC (permalink / raw)
  To: Systemtap Mailing list

commit cc4f657eadf2a483d0d7803987a7ba71a4e78480
Author: Steve Dickson <steved@redhat.com>
Date:   Tue Feb 23 11:48:57 2010 -0500

    Updated nfsd.proc.create probes
    
    Converted the nfsd.proc.create probes to used
    the @cast() mechanism.
    
    Created the nfsd.proc4.create probes
    
    Signed-off-by: Steve Dickson <steved@redhat.com>

diff --git a/tapset/nfsd.stp b/tapset/nfsd.stp
index b501773..41263fb 100644
--- a/tapset/nfsd.stp
+++ b/tapset/nfsd.stp
@@ -10,6 +10,9 @@
 
 
 %{
+#include <linux/nfs3.h>
+#include <linux/nfs4.h>
+
 #include <linux/sunrpc/svc.h>
 %}
 
@@ -54,6 +57,65 @@ function p_long:long(cnt:long) %{ /* pure */
 	THIS->__retvalue = kread(count);
 	CATCH_DEREF_FAULT();
 %}
+
+function nfs3_cmode:string(cmode:long) %{ /* pure */
+	
+	switch (THIS->cmode) {
+	case NFS3_CREATE_UNCHECKED:
+		snprintf(THIS->__retvalue, MAXSTRINGLEN, "UNCHECKED");
+		break;
+	case NFS3_CREATE_GUARDED:
+		snprintf(THIS->__retvalue, MAXSTRINGLEN, "GUARDED");
+		break;
+	case NFS3_CREATE_EXCLUSIVE:
+		snprintf(THIS->__retvalue, MAXSTRINGLEN, "EXCLUSIVE");
+		break;
+	default: 
+		snprintf(THIS->__retvalue, MAXSTRINGLEN, "Bad Value(%lld)", 
+			THIS->cmode);
+	}
+	CATCH_DEREF_FAULT();
+%}
+
+function nfs4_ctype:string(cmode:long) %{ /* pure */
+	
+	switch (THIS->cmode) {
+	case NF4BAD:
+		snprintf(THIS->__retvalue, MAXSTRINGLEN, "NF4BAD");
+		break;
+	case NF4REG:
+		snprintf(THIS->__retvalue, MAXSTRINGLEN, "NF4REG");
+		break;
+	case NF4DIR:
+		snprintf(THIS->__retvalue, MAXSTRINGLEN, "NF4DIR");
+		break;
+	case NF4BLK:
+		snprintf(THIS->__retvalue, MAXSTRINGLEN, "NF4BLK");
+		break;
+	case NF4CHR:
+		snprintf(THIS->__retvalue, MAXSTRINGLEN, "NF4CHR");
+		break;
+	case NF4LNK:
+		snprintf(THIS->__retvalue, MAXSTRINGLEN, "NF4LNK");
+		break;
+	case NF4SOCK:
+		snprintf(THIS->__retvalue, MAXSTRINGLEN, "NF4SOCK");
+		break;
+	case NF4FIFO:
+		snprintf(THIS->__retvalue, MAXSTRINGLEN, "NF4FIFO");
+		break;
+	case NF4ATTRDIR:
+		snprintf(THIS->__retvalue, MAXSTRINGLEN, "NF4ATTRDIR");
+		break;
+	case NF4NAMEDATTR:
+		snprintf(THIS->__retvalue, MAXSTRINGLEN, "NF4ATTRDIR");
+		break;
+	default: 
+		snprintf(THIS->__retvalue, MAXSTRINGLEN, 
+			"Bad Value(%lld)", THIS->cmode);
+	}
+	CATCH_DEREF_FAULT();
+%}
 /*
 *probe nfsd.dispatch
 *  Fires when server receives a NFS operation from client 
@@ -531,10 +593,12 @@ probe nfsd.proc4.write.commit = kernel.function("nfsd4_commit").return!,
 *  filelen : length of file name
 */
 probe nfsd.proc.create = nfsd.proc2.create,
-                         nfsd.proc3.create
+                         nfsd.proc3.create,
+                         nfsd.proc4.create
 {}
 probe nfsd.proc.create.return = nfsd.proc2.create.return,
-                                nfsd.proc3.create.return
+                                nfsd.proc3.create.return,
+                                nfsd.proc4.create.return
 {}
 
 probe nfsd.proc2.create = kernel.function("nfsd_proc_create")!,
@@ -543,7 +607,7 @@ probe nfsd.proc2.create = kernel.function("nfsd_proc_create")!,
 	client_ip =  addr_from_rqst($rqstp)
 	proto = $rqstp->rq_prot
         version = 2
-	fh = __get_fh($argp,8)
+	fh = & @cast($argp, "struct nfsd_createargs", "kernel:nfsd")->fh
 
 	filelen = $argp->len
 	filename  = kernel_string_n($argp->name, filelen)
@@ -557,7 +621,7 @@ probe nfsd.proc2.create.return =  kernel.function("nfsd_proc_create").return!,
 {
 	name = "nfsd.proc2.create.return"
 	version = 2
-	retstr = sprintf("%d",$return)
+	retstr = sprintf("%s", nfsderror($return))
 }
 
 probe nfsd.proc3.create = kernel.function("nfsd3_proc_create")!,
@@ -565,14 +629,15 @@ probe nfsd.proc3.create = kernel.function("nfsd3_proc_create")!,
 {
 	client_ip =  addr_from_rqst($rqstp)
 	proto = $rqstp->rq_prot
-        version = 3
-	fh = __get_fh($argp,9)
+	version = 3
+	fh = & @cast($argp, "struct nfsd_createargs", "kernel:nfsd")->fh
 
 	filelen = $argp->len
 	filename  = kernel_string_n($argp->name, filelen)
+	createmode = $argp->createmode
 	
 	name = "nfsd.proc3.create"
-	argstr = sprintf("%s",filename)
+	argstr = sprintf("%s (mode=%s)",filename, nfs3_cmode(createmode))
 }
 
 probe nfsd.proc3.create.return =  kernel.function("nfsd3_proc_create").return!,
@@ -580,7 +645,31 @@ probe nfsd.proc3.create.return =  kernel.function("nfsd3_proc_create").return!,
 {
 	name = "nfsd.proc3.create.return"
 	version = 3
-	retstr = sprintf("%d",$return)
+	retstr = sprintf("%s", nfsderror($return))
+}
+
+probe nfsd.proc4.create = kernel.function("nfsd4_create") !,
+                          module("nfsd").function("nfsd4_create") ?
+{
+	client_ip = addr_from_rqst($rqstp)
+	proto = $rqstp->rq_prot
+	version = 4
+	fh = & @cast($cstate, "nfsd4_compound_state", "kernel:nfsd")->current_fh
+	filelen = $create->cr_namelen
+	filename  = kernel_string_n($create->cr_name, filelen)
+	createmode = $create->cr_type
+
+	name = "nfsd.proc4.create"
+	argstr = sprintf("%s (type=%s)",filename, nfs4_ctype(createmode))
+
+} 
+
+probe nfsd.proc4.write.create = kernel.function("nfsd4_create").return!,
+                        module("nfsd").function("nfsd4_create").return?
+{
+	name = "nfsd.proc4.create.return"
+	version = 4
+	retstr = sprintf("%s", nfsderror($return))
 }
 
 /*

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 06/10]  Updated nfsd.proc.remove probes
  2010-02-25 22:17 [PATCH 00/10] Update nfs tapset for nfs header changes, to use @cast instead of embedded-c Steve Dickson
                   ` (4 preceding siblings ...)
  2010-02-25 22:23 ` [PATCH 05/10] Updated nfsd.proc.create probes Steve Dickson
@ 2010-02-25 22:24 ` Steve Dickson
  2010-02-26 20:43   ` David Smith
  2010-02-25 22:26 ` [PATCH 07/10] " Steve Dickson
                   ` (4 subsequent siblings)
  10 siblings, 1 reply; 21+ messages in thread
From: Steve Dickson @ 2010-02-25 22:24 UTC (permalink / raw)
  To: Systemtap Mailing list

commit fcf7dae52ee72113082eb81c4b72b350b6408e00
Author: Steve Dickson <steved@redhat.com>
Date:   Tue Feb 23 11:50:38 2010 -0500

    Updated nfsd.proc.remove probes
    
    Converted the nfsd.proc.remove probes to used
    the @cast() mechanism.
    
    Created the nfsd.proc4.remove probes
    
    Signed-off-by: Steve Dickson <steved@redhat.com>

diff --git a/tapset/nfsd.stp b/tapset/nfsd.stp
index 41263fb..9726de0 100644
--- a/tapset/nfsd.stp
+++ b/tapset/nfsd.stp
@@ -685,10 +685,12 @@ probe nfsd.proc4.write.create = kernel.function("nfsd4_create").return!,
 *  filelen : length of file name
 */
 probe nfsd.proc.remove = nfsd.proc2.remove,
-                         nfsd.proc3.remove
+                         nfsd.proc3.remove,
+                         nfsd.proc4.remove
 {}
 probe nfsd.proc.remove.return = nfsd.proc2.remove.return,
-                                nfsd.proc3.remove.return
+                                nfsd.proc3.remove.return,
+                                nfsd.proc4.remove.return
 {}
 
 probe nfsd.proc2.remove = kernel.function("nfsd_proc_remove")!,
@@ -697,7 +699,7 @@ probe nfsd.proc2.remove = kernel.function("nfsd_proc_remove")!,
 	client_ip =  addr_from_rqst($rqstp)
 	proto = $rqstp->rq_prot
         version = 2
-	fh = __get_fh($argp,10)
+	fh = & @cast($argp, "struct nfsd_diropargs", "kernel:nfsd")->fh
 
 	filelen = $argp->len
 	filename  = kernel_string_n($argp->name, filelen)
@@ -711,7 +713,7 @@ probe nfsd.proc2.remove.return =  kernel.function("nfsd_proc_remove").return!,
 {
 	name = "nfsd.proc2.remove.return"
 	version = 2
-	retstr = sprintf("%d",$return)
+	retstr = sprintf("%s", nfsderror($return))
 }
 
 probe nfsd.proc3.remove = kernel.function("nfsd3_proc_remove")!,
@@ -719,8 +721,8 @@ probe nfsd.proc3.remove = kernel.function("nfsd3_proc_remove")!,
 {
 	client_ip =  addr_from_rqst($rqstp)
 	proto = $rqstp->rq_prot
-        version = 3
-	fh = __get_fh($argp,11)
+	version = 3
+	fh = & @cast($argp, "struct nfsd3_diropargs", "kernel:nfsd")->fh
 
 	filelen = $argp->len
 	filename  = kernel_string_n($argp->name, filelen)
@@ -734,9 +736,31 @@ probe nfsd.proc3.remove.return =  kernel.function("nfsd3_proc_remove").return!,
 {
 	name = "nfsd.proc3.remove.return"
 	version = 3
-	retstr = sprintf("%d",$return)
+	retstr = sprintf("%s", nfsderror($return))
 }
 
+probe nfsd.proc4.remove = kernel.function("nfsd4_remove") !,
+                          module("nfsd").function("nfsd4_remove") ?
+{
+	client_ip = addr_from_rqst($rqstp)
+	proto = $rqstp->rq_prot
+	version = 4
+	fh = & @cast($cstate, "nfsd4_compound_state", "kernel:nfsd")->current_fh
+	filelen = $remove->rm_namelen
+	filename  = kernel_string_n($remove->rm_name, filelen)
+
+	name = "nfsd.proc4.remove"
+	argstr = sprintf("%s", filename);
+
+} 
+
+probe nfsd.proc4.remove.return = kernel.function("nfsd4_remove").return!,
+                        module("nfsd").function("nfsd4_remove").return?
+{
+	name = "nfsd.proc4.remove.return"
+	version = 4
+	retstr = sprintf("%s", nfsderror($return))
+}
 /*
 * probe nfsd.proc.rename
 *  Fires when clients rename a file on server side

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 07/10]  Updated nfsd.proc.remove probes
  2010-02-25 22:17 [PATCH 00/10] Update nfs tapset for nfs header changes, to use @cast instead of embedded-c Steve Dickson
                   ` (5 preceding siblings ...)
  2010-02-25 22:24 ` [PATCH 06/10] Updated nfsd.proc.remove probes Steve Dickson
@ 2010-02-25 22:26 ` Steve Dickson
  2010-02-25 22:27 ` [PATCH 08/10] Removed the nfsd.proc4.compound and nfsd.proc.compound.return probes Steve Dickson
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Steve Dickson @ 2010-02-25 22:26 UTC (permalink / raw)
  To: Systemtap Mailing list

commit 99e6b6a1744de4b3f8ceefd255c656a5e61a5ac7
Author: Steve Dickson <steved@redhat.com>
Date:   Tue Feb 23 11:51:19 2010 -0500

    Updated nfsd.proc.remove probes
    
    Converted the nfsd.proc.remove probes to used
    the @cast() mechanism.
    
    Created the nfsd.proc4.remove probes
    
    Signed-off-by: Steve Dickson <steved@redhat.com>

diff --git a/tapset/nfsd.stp b/tapset/nfsd.stp
index 9726de0..25d8c55 100644
--- a/tapset/nfsd.stp
+++ b/tapset/nfsd.stp
@@ -774,11 +774,13 @@ probe nfsd.proc4.remove.return = kernel.function("nfsd4_remove").return!,
 *   tlen : length of new file name
 */
 probe nfsd.proc.rename = nfsd.proc2.rename,
-                         nfsd.proc3.rename
+                         nfsd.proc3.rename,
+                         nfsd.proc4.rename
 {}
 
 probe nfsd.proc.rename.return = nfsd.proc2.rename.return,
-                         nfsd.proc3.rename.return
+                         nfsd.proc3.rename.return,
+                         nfsd.proc4.rename.return
 {}
 
 probe nfsd.proc2.rename =  kernel.function("nfsd_proc_rename")!,
@@ -786,9 +788,9 @@ probe nfsd.proc2.rename =  kernel.function("nfsd_proc_rename")!,
 {
 	client_ip =  addr_from_rqst($rqstp)
 	proto = $rqstp->rq_prot
-        version = 2
-	fh = __get_fh($argp,12)
-	tfh = __get_fh($argp,13)
+	version = 2
+	fh = & @cast($argp, "struct nfsd_renameargs", "kernel:nfsd")->ffh
+	tfh = & @cast($argp, "struct nfsd_renameargs", "kernel:nfsd")->tfh
 
 	filelen = $argp->flen
 	filename  = kernel_string_n($argp->fname, filelen)	
@@ -796,7 +798,7 @@ probe nfsd.proc2.rename =  kernel.function("nfsd_proc_rename")!,
 	tname = kernel_string_n($argp->tname, tlen)
 
 	name = "nfsd.proc2.rename"
-	argstr = sprintf("%s,%s",filename,tname)
+	argstr = sprintf("%s to %s",filename,tname)
 }
 
 probe nfsd.proc2.rename.return =  kernel.function("nfsd_proc_rename").return!,
@@ -804,7 +806,7 @@ probe nfsd.proc2.rename.return =  kernel.function("nfsd_proc_rename").return!,
 {
 	name = "nfsd.proc2.rename.return"
 	version = 2
-	retstr = sprintf("%d",$return)
+	retstr = sprintf("%s", nfsderror($return))
 }
 
 probe nfsd.proc3.rename =  kernel.function("nfsd3_proc_rename")!,
@@ -812,9 +814,9 @@ probe nfsd.proc3.rename =  kernel.function("nfsd3_proc_rename")!,
 {
 	client_ip =  addr_from_rqst($rqstp)
 	proto = $rqstp->rq_prot
-        version = 3
-	fh = __get_fh($argp,14)
-	tfh = __get_fh($argp,15)
+	version = 3
+	fh = & @cast($argp, "struct nfsd3_renameargs", "kernel:nfsd")->ffh
+	tfh = & @cast($argp, "struct nfsd3_renameargs", "kernel:nfsd")->tfh
 
 	filelen = $argp->flen
 	filename  = kernel_string_n($argp->fname, filelen)	
@@ -822,7 +824,7 @@ probe nfsd.proc3.rename =  kernel.function("nfsd3_proc_rename")!,
 	tname = kernel_string_n($argp->tname, tlen)
 
 	name = "nfsd.proc3.rename"
-	argstr = sprintf("%s,%s",filename,tname)
+	argstr = sprintf("%s to %s",filename,tname)
 }
 
 probe nfsd.proc3.rename.return =  kernel.function("nfsd3_proc_rename").return!,
@@ -832,6 +834,32 @@ probe nfsd.proc3.rename.return =  kernel.function("nfsd3_proc_rename").return!,
 	version = 3
 	retstr = sprintf("%d",$return)
 }
+
+probe nfsd.proc4.rename = kernel.function("nfsd4_rename") !,
+                          module("nfsd").function("nfsd4_rename") ?
+{
+	client_ip = addr_from_rqst($rqstp)
+	proto = $rqstp->rq_prot
+	version = 4
+	fh = & @cast($cstate, "nfsd4_compound_state", "kernel:nfsd")->save_fh
+	tfh = & @cast($argp, "struct nfsd3_renameargs", "kernel:nfsd")->current_fh
+
+	filelen = $rename->rn_snamelen
+	filename  = kernel_string_n($rename->rn_sname, filelen)	
+	tlen = $rename->rn_tnamelen
+	tname = kernel_string_n($rename->rn_tname, tlen)
+
+	name = "nfsd.proc4.rename"
+	argstr = sprintf("%s to %s",filename,tname)
+} 
+
+probe nfsd.proc4.rename.return = kernel.function("nfsd4_rename").return!,
+                        module("nfsd").function("nfsd4_rename").return?
+{
+	name = "nfsd.proc4.rename.return"
+	version = 4
+	retstr = sprintf("%s", nfsderror($return))
+}
 /*
 *probe nfsd.proc.compound
 *   Fires when the server received a NFSV4 operation from client

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 08/10]  Removed the nfsd.proc4.compound and nfsd.proc.compound.return  probes
  2010-02-25 22:17 [PATCH 00/10] Update nfs tapset for nfs header changes, to use @cast instead of embedded-c Steve Dickson
                   ` (6 preceding siblings ...)
  2010-02-25 22:26 ` [PATCH 07/10] " Steve Dickson
@ 2010-02-25 22:27 ` Steve Dickson
  2010-02-26 20:47   ` David Smith
  2010-02-25 22:28 ` [PATCH 09/10] General clean up on the upper level probes Steve Dickson
                   ` (2 subsequent siblings)
  10 siblings, 1 reply; 21+ messages in thread
From: Steve Dickson @ 2010-02-25 22:27 UTC (permalink / raw)
  To: Systemtap Mailing list

commit 9d906571f71dfcd7d22eec4e06d5a06b9f86805a
Author: Steve Dickson <steved@redhat.com>
Date:   Tue Feb 23 11:52:17 2010 -0500

    Removed the nfsd.proc4.compound and nfsd.proc.compound.return probes
    
    Either probes displayed anything that was useful, plus
    there are other ways to display similar information.
    
    Signed-off-by: Steve Dickson <steved@redhat.com>

diff --git a/tapset/nfsd.stp b/tapset/nfsd.stp
index 25d8c55..3e518c5 100644
--- a/tapset/nfsd.stp
+++ b/tapset/nfsd.stp
@@ -860,44 +860,6 @@ probe nfsd.proc4.rename.return = kernel.function("nfsd4_rename").return!,
 	version = 4
 	retstr = sprintf("%s", nfsderror($return))
 }
-/*
-*probe nfsd.proc.compound
-*   Fires when the server received a NFSV4 operation from client
-*
-*Arguments:
-*  client_ip : the ip address of client
-*  proto : transfer protocol
-*  version : nfs version
-*  num : number of file operation in this RPC operation 
-*  op : head of operation list in this compound execution
-*/
-probe nfsd.proc.compound = nfsd.proc4.compound
-{}
-
-probe nfsd.proc.compound.return = nfsd.proc4.compound.return
-{}
-
-probe nfsd.proc4.compound = kernel.function("nfsd4_proc_compound")!,
-                            module("nfsd").function("nfsd4_proc_compound")?
-{
-	client_ip =  addr_from_rqst($rqstp)
-	proto = $rqstp->rq_prot
-        version = 4
-
-	num = $args->opcnt
-	op = $args->ops
-	
-	name = "nfsd.proc4.compound"
-	argstr = sprintf("%d",num)
-}
-
-probe nfsd.proc4.compound.return = kernel.function("nfsd4_proc_compound").return!,
-                            module("nfsd").function("nfsd4_proc_compound").return?
-{
-	name = "nfsd.proc4.compound.return"
-	version = 4
-	retstr = sprintf("%d",$return)
-}
 
 probe nfsd.entries = nfsd.open,
 	             nfsd.read,

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 09/10]  General clean up on the upper level probes
  2010-02-25 22:17 [PATCH 00/10] Update nfs tapset for nfs header changes, to use @cast instead of embedded-c Steve Dickson
                   ` (7 preceding siblings ...)
  2010-02-25 22:27 ` [PATCH 08/10] Removed the nfsd.proc4.compound and nfsd.proc.compound.return probes Steve Dickson
@ 2010-02-25 22:28 ` Steve Dickson
  2010-02-25 22:29 ` [PATCH 10/10] Allow better filtering with IP address and File handle Steve Dickson
  2010-02-25 22:32 ` [PATCH 00/10] Update nfs tapset for nfs header changes, to use @cast instead of embedded-c Steve Dickson
  10 siblings, 0 replies; 21+ messages in thread
From: Steve Dickson @ 2010-02-25 22:28 UTC (permalink / raw)
  To: Systemtap Mailing list

commit 0c5c7a83eb9bb1fbb994970d5da7d1e638a90f67
Author: Steve Dickson <steved@redhat.com>
Date:   Tue Feb 23 11:56:15 2010 -0500

    General clean up on the upper level probes
    
    Added the ftype() function which converts file types
    into character strings
    
    Added calls nfsderror() to the return probes that will display
    errors in character strings
    
    Signed-off-by: Steve Dickson <steved@redhat.com>

diff --git a/tapset/nfsd.stp b/tapset/nfsd.stp
index 3e518c5..f270d3a 100644
--- a/tapset/nfsd.stp
+++ b/tapset/nfsd.stp
@@ -10,10 +10,14 @@
 
 
 %{
+#include <linux/stat.h>
+
+#include <linux/nfsd/nfsfh.h>
 #include <linux/nfs3.h>
 #include <linux/nfs4.h>
 
 #include <linux/sunrpc/svc.h>
+
 %}
 
 /*
@@ -116,6 +120,34 @@ function nfs4_ctype:string(cmode:long) %{ /* pure */
 	}
 	CATCH_DEREF_FAULT();
 %}
+function ftype:string(type:long) %{ /* pure */
+
+	if (S_ISLNK(THIS->type)) {
+		snprintf(THIS->__retvalue, MAXSTRINGLEN, 
+			"0%llo (ISLNK)", THIS->type);
+	} else if (S_ISREG(THIS->type)) {
+		snprintf(THIS->__retvalue, MAXSTRINGLEN, 
+			"0%llo (ISREG)", THIS->type);
+	} else if (S_ISDIR(THIS->type)) {
+		snprintf(THIS->__retvalue, MAXSTRINGLEN, 
+			"0%llo (ISDIR)", THIS->type);
+	} else if (S_ISCHR(THIS->type)) {
+		snprintf(THIS->__retvalue, MAXSTRINGLEN, 
+			"0%llo (ISCHR)", THIS->type);
+	} else if (S_ISBLK(THIS->type)) {
+		snprintf(THIS->__retvalue, MAXSTRINGLEN, 
+			"0%llo (ISBLK)", THIS->type);
+	} else if (S_ISFIFO(THIS->type)) {
+		snprintf(THIS->__retvalue, MAXSTRINGLEN, 
+			"0%llo (ISFIFO)", THIS->type);
+	} else if (S_ISSOCK(THIS->type)) {
+		snprintf(THIS->__retvalue, MAXSTRINGLEN, 
+			"0%llo (ISSOCK)", THIS->type);
+	} else  {
+		snprintf(THIS->__retvalue, MAXSTRINGLEN, 
+			"0%llo (Uknown)", THIS->type);
+	}
+%}
 /*
 *probe nfsd.dispatch
 *  Fires when server receives a NFS operation from client 
@@ -157,7 +189,7 @@ probe nfsd.proc.entries = nfsd.proc.lookup,
                           nfsd.proc.compound,
                           nfsd.proc.remove,
                           nfsd.proc.rename,
-			  nfsd.proc.create
+			              nfsd.proc.create
 {} 
 
 probe nfsd.proc.return = nfsd.proc.lookup.return,
@@ -832,7 +864,7 @@ probe nfsd.proc3.rename.return =  kernel.function("nfsd3_proc_rename").return!,
 {
 	name = "nfsd.proc3.rename.return"
 	version = 3
-	retstr = sprintf("%d",$return)
+	retstr = sprintf("%s", nfsderror($return))
 }
 
 probe nfsd.proc4.rename = kernel.function("nfsd4_rename") !,
@@ -862,7 +894,7 @@ probe nfsd.proc4.rename.return = kernel.function("nfsd4_rename").return!,
 }
 
 probe nfsd.entries = nfsd.open,
-	             nfsd.read,
+	                 nfsd.read,
                      nfsd.write,
                      nfsd.lookup,
                      nfsd.commit,
@@ -874,7 +906,7 @@ probe nfsd.entries = nfsd.open,
 {}
 
 probe nfsd.return = nfsd.open.return,
-	             nfsd.read.return,
+	                 nfsd.read.return,
                      nfsd.write.return,
                      nfsd.lookup.return,
                      nfsd.commit.return,
@@ -900,14 +932,16 @@ probe nfsd.open = kernel.function("nfsd_open") !,
 	type = $type
 
 	name = "nfsd.open"
-	argstr = sprintf("%d",access)
+	argstr = sprintf("access: %d type: %s", access, ftype(type))
 }
 
 probe nfsd.open.return = kernel.function("nfsd_open").return !,
                   module("nfsd").function("nfsd_open").return?
 {
+	fh = __svc_fh($fhp)
+
 	name = "nfsd.open.return"
-	retstr = sprintf("%d",$return)
+	retstr = sprintf("%s", nfsderror($return))
 }
 
 /*probe nfsd.close
@@ -955,7 +989,7 @@ probe nfsd.read = kernel.function("nfsd_read") !,
 	vlen = $vlen
 
 	name = "nfsd.read"
-	argstr = sprintf("%d,%d",count,offset)
+	argstr = sprintf("count: %d offset: %d",count,offset)
 
 	size = count
 	units = "bytes"
@@ -964,8 +998,10 @@ probe nfsd.read = kernel.function("nfsd_read") !,
 probe nfsd.read.return = kernel.function("nfsd_read").return !,
                   module("nfsd").function("nfsd_read").return?
 {
+	fh = __svc_fh($fhp)
+
 	name = "nfsd.read.return"
-	retstr = sprintf("%d",$return)
+	retstr = sprintf("%s", nfsderror($return))
 }
 
 /*probe nfsd.write
@@ -989,13 +1025,13 @@ probe nfsd.write = kernel.function("nfsd_write")!,
 %( kernel_v >= "2.6.12" %?
 	file = $file
 %)
-	count = $cnt
+	count = p_long($cnt)
 	offset = $offset
 	vec = $vec
 	vlen = $vlen
 
 	name = "nfsd.write"
-	argstr = sprintf("%d,%d",count,offset)
+	argstr = sprintf("count: %d  offset: %d",count,offset)
 
 	size = count
 	units = "bytes"
@@ -1004,8 +1040,10 @@ probe nfsd.write = kernel.function("nfsd_write")!,
 probe nfsd.write.return = kernel.function("nfsd_write").return!,
                    module("nfsd").function("nfsd_write").return?
 {
+	fh = __svc_fh($fhp)
+
 	name = "nfsd.write.return"
-	retstr = sprintf("%d",$return)
+	retstr = sprintf("%s", nfsderror($return))
 }
 
 /*probe nfsd.commit
@@ -1028,7 +1066,7 @@ probe nfsd.commit = kernel.function("nfsd_commit")!,
 	flag = $fhp->fh_export->ex_flags
 
 	name = "nfsd.commit"
-	argstr = sprintf("%d,%d",count,offset)
+	argstr = sprintf("count: %d offset: %d",count,offset)
 
 	size = count 
 	units = "bytes"
@@ -1037,8 +1075,10 @@ probe nfsd.commit = kernel.function("nfsd_commit")!,
 probe nfsd.commit.return = kernel.function("nfsd_commit").return!,
                     module("nfsd").function("nfsd_commit").return ?
 {
+	fh = __svc_fh($fhp)
+
 	name = "nfsd.commit.return"
-	retstr = sprintf("%d",$return)
+	retstr = sprintf("%s", nfsderror($return))
 }
 
 /*
@@ -1060,14 +1100,16 @@ probe nfsd.lookup = kernel.function("nfsd_lookup")!,
 	filename = kernel_string_n($name, filelen)
 
 	name = "nfsd.lookup"
-	argstr = sprintf("%s",filename)
+	argstr = sprintf("name: %s",filename)
 }
 
 probe nfsd.lookup.return = kernel.function("nfsd_lookup").return!,
                             module("nfsd").function("nfsd_lookup").return?
 {
+	fh = __svc_fh($fhp)
+
 	name = "nfsd.lookup.return"
-	retstr = sprintf("%d",$return)
+	retstr = sprintf("%s", nfsderror($return))
 }
 /*
 * probe nfsd.create
@@ -1095,14 +1137,16 @@ probe nfsd.create = kernel.function("nfsd_create")!,
 	iap_mode = $iap->ia_mode
 
 	name = "nfsd.create"
-	argstr = sprintf("%s,%d",filename,type)
+	argstr = sprintf("name: %s type: %s",filename, ftype(type))
 }
 
 probe nfsd.create.return = kernel.function("nfsd_create").return!,         
                     module("nfsd").function("nfsd_create").return?
 {
+	fh = __svc_fh($fhp)
+
 	name = "nfsd.create.return"
-	retstr = sprintf("%d",$return)
+	retstr = sprintf("%s", nfsderror($return))
 }
 
 /*
@@ -1137,14 +1181,14 @@ probe nfsd.createv3 = kernel.function("nfsd_create_v3")!,
 	createmode = $createmode
 
 	name = "nfsd.createv3"
-	argstr = sprintf("%s,%d",filename,createmode)
+	argstr = sprintf("name: %s mode: %s",filename, nfs3_cmode(createmode))
 }
 
 probe nfsd.createv3.return = kernel.function("nfsd_create_v3").return!,         
                     module("nfsd").function("nfsd_create_v3").return?
 {
 	name = "nfsd.createv3.return"
-	retstr = sprintf("%d",$return)
+	retstr = sprintf("%s", nfsderror($return))
 }
 
 /*
@@ -1168,14 +1212,14 @@ probe nfsd.unlink = kernel.function("nfsd_unlink")!,
 	type = $type
 
 	name = "nfsd.unlink"
-	argstr = sprintf("%s,%d",filename,type)
+	argstr = sprintf("name: %s",filename);
 }
 
 probe nfsd.unlink.return = kernel.function("nfsd_unlink").return!,         
                     module("nfsd").function("nfsd_unlink").return?
 {
 	name = "nfsd.unlink.return"
-	retstr = sprintf("%d",$return)
+	retstr = sprintf("%s", nfsderror($return))
 }
 
 /*
@@ -1203,12 +1247,12 @@ probe nfsd.rename =  kernel.function("nfsd_rename")!,
 	tname = kernel_string_n($tname, tlen)
 
 	name = "nfsd.rename"
-	argstr = sprintf("%s,%s",filename,tname)
+	argstr = sprintf("%s to %s",filename,tname)
 }
 
 probe nfsd.rename.return =  kernel.function("nfsd_rename").return!,
                            module("nfsd").function("nfsd_rename").return?
 {
 	name = "nfsd.rename.return"
-	retstr = sprintf("%d",$return)
+	retstr = sprintf("%s", nfsderror($return))
 }

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 10/10]  Allow better filtering with IP address and File handle
  2010-02-25 22:17 [PATCH 00/10] Update nfs tapset for nfs header changes, to use @cast instead of embedded-c Steve Dickson
                   ` (8 preceding siblings ...)
  2010-02-25 22:28 ` [PATCH 09/10] General clean up on the upper level probes Steve Dickson
@ 2010-02-25 22:29 ` Steve Dickson
  2010-02-25 22:32 ` [PATCH 00/10] Update nfs tapset for nfs header changes, to use @cast instead of embedded-c Steve Dickson
  10 siblings, 0 replies; 21+ messages in thread
From: Steve Dickson @ 2010-02-25 22:29 UTC (permalink / raw)
  To: Systemtap Mailing list

commit 6be80943cc84cdb08c51f528aec5b59a9fdb3d30
Author: Steve Dickson <steved@redhat.com>
Date:   Tue Feb 23 11:58:16 2010 -0500

    Allow better filtering with IP address and File handle
    
    To allow filtering by the client's IP address,
    the addr_from_rqst_str() function was added which
    extracts the IP address from incoming procedures
    and converts them into a character string. Calls to
    addr_from_rqst_str() were added to the top of each
    probe so callers of the probes can use the IP addresses
    as a filter.
    
    Calls to __svc_fh() were also sprinkled were needed
    so callers can also filter on file handles
    
    Signed-off-by: Steve Dickson <steved@redhat.com>

diff --git a/tapset/nfsd.stp b/tapset/nfsd.stp
index f270d3a..823734a 100644
--- a/tapset/nfsd.stp
+++ b/tapset/nfsd.stp
@@ -163,7 +163,7 @@ function ftype:string(type:long) %{ /* pure */
 probe nfsd.dispatch = kernel.function("nfsd_dispatch")!,
                       module("nfsd").function("nfsd_dispatch") ?
 {
-	client_ip = addr_from_rqst($rqstp)
+	client_ip = addr_from_rqst_str($rqstp)
 	proto = $rqstp->rq_prot
 	version = $rqstp->rq_vers
 
@@ -227,9 +227,9 @@ probe nfsd.proc.lookup.return = nfsd.proc2.lookup.return,
 probe nfsd.proc2.lookup = kernel.function("nfsd_proc_lookup") !,
                           module("nfsd").function("nfsd_proc_lookup") ?
 {
-	client_ip = addr_from_rqst($rqstp)
+	client_ip = addr_from_rqst_str($rqstp)
 	proto = $rqstp->rq_prot
-        version = 2
+	version = 2
 	fh = & @cast($argp, "nfsd_diropargs", "kernel:nfsd")->fh
 
 	filelen = $argp->len
@@ -243,6 +243,8 @@ probe nfsd.proc2.lookup = kernel.function("nfsd_proc_lookup") !,
 probe nfsd.proc2.lookup.return = kernel.function("nfsd_proc_lookup").return !,
                           module("nfsd").function("nfsd_proc_lookup").return ?
 {
+	client_ip = addr_from_rqst_str($rqstp)
+
 	name = "nfsd.proc2.lookup.return"
 	version = 2
 	retstr = sprintf("%s", nfsderror($return))
@@ -251,7 +253,7 @@ probe nfsd.proc2.lookup.return = kernel.function("nfsd_proc_lookup").return !,
 probe nfsd.proc3.lookup = kernel.function("nfsd3_proc_lookup") !,
                           module("nfsd").function("nfsd3_proc_lookup") ?
 {
-	client_ip = addr_from_rqst($rqstp)
+	client_ip = addr_from_rqst_str($rqstp)
 	proto = $rqstp->rq_prot
         version = 3
 	fh = & @cast($argp, "nfsd_diropargs", "kernel:nfsd")->fh
@@ -266,6 +268,8 @@ probe nfsd.proc3.lookup = kernel.function("nfsd3_proc_lookup") !,
 probe nfsd.proc3.lookup.return = kernel.function("nfsd3_proc_lookup").return !,
                           module("nfsd").function("nfsd3_proc_lookup").return ?
 {
+	client_ip = addr_from_rqst_str($rqstp)
+
 	name = "nfsd.proc3.lookup.return"
 	version = 3
 	retstr = sprintf("%s", nfsderror($return))
@@ -274,7 +278,7 @@ probe nfsd.proc3.lookup.return = kernel.function("nfsd3_proc_lookup").return !,
 probe nfsd.proc4.lookup = kernel.function("nfsd4_lookup") !,
                           module("nfsd").function("nfsd4_lookup") ?
 {
-	client_ip = addr_from_rqst($rqstp)
+	client_ip = addr_from_rqst_str($rqstp)
 	proto = $rqstp->rq_prot
 	version = 4
 	fh = & @cast($cstate, "nfsd4_compound_state", "kernel:nfsd")->current_fh
@@ -289,6 +293,8 @@ probe nfsd.proc4.lookup = kernel.function("nfsd4_lookup") !,
 probe nfsd.proc4.lookup.return = kernel.function("nfsd4_lookup").return !,
                           module("nfsd").function("nfsd4_lookup").return ?
 {
+	client_ip = addr_from_rqst_str($rqstp)
+
 	name = "nfsd.proc4.lookup.return"
 	version = 4
 	retstr = sprintf("%s", nfsderror($return))
@@ -323,7 +329,7 @@ probe nfsd.proc.read.return = nfsd.proc2.read.return,
 probe nfsd.proc2.read = kernel.function("nfsd_proc_read")!,
                         module("nfsd").function("nfsd_proc_read")?
 {
-	client_ip =  addr_from_rqst($rqstp)
+	client_ip =  addr_from_rqst_str($rqstp)
 	proto = $rqstp->rq_prot
         version = 2
 	fh = & @cast($argp, "nfsd_readargs", "kernel:nfsd")->fh
@@ -348,6 +354,8 @@ probe nfsd.proc2.read = kernel.function("nfsd_proc_read")!,
 probe nfsd.proc2.read.return = kernel.function("nfsd_proc_read").return!,
                         module("nfsd").function("nfsd_proc_read").return?
 {
+	client_ip = addr_from_rqst_str($rqstp)
+
 	name = "nfsd.proc2.read.return"
 	version = 2
 	retstr = sprintf("%s", nfsderror($return))
@@ -356,7 +364,7 @@ probe nfsd.proc2.read.return = kernel.function("nfsd_proc_read").return!,
 probe nfsd.proc3.read = kernel.function("nfsd3_proc_read")!,
                         module("nfsd").function("nfsd3_proc_read")?
 {
-	client_ip =  addr_from_rqst($rqstp)
+	client_ip =  addr_from_rqst_str($rqstp)
 	proto = $rqstp->rq_prot
 	version = 3
 	fh = & @cast($argp, "nfsd3_readargs", "kernel:nfsd")->fh
@@ -381,6 +389,8 @@ probe nfsd.proc3.read = kernel.function("nfsd3_proc_read")!,
 probe nfsd.proc3.read.return = kernel.function("nfsd3_proc_read").return!,
                         module("nfsd").function("nfsd3_proc_read").return?
 {
+	client_ip = addr_from_rqst_str($rqstp)
+
 	name = "nfsd.proc3.read.return"
 	version = 3
 	retstr = sprintf("%s", nfsderror($return))
@@ -389,7 +399,7 @@ probe nfsd.proc3.read.return = kernel.function("nfsd3_proc_read").return!,
 probe nfsd.proc4.read = kernel.function("nfsd4_read") !,
                           module("nfsd").function("nfsd4_read") ?
 {
-	client_ip = addr_from_rqst($rqstp)
+	client_ip = addr_from_rqst_str($rqstp)
 	proto = $rqstp->rq_prot
 	version = 4
 	fh = & @cast($cstate, "nfsd4_compound_state", "kernel:nfsd")->current_fh
@@ -408,6 +418,8 @@ probe nfsd.proc4.read = kernel.function("nfsd4_read") !,
 probe nfsd.proc4.read.return = kernel.function("nfsd4_read").return!,
                         module("nfsd").function("nfsd4_read").return?
 {
+	client_ip = addr_from_rqst_str($rqstp)
+
 	name = "nfsd.proc4.read.return"
 	version = 4
 	retstr = sprintf("%s", nfsderror($return))
@@ -443,7 +455,7 @@ probe nfsd.proc.write.return = nfsd.proc2.write.return,
 probe nfsd.proc2.write = kernel.function("nfsd_proc_write")!,
                         module("nfsd").function("nfsd_proc_write")?
 {
-	client_ip =  addr_from_rqst($rqstp)
+	client_ip =  addr_from_rqst_str($rqstp)
 	proto = $rqstp->rq_prot
         version = 2
 	fh = & @cast($argp, "nfsd_writeargs", "kernel:nfsd")->fh
@@ -468,6 +480,8 @@ probe nfsd.proc2.write = kernel.function("nfsd_proc_write")!,
 probe nfsd.proc2.write.return = kernel.function("nfsd_proc_write").return!,
                         module("nfsd").function("nfsd_proc_write").return?
 {
+	client_ip = addr_from_rqst_str($rqstp)
+
 	name = "nfsd.proc2.write.return"
 	version = 2
 	retstr = sprintf("%s", nfsderror($return))
@@ -476,7 +490,7 @@ probe nfsd.proc2.write.return = kernel.function("nfsd_proc_write").return!,
 probe nfsd.proc3.write = kernel.function("nfsd3_proc_write")!,
                         module("nfsd").function("nfsd3_proc_write")?
 {
-	client_ip =  addr_from_rqst($rqstp)
+	client_ip =  addr_from_rqst_str($rqstp)
 	proto = $rqstp->rq_prot
         version = 3
 	fh = & @cast($argp, "nfsd3_writeargs", "kernel:nfsd")->fh
@@ -502,6 +516,8 @@ probe nfsd.proc3.write = kernel.function("nfsd3_proc_write")!,
 probe nfsd.proc3.write.return = kernel.function("nfsd3_proc_write").return!,
                         module("nfsd").function("nfsd3_proc_write").return?
 {
+	client_ip = addr_from_rqst_str($rqstp)
+
 	name = "nfsd.proc3.write.return"
 	version = 3
 	retstr = sprintf("%s", nfsderror($return))
@@ -512,7 +528,7 @@ probe nfsd.proc3.write.return = kernel.function("nfsd3_proc_write").return!,
 probe nfsd.proc4.write = kernel.function("nfsd4_write") !,
                           module("nfsd").function("nfsd4_write") ?
 {
-	client_ip = addr_from_rqst($rqstp)
+	client_ip = addr_from_rqst_str($rqstp)
 	proto = $rqstp->rq_prot
 	version = 4
 	fh = & @cast($cstate, "nfsd4_compound_state", "kernel:nfsd")->current_fh
@@ -531,6 +547,8 @@ probe nfsd.proc4.write = kernel.function("nfsd4_write") !,
 probe nfsd.proc4.write.return = kernel.function("nfsd4_write").return!,
                         module("nfsd").function("nfsd4_write").return?
 {
+	client_ip = addr_from_rqst_str($rqstp)
+
 	name = "nfsd.proc4.write.return"
 	version = 4
 	count = $write->wr_bytes_written
@@ -564,7 +582,7 @@ probe nfsd.proc.commit.return = nfsd.proc3.commit.return
 probe nfsd.proc3.commit = kernel.function("nfsd3_proc_commit")!,
                         module("nfsd").function("nfsd3_proc_commit")?
 {
-	client_ip =  addr_from_rqst($rqstp)
+	client_ip =  addr_from_rqst_str($rqstp)
 	proto = $rqstp->rq_prot
         version = 3
 	fh = & @cast($argp, "struct nfsd3_commitargs", "kernel:nfsd")->fh
@@ -582,6 +600,8 @@ probe nfsd.proc3.commit = kernel.function("nfsd3_proc_commit")!,
 probe nfsd.proc3.commit.return = kernel.function("nfsd3_proc_commit").return!,
                         module("nfsd").function("nfsd3_proc_commit").return?
 {
+	client_ip = addr_from_rqst_str($rqstp)
+
 	name = "nfsd.proc3.commit.return"
 	version = 3
 	retstr = sprintf("%s", nfsderror($return))
@@ -590,7 +610,7 @@ probe nfsd.proc3.commit.return = kernel.function("nfsd3_proc_commit").return!,
 probe nfsd.proc4.commit = kernel.function("nfsd4_commit") !,
                           module("nfsd").function("nfsd4_commit") ?
 {
-	client_ip = addr_from_rqst($rqstp)
+	client_ip = addr_from_rqst_str($rqstp)
 	proto = $rqstp->rq_prot
 	version = 4
 	fh = & @cast($cstate, "nfsd4_compound_state", "kernel:nfsd")->current_fh
@@ -607,6 +627,8 @@ probe nfsd.proc4.commit = kernel.function("nfsd4_commit") !,
 probe nfsd.proc4.write.commit = kernel.function("nfsd4_commit").return!,
                         module("nfsd").function("nfsd4_commit").return?
 {
+	client_ip = addr_from_rqst_str($rqstp)
+
 	name = "nfsd.proc4.commit.return"
 	version = 4
 	retstr = sprintf("%s", nfsderror($return))
@@ -636,7 +658,7 @@ probe nfsd.proc.create.return = nfsd.proc2.create.return,
 probe nfsd.proc2.create = kernel.function("nfsd_proc_create")!,
                          module("nfsd").function("nfsd_proc_create")?
 {
-	client_ip =  addr_from_rqst($rqstp)
+	client_ip =  addr_from_rqst_str($rqstp)
 	proto = $rqstp->rq_prot
         version = 2
 	fh = & @cast($argp, "struct nfsd_createargs", "kernel:nfsd")->fh
@@ -651,6 +673,8 @@ probe nfsd.proc2.create = kernel.function("nfsd_proc_create")!,
 probe nfsd.proc2.create.return =  kernel.function("nfsd_proc_create").return!,
                                  module("nfsd").function("nfsd_proc_create").return?
 {
+	client_ip = addr_from_rqst_str($rqstp)
+
 	name = "nfsd.proc2.create.return"
 	version = 2
 	retstr = sprintf("%s", nfsderror($return))
@@ -659,7 +683,7 @@ probe nfsd.proc2.create.return =  kernel.function("nfsd_proc_create").return!,
 probe nfsd.proc3.create = kernel.function("nfsd3_proc_create")!,
                          module("nfsd").function("nfsd3_proc_create")?
 {
-	client_ip =  addr_from_rqst($rqstp)
+	client_ip =  addr_from_rqst_str($rqstp)
 	proto = $rqstp->rq_prot
 	version = 3
 	fh = & @cast($argp, "struct nfsd_createargs", "kernel:nfsd")->fh
@@ -675,6 +699,8 @@ probe nfsd.proc3.create = kernel.function("nfsd3_proc_create")!,
 probe nfsd.proc3.create.return =  kernel.function("nfsd3_proc_create").return!,
                                  module("nfsd").function("nfsd3_proc_create").return?
 {
+	client_ip = addr_from_rqst_str($rqstp)
+
 	name = "nfsd.proc3.create.return"
 	version = 3
 	retstr = sprintf("%s", nfsderror($return))
@@ -683,7 +709,7 @@ probe nfsd.proc3.create.return =  kernel.function("nfsd3_proc_create").return!,
 probe nfsd.proc4.create = kernel.function("nfsd4_create") !,
                           module("nfsd").function("nfsd4_create") ?
 {
-	client_ip = addr_from_rqst($rqstp)
+	client_ip = addr_from_rqst_str($rqstp)
 	proto = $rqstp->rq_prot
 	version = 4
 	fh = & @cast($cstate, "nfsd4_compound_state", "kernel:nfsd")->current_fh
@@ -699,6 +725,8 @@ probe nfsd.proc4.create = kernel.function("nfsd4_create") !,
 probe nfsd.proc4.write.create = kernel.function("nfsd4_create").return!,
                         module("nfsd").function("nfsd4_create").return?
 {
+	client_ip = addr_from_rqst_str($rqstp)
+
 	name = "nfsd.proc4.create.return"
 	version = 4
 	retstr = sprintf("%s", nfsderror($return))
@@ -728,9 +756,9 @@ probe nfsd.proc.remove.return = nfsd.proc2.remove.return,
 probe nfsd.proc2.remove = kernel.function("nfsd_proc_remove")!,
                          module("nfsd").function("nfsd_proc_remove")?
 {
-	client_ip =  addr_from_rqst($rqstp)
+	client_ip =  addr_from_rqst_str($rqstp)
 	proto = $rqstp->rq_prot
-        version = 2
+	version = 2
 	fh = & @cast($argp, "struct nfsd_diropargs", "kernel:nfsd")->fh
 
 	filelen = $argp->len
@@ -743,6 +771,8 @@ probe nfsd.proc2.remove = kernel.function("nfsd_proc_remove")!,
 probe nfsd.proc2.remove.return =  kernel.function("nfsd_proc_remove").return!,
                                  module("nfsd").function("nfsd_proc_remove").return?
 {
+	client_ip =  addr_from_rqst_str($rqstp)
+
 	name = "nfsd.proc2.remove.return"
 	version = 2
 	retstr = sprintf("%s", nfsderror($return))
@@ -751,7 +781,7 @@ probe nfsd.proc2.remove.return =  kernel.function("nfsd_proc_remove").return!,
 probe nfsd.proc3.remove = kernel.function("nfsd3_proc_remove")!,
                          module("nfsd").function("nfsd3_proc_remove")?
 {
-	client_ip =  addr_from_rqst($rqstp)
+	client_ip =  addr_from_rqst_str($rqstp)
 	proto = $rqstp->rq_prot
 	version = 3
 	fh = & @cast($argp, "struct nfsd3_diropargs", "kernel:nfsd")->fh
@@ -766,6 +796,8 @@ probe nfsd.proc3.remove = kernel.function("nfsd3_proc_remove")!,
 probe nfsd.proc3.remove.return =  kernel.function("nfsd3_proc_remove").return!,
                                  module("nfsd").function("nfsd3_proc_remove").return?
 {
+	client_ip =  addr_from_rqst_str($rqstp)
+
 	name = "nfsd.proc3.remove.return"
 	version = 3
 	retstr = sprintf("%s", nfsderror($return))
@@ -774,7 +806,7 @@ probe nfsd.proc3.remove.return =  kernel.function("nfsd3_proc_remove").return!,
 probe nfsd.proc4.remove = kernel.function("nfsd4_remove") !,
                           module("nfsd").function("nfsd4_remove") ?
 {
-	client_ip = addr_from_rqst($rqstp)
+	client_ip = addr_from_rqst_str($rqstp)
 	proto = $rqstp->rq_prot
 	version = 4
 	fh = & @cast($cstate, "nfsd4_compound_state", "kernel:nfsd")->current_fh
@@ -789,6 +821,8 @@ probe nfsd.proc4.remove = kernel.function("nfsd4_remove") !,
 probe nfsd.proc4.remove.return = kernel.function("nfsd4_remove").return!,
                         module("nfsd").function("nfsd4_remove").return?
 {
+	client_ip =  addr_from_rqst_str($rqstp)
+
 	name = "nfsd.proc4.remove.return"
 	version = 4
 	retstr = sprintf("%s", nfsderror($return))
@@ -798,6 +832,7 @@ probe nfsd.proc4.remove.return = kernel.function("nfsd4_remove").return!,
 *  Fires when clients rename a file on server side
 *
 * Arguments:
+*  client_ip : the ip address of client
 *   fh : file handler of old path
 *   tfh : file handler of new path
 *   filename : old file name 
@@ -818,7 +853,7 @@ probe nfsd.proc.rename.return = nfsd.proc2.rename.return,
 probe nfsd.proc2.rename =  kernel.function("nfsd_proc_rename")!,
                            module("nfsd").function("nfsd_proc_rename")?
 {
-	client_ip =  addr_from_rqst($rqstp)
+	client_ip =  addr_from_rqst_str($rqstp)
 	proto = $rqstp->rq_prot
 	version = 2
 	fh = & @cast($argp, "struct nfsd_renameargs", "kernel:nfsd")->ffh
@@ -836,6 +871,8 @@ probe nfsd.proc2.rename =  kernel.function("nfsd_proc_rename")!,
 probe nfsd.proc2.rename.return =  kernel.function("nfsd_proc_rename").return!,
                            module("nfsd").function("nfsd_proc_rename").return?
 {
+	client_ip =  addr_from_rqst_str($rqstp)
+
 	name = "nfsd.proc2.rename.return"
 	version = 2
 	retstr = sprintf("%s", nfsderror($return))
@@ -844,7 +881,7 @@ probe nfsd.proc2.rename.return =  kernel.function("nfsd_proc_rename").return!,
 probe nfsd.proc3.rename =  kernel.function("nfsd3_proc_rename")!,
                            module("nfsd").function("nfsd3_proc_rename")?
 {
-	client_ip =  addr_from_rqst($rqstp)
+	client_ip =  addr_from_rqst_str($rqstp)
 	proto = $rqstp->rq_prot
 	version = 3
 	fh = & @cast($argp, "struct nfsd3_renameargs", "kernel:nfsd")->ffh
@@ -862,6 +899,8 @@ probe nfsd.proc3.rename =  kernel.function("nfsd3_proc_rename")!,
 probe nfsd.proc3.rename.return =  kernel.function("nfsd3_proc_rename").return!,
                            module("nfsd").function("nfsd3_proc_rename").return?
 {
+	client_ip =  addr_from_rqst_str($rqstp)
+
 	name = "nfsd.proc3.rename.return"
 	version = 3
 	retstr = sprintf("%s", nfsderror($return))
@@ -870,7 +909,7 @@ probe nfsd.proc3.rename.return =  kernel.function("nfsd3_proc_rename").return!,
 probe nfsd.proc4.rename = kernel.function("nfsd4_rename") !,
                           module("nfsd").function("nfsd4_rename") ?
 {
-	client_ip = addr_from_rqst($rqstp)
+	client_ip = addr_from_rqst_str($rqstp)
 	proto = $rqstp->rq_prot
 	version = 4
 	fh = & @cast($cstate, "nfsd4_compound_state", "kernel:nfsd")->save_fh
@@ -888,6 +927,8 @@ probe nfsd.proc4.rename = kernel.function("nfsd4_rename") !,
 probe nfsd.proc4.rename.return = kernel.function("nfsd4_rename").return!,
                         module("nfsd").function("nfsd4_rename").return?
 {
+	client_ip =  addr_from_rqst_str($rqstp)
+
 	name = "nfsd.proc4.rename.return"
 	version = 4
 	retstr = sprintf("%s", nfsderror($return))
@@ -919,6 +960,7 @@ probe nfsd.return = nfsd.open.return,
 *  Fires when server opens a file
 *
 * Arguments:
+*  client_ip : the ip address of client
 *  fh  : file handle (the first part is the length of the file handle)
 *  access : indicates the type of open(read/write/commit/readdir...) 
 *  type : type of file(regular file or dir)
@@ -926,6 +968,7 @@ probe nfsd.return = nfsd.open.return,
 probe nfsd.open = kernel.function("nfsd_open") !,
                   module("nfsd").function("nfsd_open")?
 {
+	client_ip = addr_from_rqst_str($rqstp)
 	fh = __svc_fh($fhp)
 
 	access = $access
@@ -938,6 +981,7 @@ probe nfsd.open = kernel.function("nfsd_open") !,
 probe nfsd.open.return = kernel.function("nfsd_open").return !,
                   module("nfsd").function("nfsd_open").return?
 {
+	client_ip = addr_from_rqst_str($rqstp)
 	fh = __svc_fh($fhp)
 
 	name = "nfsd.open.return"
@@ -966,6 +1010,7 @@ probe nfsd.close.return = kernel.function("nfsd_close").return!,
 *  Fires when server reads data from a file
 *
 * Arguments:
+*  client_ip : the ip address of client
 *  fh  : file handle (the first part is the length of the file handle)
 *  file : argument file,indicates if the file has been opened.
 *  size:
@@ -978,6 +1023,7 @@ probe nfsd.close.return = kernel.function("nfsd_close").return!,
 probe nfsd.read = kernel.function("nfsd_read") !,
                   module("nfsd").function("nfsd_read")?
 {
+	client_ip = addr_from_rqst_str($rqstp)
 	fh = __svc_fh($fhp)
 
 %( kernel_v >= "2.6.12" %?
@@ -998,6 +1044,7 @@ probe nfsd.read = kernel.function("nfsd_read") !,
 probe nfsd.read.return = kernel.function("nfsd_read").return !,
                   module("nfsd").function("nfsd_read").return?
 {
+	client_ip = addr_from_rqst_str($rqstp)
 	fh = __svc_fh($fhp)
 
 	name = "nfsd.read.return"
@@ -1008,6 +1055,7 @@ probe nfsd.read.return = kernel.function("nfsd_read").return !,
 *  Fires when server writes data to a file
 *
 * Arguments:
+*  client_ip : the ip address of client
 *  fh  : file handle (the first part is the length of the file handle)
 *  file : argument file,indicates if the file has been opened.
 *  size:
@@ -1020,6 +1068,7 @@ probe nfsd.read.return = kernel.function("nfsd_read").return !,
 probe nfsd.write = kernel.function("nfsd_write")!,
                    module("nfsd").function("nfsd_write")?
 {
+	client_ip = addr_from_rqst_str($rqstp)
 	fh = __svc_fh($fhp)
 
 %( kernel_v >= "2.6.12" %?
@@ -1040,6 +1089,7 @@ probe nfsd.write = kernel.function("nfsd_write")!,
 probe nfsd.write.return = kernel.function("nfsd_write").return!,
                    module("nfsd").function("nfsd_write").return?
 {
+	client_ip = addr_from_rqst_str($rqstp)
 	fh = __svc_fh($fhp)
 
 	name = "nfsd.write.return"
@@ -1050,6 +1100,7 @@ probe nfsd.write.return = kernel.function("nfsd_write").return!,
 *  Fires when server commits all pending writes to stable storage.  
 *
 * Arguments:
+*  client_ip : the ip address of client
 *  fh  : file handle (the first part is the length of the file handle)
 *  flag : indicates whether this execution is a sync operation
 *  size:
@@ -1059,6 +1110,7 @@ probe nfsd.write.return = kernel.function("nfsd_write").return!,
 probe nfsd.commit = kernel.function("nfsd_commit")!,
                     module("nfsd").function("nfsd_commit")?
 {
+	client_ip = addr_from_rqst_str($rqstp)
 	fh = __svc_fh($fhp)
 
 	count = $count
@@ -1075,6 +1127,7 @@ probe nfsd.commit = kernel.function("nfsd_commit")!,
 probe nfsd.commit.return = kernel.function("nfsd_commit").return!,
                     module("nfsd").function("nfsd_commit").return ?
 {
+	client_ip = addr_from_rqst_str($rqstp)
 	fh = __svc_fh($fhp)
 
 	name = "nfsd.commit.return"
@@ -1086,6 +1139,7 @@ probe nfsd.commit.return = kernel.function("nfsd_commit").return!,
 *  Fires when client opens/searchs file on server
 *
 *Arguments:
+*  client_ip : the ip address of client
 *  fh  : file handle of parent dir(the first part is the length of the file handle)
 *  filename : file name 
 *  filelen  : the length of file name
@@ -1094,6 +1148,7 @@ probe nfsd.commit.return = kernel.function("nfsd_commit").return!,
 probe nfsd.lookup = kernel.function("nfsd_lookup")!,
                     module("nfsd").function("nfsd_lookup")?
 {
+	client_ip = addr_from_rqst_str($rqstp)
 	fh = __svc_fh($fhp)
 
 	filelen = $len
@@ -1106,6 +1161,7 @@ probe nfsd.lookup = kernel.function("nfsd_lookup")!,
 probe nfsd.lookup.return = kernel.function("nfsd_lookup").return!,
                             module("nfsd").function("nfsd_lookup").return?
 {
+	client_ip = addr_from_rqst_str($rqstp)
 	fh = __svc_fh($fhp)
 
 	name = "nfsd.lookup.return"
@@ -1118,6 +1174,7 @@ probe nfsd.lookup.return = kernel.function("nfsd_lookup").return!,
 *
 * Arguments:
 *
+*  client_ip : the ip address of client
 *  fh  : file handle (the first part is the length of the file handle)
 *  filename : file name 
 *  filelen  : the length of file name
@@ -1128,6 +1185,7 @@ probe nfsd.lookup.return = kernel.function("nfsd_lookup").return!,
 probe nfsd.create = kernel.function("nfsd_create")!,         
                     module("nfsd").function("nfsd_create")?
 {
+	client_ip = addr_from_rqst_str($rqstp)
 	fh = __svc_fh($fhp)
 
 	filelen = $flen
@@ -1143,6 +1201,7 @@ probe nfsd.create = kernel.function("nfsd_create")!,
 probe nfsd.create.return = kernel.function("nfsd_create").return!,         
                     module("nfsd").function("nfsd_create").return?
 {
+	client_ip = addr_from_rqst_str($rqstp)
 	fh = __svc_fh($fhp)
 
 	name = "nfsd.create.return"
@@ -1156,6 +1215,7 @@ probe nfsd.create.return = kernel.function("nfsd_create").return!,
 *
 * Arguments:
 *
+*  client_ip : the ip address of client
 *  fh  : file handle (the first part is the length of the file handle)
 *  filename : file name 
 *  filelen  : the length of file name
@@ -1170,6 +1230,7 @@ probe nfsd.create.return = kernel.function("nfsd_create").return!,
 probe nfsd.createv3 = kernel.function("nfsd_create_v3")!,         
                     module("nfsd").function("nfsd_create_v3")?
 {
+	client_ip = addr_from_rqst_str($rqstp)
 	fh = __svc_fh($fhp)
 
 	filelen = $flen
@@ -1187,6 +1248,9 @@ probe nfsd.createv3 = kernel.function("nfsd_create_v3")!,
 probe nfsd.createv3.return = kernel.function("nfsd_create_v3").return!,         
                     module("nfsd").function("nfsd_create_v3").return?
 {
+	client_ip = addr_from_rqst_str($rqstp)
+	fh = __svc_fh($fhp)
+
 	name = "nfsd.createv3.return"
 	retstr = sprintf("%s", nfsderror($return))
 }
@@ -1197,6 +1261,7 @@ probe nfsd.createv3.return = kernel.function("nfsd_create_v3").return!,
 *
 * Arguments:
 *
+*  client_ip : the ip address of client
 *  fh  : file handle (the first part is the length of the file handle)
 *  filename : file name 
 *  filelen  : the length of file name
@@ -1205,6 +1270,7 @@ probe nfsd.createv3.return = kernel.function("nfsd_create_v3").return!,
 probe nfsd.unlink = kernel.function("nfsd_unlink")!,         
                     module("nfsd").function("nfsd_unlink")?
 {
+	client_ip = addr_from_rqst_str($rqstp)
 	fh = __svc_fh($fhp)
 
 	filelen = $flen
@@ -1218,6 +1284,9 @@ probe nfsd.unlink = kernel.function("nfsd_unlink")!,
 probe nfsd.unlink.return = kernel.function("nfsd_unlink").return!,         
                     module("nfsd").function("nfsd_unlink").return?
 {
+	client_ip = addr_from_rqst_str($rqstp)
+	fh = __svc_fh($fhp)
+
 	name = "nfsd.unlink.return"
 	retstr = sprintf("%s", nfsderror($return))
 }
@@ -1227,6 +1296,7 @@ probe nfsd.unlink.return = kernel.function("nfsd_unlink").return!,
 *  Fires when clients rename a file on server side
 *
 * Arguments:
+*  client_ip : the ip address of client
 *   fh : file handler of old path
 *   tfh : file handler of new path
 *   filename : old file name 
@@ -1238,6 +1308,8 @@ probe nfsd.unlink.return = kernel.function("nfsd_unlink").return!,
 probe nfsd.rename =  kernel.function("nfsd_rename")!,
                            module("nfsd").function("nfsd_rename")?
 {
+	client_ip = addr_from_rqst_str($rqstp)
+
 	fh = __svc_fh($ffhp)
 	tfh = __svc_fh($tfhp)
 
@@ -1253,6 +1325,9 @@ probe nfsd.rename =  kernel.function("nfsd_rename")!,
 probe nfsd.rename.return =  kernel.function("nfsd_rename").return!,
                            module("nfsd").function("nfsd_rename").return?
 {
+	client_ip = addr_from_rqst_str($rqstp)
+	fh = __svc_fh($ffhp)
+
 	name = "nfsd.rename.return"
 	retstr = sprintf("%s", nfsderror($return))
 }
diff --git a/tapset/rpc.stp b/tapset/rpc.stp
index 1d47dae..3e65d0e 100644
--- a/tapset/rpc.stp
+++ b/tapset/rpc.stp
@@ -988,3 +988,27 @@ function addr_from_rqst:long(rqstp:long)
 	CATCH_DEREF_FAULT();
 %}
 
+function addr_from_rqst_str:string(_rqstp:long)
+%{ /* pure */
+	struct svc_rqst *rqstp = 
+		(struct svc_rqst *)(long) kread(&(THIS->_rqstp));
+	struct sockaddr_in *addr;
+	unsigned char *bytes;
+
+	if (rqstp) {
+		if (rqstp->rq_addr.ss_family == AF_INET) {
+			addr = (struct sockaddr_in *) &rqstp->rq_addr;
+			bytes = (unsigned char *)&addr->sin_addr.s_addr;
+
+			snprintf(THIS->__retvalue, MAXSTRINGLEN,
+				"%d.%d.%d.%d:%d", bytes[0], bytes[1], bytes[2], bytes[3],
+				addr->sin_port);
+		} else
+			snprintf(THIS->__retvalue, MAXSTRINGLEN, 
+				"Unsupported Address Family");
+	} else
+		snprintf(THIS->__retvalue, MAXSTRINGLEN, "Null");
+
+	CATCH_DEREF_FAULT();
+%}
+

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 00/10]  Update nfs tapset for nfs header changes, to use  @cast  instead of embedded-c
  2010-02-25 22:17 [PATCH 00/10] Update nfs tapset for nfs header changes, to use @cast instead of embedded-c Steve Dickson
                   ` (9 preceding siblings ...)
  2010-02-25 22:29 ` [PATCH 10/10] Allow better filtering with IP address and File handle Steve Dickson
@ 2010-02-25 22:32 ` Steve Dickson
  10 siblings, 0 replies; 21+ messages in thread
From: Steve Dickson @ 2010-02-25 22:32 UTC (permalink / raw)
  To: Systemtap Mailing list



On 02/25/2010 05:17 PM, Steve Dickson wrote:
> The following patch series fixes a couple problems with the NFS
> server probes. 
> 
> With the 2.6.33 kernel a number of header files disappears from
> the kernel-devel rpm. So the @cast mechanism was used to access
> those the structures that where in the vanishing header files.  
> 
> Added the NFS v4 version of each probe. 
> 
> Finally, to allow more granular filtering, I added the clients
> IP address to all the probes. This will allow a user to filter
> the probe output on a particular client which I believe
> will be very useful... 
> 
> steved.
> 
> Steve Dickson (10):
>   Added new nfsderror() function
>   Updated nfsd.proc.lookup probes
>   Updated nfsd.proc.read probes
>   Updated nfsd.proc.write probes
>   Updated nfsd.proc.create probes
>   Updated nfsd.proc.remove probes
>   Updated nfsd.proc.remove probes
>   Removed the nfsd.proc4.compound and nfsd.proc.compound.return probes
>   General clean up on the upper level probes
>   Allow better filtering with IP address and File handle
> 
>  tapset/nfsd.stp      |  666 ++++++++++++++++++++++++++++++++++----------------
>  tapset/nfsderrno.stp |  238 ++++++++++++++++++
>  tapset/rpc.stp       |   24 ++
>  3 files changed, 723 insertions(+), 205 deletions(-)
>  create mode 100644 tapset/nfsderrno.stp

I should have mentioned the commit blobs are relative to
the nfsd-update branch on the following git tree:

     git://fedorapeople.org/~steved/systemtap-steved 

steved.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 02/10]   Updated nfsd.proc.lookup probes
  2010-02-25 22:20 ` [PATCH 02/10] Updated nfsd.proc.lookup probes Steve Dickson
@ 2010-02-26 20:25   ` David Smith
  2010-03-01 23:10     ` Steve Dickson
  0 siblings, 1 reply; 21+ messages in thread
From: David Smith @ 2010-02-26 20:25 UTC (permalink / raw)
  To: Steve Dickson; +Cc: Systemtap Mailing list

On 02/25/2010 04:19 PM, Steve Dickson wrote:
> commit 472a70b44b5858c60373aa45a119ad66b804061b
> Author: Steve Dickson <steved@redhat.com>
> Date:   Tue Feb 23 11:29:06 2010 -0500
> 
>     Updated nfsd.proc.lookup probes
>     
>     Converted the nfsd.proc.lookup probes to used
>     the @cast() mechanism.
>     
>     Created the nfsd.proc4.lookup probes
>     
>     Signed-off-by: Steve Dickson <steved@redhat.com>
> 
> diff --git a/tapset/nfsd.stp b/tapset/nfsd.stp
> index df8efa8..92f682f 100644
> --- a/tapset/nfsd.stp
> +++ b/tapset/nfsd.stp
> @@ -11,10 +11,6 @@

... great use of '@cast' to remove lots of embedded C...

>  probe nfsd.proc2.lookup = kernel.function("nfsd_proc_lookup") !,
> @@ -207,7 +136,7 @@ probe nfsd.proc2.lookup = kernel.function("nfsd_proc_lookup") !,
>  	client_ip = addr_from_rqst($rqstp)
>  	proto = $rqstp->rq_prot
>          version = 2
> -	fh = __get_fh($argp,1)
> +	fh = & @cast($argp, "nfsd_diropargs", "kernel:nfsd")->fh
>  
>  	filelen = $argp->len
>  	filename = kernel_string_n($argp->name, filelen)
> @@ -222,7 +151,7 @@ probe nfsd.proc2.lookup.return = kernel.function("nfsd_proc_lookup").return !,
>  {
>  	name = "nfsd.proc2.lookup.return"
>  	version = 2
> -	retstr = sprintf("%d",$return)
> +	retstr = sprintf("%s", nfsderror($return))
>  }

This last change points out an issue we're starting to worry about -
backwards compatibility.  If a script that previously used this probe
depended on getting a string in the old format, you just broke their script.

This one is probably OK, but it is something to think about.

-- 
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 04/10]  Updated nfsd.proc.write probes
  2010-02-25 22:22 ` [PATCH 04/10] Updated nfsd.proc.write probes Steve Dickson
@ 2010-02-26 20:30   ` David Smith
  2010-03-01 23:11     ` Steve Dickson
  0 siblings, 1 reply; 21+ messages in thread
From: David Smith @ 2010-02-26 20:30 UTC (permalink / raw)
  To: Steve Dickson; +Cc: Systemtap Mailing list

On 02/25/2010 04:22 PM, Steve Dickson wrote:
> commit 1a3da2a334dc24b2efb1d7f165fe81af2261524f
> Author: Steve Dickson <steved@redhat.com>
> Date:   Tue Feb 23 11:48:15 2010 -0500
> 
>     Updated nfsd.proc.write probes
>     
>     Converted the nfsd.proc.write probes to used
>     the @cast() mechanism.
>     
>     Created the nfsd.proc4.write probes
>     
>     Signed-off-by: Steve Dickson <steved@redhat.com>
> 
> diff --git a/tapset/nfsd.stp b/tapset/nfsd.stp
> index 84f1c56..b501773 100644
> --- a/tapset/nfsd.stp
> +++ b/tapset/nfsd.stp

... reasonable looking changes deleted ...

> +probe nfsd.proc4.commit = kernel.function("nfsd4_commit") !,
> +                          module("nfsd").function("nfsd4_commit") ?
> +{
> +	client_ip = addr_from_rqst($rqstp)
> +	proto = $rqstp->rq_prot
> +	version = 4
> +	fh = & @cast($cstate, "nfsd4_compound_state", "kernel:nfsd")->current_fh
> +	count = $commit->co_offset 
> +	offset = $commit->co_offset 

Is setting both 'count' and 'offset' from the same value correct?

-- 
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 06/10]  Updated nfsd.proc.remove probes
  2010-02-25 22:24 ` [PATCH 06/10] Updated nfsd.proc.remove probes Steve Dickson
@ 2010-02-26 20:43   ` David Smith
  2010-03-01 23:14     ` Steve Dickson
  0 siblings, 1 reply; 21+ messages in thread
From: David Smith @ 2010-02-26 20:43 UTC (permalink / raw)
  To: Steve Dickson; +Cc: Systemtap Mailing list

On 02/25/2010 04:24 PM, Steve Dickson wrote:
> commit fcf7dae52ee72113082eb81c4b72b350b6408e00
> Author: Steve Dickson <steved@redhat.com>
> Date:   Tue Feb 23 11:50:38 2010 -0500
> 
>     Updated nfsd.proc.remove probes
>     
>     Converted the nfsd.proc.remove probes to used
>     the @cast() mechanism.
>     
>     Created the nfsd.proc4.remove probes
>     
>     Signed-off-by: Steve Dickson <steved@redhat.com>
> 
> diff --git a/tapset/nfsd.stp b/tapset/nfsd.stp
> index 41263fb..9726de0 100644
> --- a/tapset/nfsd.stp
> +++ b/tapset/nfsd.stp

> +probe nfsd.proc4.remove = kernel.function("nfsd4_remove") !,
> +                          module("nfsd").function("nfsd4_remove") ?
> +{
> +	client_ip = addr_from_rqst($rqstp)
> +	proto = $rqstp->rq_prot
> +	version = 4
> +	fh = & @cast($cstate, "nfsd4_compound_state", "kernel:nfsd")->current_fh
> +	filelen = $remove->rm_namelen
> +	filename  = kernel_string_n($remove->rm_name, filelen)
> +
> +	name = "nfsd.proc4.remove"
> +	argstr = sprintf("%s", filename);
> +
> +} 

Hmm.  I know from looking you were just following what is in
nfsd.proc3.remove, but because of the way the optimizer works, it might
be better to change this body a bit to avoid using the convenience
variables in later statements.  That way they can be optimized out easier.

Something more like this:

{
	client_ip = addr_from_rqst($rqstp)
	proto = $rqstp->rq_prot
	version = 4
	fh = & @cast($cstate, "nfsd4_compound_state", "kernel:nfsd")->current_fh
	filelen = $remove->rm_namelen
	filename  = kernel_string_n($remove->rm_name, $remove->rm_namelen)

	name = "nfsd.proc4.remove"
	argstr = sprintf("%s", kernel_string_n($remove->rm_name,
						$remove->rm_namelen));
}

I'm not sure how big of a deal this is though.

-- 
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 08/10]  Removed the nfsd.proc4.compound and nfsd.proc.compound.return   probes
  2010-02-25 22:27 ` [PATCH 08/10] Removed the nfsd.proc4.compound and nfsd.proc.compound.return probes Steve Dickson
@ 2010-02-26 20:47   ` David Smith
  2010-03-01 23:22     ` Steve Dickson
  0 siblings, 1 reply; 21+ messages in thread
From: David Smith @ 2010-02-26 20:47 UTC (permalink / raw)
  To: Steve Dickson; +Cc: Systemtap Mailing list

On 02/25/2010 04:27 PM, Steve Dickson wrote:
> commit 9d906571f71dfcd7d22eec4e06d5a06b9f86805a
> Author: Steve Dickson <steved@redhat.com>
> Date:   Tue Feb 23 11:52:17 2010 -0500
> 
>     Removed the nfsd.proc4.compound and nfsd.proc.compound.return probes
>     
>     Either probes displayed anything that was useful, plus
>     there are other ways to display similar information.

Hmm, once again I'm a bit worried about backwards compatibility by
deleting these probe points.  If a script was written with these probes
in mind, that script will no longer work.

-- 
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 05/10] Updated nfsd.proc.create probes
  2010-02-25 22:23 ` [PATCH 05/10] Updated nfsd.proc.create probes Steve Dickson
@ 2010-03-01  3:29   ` Wenji Huang
  0 siblings, 0 replies; 21+ messages in thread
From: Wenji Huang @ 2010-03-01  3:29 UTC (permalink / raw)
  To: Steve Dickson; +Cc: Systemtap Mailing list

On 02/26/2010 06:23 AM, Steve Dickson wrote:
> commit cc4f657eadf2a483d0d7803987a7ba71a4e78480
> Author: Steve Dickson<steved@redhat.com>
> Date:   Tue Feb 23 11:48:57 2010 -0500
>
>      Updated nfsd.proc.create probes
>
>      Converted the nfsd.proc.create probes to used
>      the @cast() mechanism.
>
>      Created the nfsd.proc4.create probes
>
>      Signed-off-by: Steve Dickson<steved@redhat.com>
>
> diff --git a/tapset/nfsd.stp b/tapset/nfsd.stp
> index b501773..41263fb 100644
> --- a/tapset/nfsd.stp
> +++ b/tapset/nfsd.stp
> @@ -10,6 +10,9 @@
>
>
>   %{
> +#include<linux/nfs3.h>
> +#include<linux/nfs4.h>
> +
>   #include<linux/sunrpc/svc.h>
>   %}
>
> @@ -54,6 +57,65 @@ function p_long:long(cnt:long) %{ /* pure */
>   	THIS->__retvalue = kread(count);
>   	CATCH_DEREF_FAULT();
>   %}
> +
> +function nfs3_cmode:string(cmode:long) %{ /* pure */
> +	
> +	switch (THIS->cmode) {
> +	case NFS3_CREATE_UNCHECKED:
> +		snprintf(THIS->__retvalue, MAXSTRINGLEN, "UNCHECKED");
> +		break;
> +	case NFS3_CREATE_GUARDED:
> +		snprintf(THIS->__retvalue, MAXSTRINGLEN, "GUARDED");
> +		break;
> +	case NFS3_CREATE_EXCLUSIVE:
> +		snprintf(THIS->__retvalue, MAXSTRINGLEN, "EXCLUSIVE");
> +		break;
> +	default:
> +		snprintf(THIS->__retvalue, MAXSTRINGLEN, "Bad Value(%lld)",
> +			THIS->cmode);
> +	}
> +	CATCH_DEREF_FAULT();
> +%}
> +
> +function nfs4_ctype:string(cmode:long) %{ /* pure */
> +	
> +	switch (THIS->cmode) {
> +	case NF4BAD:
> +		snprintf(THIS->__retvalue, MAXSTRINGLEN, "NF4BAD");
> +		break;
> +	case NF4REG:
> +		snprintf(THIS->__retvalue, MAXSTRINGLEN, "NF4REG");
> +		break;
> +	case NF4DIR:
> +		snprintf(THIS->__retvalue, MAXSTRINGLEN, "NF4DIR");
> +		break;
> +	case NF4BLK:
> +		snprintf(THIS->__retvalue, MAXSTRINGLEN, "NF4BLK");
> +		break;
> +	case NF4CHR:
> +		snprintf(THIS->__retvalue, MAXSTRINGLEN, "NF4CHR");
> +		break;
> +	case NF4LNK:
> +		snprintf(THIS->__retvalue, MAXSTRINGLEN, "NF4LNK");
> +		break;
> +	case NF4SOCK:
> +		snprintf(THIS->__retvalue, MAXSTRINGLEN, "NF4SOCK");
> +		break;
> +	case NF4FIFO:
> +		snprintf(THIS->__retvalue, MAXSTRINGLEN, "NF4FIFO");
> +		break;
> +	case NF4ATTRDIR:
> +		snprintf(THIS->__retvalue, MAXSTRINGLEN, "NF4ATTRDIR");
> +		break;
> +	case NF4NAMEDATTR:
> +		snprintf(THIS->__retvalue, MAXSTRINGLEN, "NF4ATTRDIR");

Guess this is a typo, should be NF4NAMEDATTR

Regards,
Wenji

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 02/10]   Updated nfsd.proc.lookup probes
  2010-02-26 20:25   ` David Smith
@ 2010-03-01 23:10     ` Steve Dickson
  0 siblings, 0 replies; 21+ messages in thread
From: Steve Dickson @ 2010-03-01 23:10 UTC (permalink / raw)
  To: David Smith; +Cc: Systemtap Mailing list



On 02/26/2010 03:25 PM, David Smith wrote:
> On 02/25/2010 04:19 PM, Steve Dickson wrote:
>> commit 472a70b44b5858c60373aa45a119ad66b804061b
>> Author: Steve Dickson <steved@redhat.com>
>> Date:   Tue Feb 23 11:29:06 2010 -0500
>>
>>     Updated nfsd.proc.lookup probes
>>     
>>     Converted the nfsd.proc.lookup probes to used
>>     the @cast() mechanism.
>>     
>>     Created the nfsd.proc4.lookup probes
>>     
>>     Signed-off-by: Steve Dickson <steved@redhat.com>
>>
>> diff --git a/tapset/nfsd.stp b/tapset/nfsd.stp
>> index df8efa8..92f682f 100644
>> --- a/tapset/nfsd.stp
>> +++ b/tapset/nfsd.stp
>> @@ -11,10 +11,6 @@
> 
> ... great use of '@cast' to remove lots of embedded C...
> 
>>  probe nfsd.proc2.lookup = kernel.function("nfsd_proc_lookup") !,
>> @@ -207,7 +136,7 @@ probe nfsd.proc2.lookup = kernel.function("nfsd_proc_lookup") !,
>>  	client_ip = addr_from_rqst($rqstp)
>>  	proto = $rqstp->rq_prot
>>          version = 2
>> -	fh = __get_fh($argp,1)
>> +	fh = & @cast($argp, "nfsd_diropargs", "kernel:nfsd")->fh
>>  
>>  	filelen = $argp->len
>>  	filename = kernel_string_n($argp->name, filelen)
>> @@ -222,7 +151,7 @@ probe nfsd.proc2.lookup.return = kernel.function("nfsd_proc_lookup").return !,
>>  {
>>  	name = "nfsd.proc2.lookup.return"
>>  	version = 2
>> -	retstr = sprintf("%d",$return)
>> +	retstr = sprintf("%s", nfsderror($return))
>>  }
> 
> This last change points out an issue we're starting to worry about -
> backwards compatibility.  If a script that previously used this probe
> depended on getting a string in the old format, you just broke their script.
> 
> This one is probably OK, but it is something to think about.
Well the way looked at it was if people wanted a particular
format they probably used the $return variable and not the retstr..

steved.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 04/10]  Updated nfsd.proc.write probes
  2010-02-26 20:30   ` David Smith
@ 2010-03-01 23:11     ` Steve Dickson
  0 siblings, 0 replies; 21+ messages in thread
From: Steve Dickson @ 2010-03-01 23:11 UTC (permalink / raw)
  To: David Smith; +Cc: Systemtap Mailing list



On 02/26/2010 03:30 PM, David Smith wrote:
> On 02/25/2010 04:22 PM, Steve Dickson wrote:
>> commit 1a3da2a334dc24b2efb1d7f165fe81af2261524f
>> Author: Steve Dickson <steved@redhat.com>
>> Date:   Tue Feb 23 11:48:15 2010 -0500
>>
>>     Updated nfsd.proc.write probes
>>     
>>     Converted the nfsd.proc.write probes to used
>>     the @cast() mechanism.
>>     
>>     Created the nfsd.proc4.write probes
>>     
>>     Signed-off-by: Steve Dickson <steved@redhat.com>
>>
>> diff --git a/tapset/nfsd.stp b/tapset/nfsd.stp
>> index 84f1c56..b501773 100644
>> --- a/tapset/nfsd.stp
>> +++ b/tapset/nfsd.stp
> 
> ... reasonable looking changes deleted ...
> 
>> +probe nfsd.proc4.commit = kernel.function("nfsd4_commit") !,
>> +                          module("nfsd").function("nfsd4_commit") ?
>> +{
>> +	client_ip = addr_from_rqst($rqstp)
>> +	proto = $rqstp->rq_prot
>> +	version = 4
>> +	fh = & @cast($cstate, "nfsd4_compound_state", "kernel:nfsd")->current_fh
>> +	count = $commit->co_offset 
>> +	offset = $commit->co_offset 
> 
> Is setting both 'count' and 'offset' from the same value correct?
Yes... that is a typo.. good catch.. Will update in an upcoming patch..

steved.

> 

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 06/10]  Updated nfsd.proc.remove probes
  2010-02-26 20:43   ` David Smith
@ 2010-03-01 23:14     ` Steve Dickson
  0 siblings, 0 replies; 21+ messages in thread
From: Steve Dickson @ 2010-03-01 23:14 UTC (permalink / raw)
  To: David Smith; +Cc: Systemtap Mailing list



On 02/26/2010 03:43 PM, David Smith wrote:
> On 02/25/2010 04:24 PM, Steve Dickson wrote:
>> commit fcf7dae52ee72113082eb81c4b72b350b6408e00
>> Author: Steve Dickson <steved@redhat.com>
>> Date:   Tue Feb 23 11:50:38 2010 -0500
>>
>>     Updated nfsd.proc.remove probes
>>     
>>     Converted the nfsd.proc.remove probes to used
>>     the @cast() mechanism.
>>     
>>     Created the nfsd.proc4.remove probes
>>     
>>     Signed-off-by: Steve Dickson <steved@redhat.com>
>>
>> diff --git a/tapset/nfsd.stp b/tapset/nfsd.stp
>> index 41263fb..9726de0 100644
>> --- a/tapset/nfsd.stp
>> +++ b/tapset/nfsd.stp
> 
>> +probe nfsd.proc4.remove = kernel.function("nfsd4_remove") !,
>> +                          module("nfsd").function("nfsd4_remove") ?
>> +{
>> +	client_ip = addr_from_rqst($rqstp)
>> +	proto = $rqstp->rq_prot
>> +	version = 4
>> +	fh = & @cast($cstate, "nfsd4_compound_state", "kernel:nfsd")->current_fh
>> +	filelen = $remove->rm_namelen
>> +	filename  = kernel_string_n($remove->rm_name, filelen)
>> +
>> +	name = "nfsd.proc4.remove"
>> +	argstr = sprintf("%s", filename);
>> +
>> +} 
> 
> Hmm.  I know from looking you were just following what is in
> nfsd.proc3.remove, but because of the way the optimizer works, it might
> be better to change this body a bit to avoid using the convenience
> variables in later statements.  That way they can be optimized out easier.
> 
> Something more like this:
> 
> {
> 	client_ip = addr_from_rqst($rqstp)
> 	proto = $rqstp->rq_prot
> 	version = 4
> 	fh = & @cast($cstate, "nfsd4_compound_state", "kernel:nfsd")->current_fh
> 	filelen = $remove->rm_namelen
> 	filename  = kernel_string_n($remove->rm_name, $remove->rm_namelen)
> 
> 	name = "nfsd.proc4.remove"
> 	argstr = sprintf("%s", kernel_string_n($remove->rm_name,
> 						$remove->rm_namelen));
> }
> 
> I'm not sure how big of a deal this is though.
> 
Makes no difference to me... ;-) 

steevd.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 08/10]  Removed the nfsd.proc4.compound and nfsd.proc.compound.return   probes
  2010-02-26 20:47   ` David Smith
@ 2010-03-01 23:22     ` Steve Dickson
  0 siblings, 0 replies; 21+ messages in thread
From: Steve Dickson @ 2010-03-01 23:22 UTC (permalink / raw)
  To: David Smith; +Cc: Systemtap Mailing list

On 02/26/2010 03:47 PM, David Smith wrote:
> On 02/25/2010 04:27 PM, Steve Dickson wrote:
>> commit 9d906571f71dfcd7d22eec4e06d5a06b9f86805a
>> Author: Steve Dickson <steved@redhat.com>
>> Date:   Tue Feb 23 11:52:17 2010 -0500
>>
>>     Removed the nfsd.proc4.compound and nfsd.proc.compound.return probes
>>     
>>     Either probes displayed anything that was useful, plus
>>     there are other ways to display similar information.
> 
> Hmm, once again I'm a bit worried about backwards compatibility by
> deleting these probe points.  If a script was written with these probes
> in mind, that script will no longer work.
> 
Very valid point... but... The information coming out of these probes
were so useless I can't image anybody using them... Plus breaking them
may be a good thing since we can educate them on how to better utilize
the other existing probes...

steved.
 

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2010-03-01 23:22 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-25 22:17 [PATCH 00/10] Update nfs tapset for nfs header changes, to use @cast instead of embedded-c Steve Dickson
2010-02-25 22:18 ` [PATCH 01/10] Added new nfsderror() function Steve Dickson
2010-02-25 22:20 ` [PATCH 02/10] Updated nfsd.proc.lookup probes Steve Dickson
2010-02-26 20:25   ` David Smith
2010-03-01 23:10     ` Steve Dickson
2010-02-25 22:21 ` [PATCH 03/10] Updated nfsd.proc.read probes Steve Dickson
2010-02-25 22:22 ` [PATCH 04/10] Updated nfsd.proc.write probes Steve Dickson
2010-02-26 20:30   ` David Smith
2010-03-01 23:11     ` Steve Dickson
2010-02-25 22:23 ` [PATCH 05/10] Updated nfsd.proc.create probes Steve Dickson
2010-03-01  3:29   ` Wenji Huang
2010-02-25 22:24 ` [PATCH 06/10] Updated nfsd.proc.remove probes Steve Dickson
2010-02-26 20:43   ` David Smith
2010-03-01 23:14     ` Steve Dickson
2010-02-25 22:26 ` [PATCH 07/10] " Steve Dickson
2010-02-25 22:27 ` [PATCH 08/10] Removed the nfsd.proc4.compound and nfsd.proc.compound.return probes Steve Dickson
2010-02-26 20:47   ` David Smith
2010-03-01 23:22     ` Steve Dickson
2010-02-25 22:28 ` [PATCH 09/10] General clean up on the upper level probes Steve Dickson
2010-02-25 22:29 ` [PATCH 10/10] Allow better filtering with IP address and File handle Steve Dickson
2010-02-25 22:32 ` [PATCH 00/10] Update nfs tapset for nfs header changes, to use @cast instead of embedded-c Steve Dickson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).