This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[PATCH 02/02] Backport recently added probes to RHEL5(U5) (w/out kernel version checks)
- From: Steve Dickson <SteveD at redhat dot com>
- To: Systemtap Mailing list <systemtap at sources dot redhat dot com>
- Date: Thu, 04 Mar 2010 15:48:41 -0500
- Subject: [PATCH 02/02] Backport recently added probes to RHEL5(U5) (w/out kernel version checks)
- References: <4B8FE4D5.606@RedHat.com>
I'm resending the second patch of this series due to the
fact there was a much cleaner way to conditionally include
or exclude supported probes.
commit b323ac188731fcacd48d416c13e1cc43dd91ebcd
Author: Steve Dickson <steved@redhat.com>
Date: Thu Mar 4 15:35:12 2010 -0500
Backport recently added probes to RHEL5(U5)
Ensured the recent additions of v4 probes and supporting
routines worked or at least don't break with RHEL5 U5 kernels
(this time without kernel version checks).
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/tapset/nfsd.stp b/tapset/nfsd.stp
index 96fd285..7c4b305 100644
--- a/tapset/nfsd.stp
+++ b/tapset/nfsd.stp
@@ -12,11 +12,12 @@
%{
#include <linux/stat.h>
+#include <linux/sunrpc/svc.h>
+
#include <linux/nfsd/nfsfh.h>
#include <linux/nfs3.h>
#include <linux/nfs4.h>
-#include <linux/sunrpc/svc.h>
%}
@@ -186,7 +187,6 @@ probe nfsd.proc.entries = nfsd.proc.lookup,
nfsd.proc.read,
nfsd.proc.write,
nfsd.proc.commit,
- nfsd.proc.compound,
nfsd.proc.remove,
nfsd.proc.rename,
nfsd.proc.create
@@ -195,8 +195,6 @@ probe nfsd.proc.entries = nfsd.proc.lookup,
probe nfsd.proc.return = nfsd.proc.lookup.return,
nfsd.proc.read.return,
nfsd.proc.write.return,
- nfsd.proc.commit.return,
- nfsd.proc.compound.return,
nfsd.proc.remove.return,
nfsd.proc.rename.return,
nfsd.proc.create.return
@@ -214,14 +212,16 @@ probe nfsd.proc.return = nfsd.proc.lookup.return,
* filename : file name
* filelen : the length of file name
*/
-probe nfsd.proc.lookup = nfsd.proc2.lookup,
- nfsd.proc3.lookup,
- nfsd.proc4.lookup
+probe nfsd.proc.lookup =
+ nfsd.proc4.lookup ?,
+ nfsd.proc3.lookup,
+ nfsd.proc2.lookup
{}
-probe nfsd.proc.lookup.return = nfsd.proc2.lookup.return,
- nfsd.proc3.lookup.return,
- nfsd.proc4.lookup.return
+probe nfsd.proc.lookup.return =
+ nfsd.proc4.lookup.return ?,
+ nfsd.proc3.lookup.return,
+ nfsd.proc2.lookup.return
{}
probe nfsd.proc2.lookup = kernel.function("nfsd_proc_lookup") !,
@@ -316,14 +316,16 @@ probe nfsd.proc4.lookup.return = kernel.function("nfsd4_lookup").return !,
and length of each buffer
* vlen : read blocks
*/
-probe nfsd.proc.read = nfsd.proc2.read,
- nfsd.proc3.read,
- nfsd.proc4.read
+probe nfsd.proc.read =
+ nfsd.proc4.read ?,
+ nfsd.proc3.read,
+ nfsd.proc2.read
{}
-probe nfsd.proc.read.return = nfsd.proc2.read.return,
- nfsd.proc3.read.return,
- nfsd.proc4.read.return
+probe nfsd.proc.read.return =
+ nfsd.proc4.read.return ?,
+ nfsd.proc3.read.return,
+ nfsd.proc2.read.return
{}
probe nfsd.proc2.read = kernel.function("nfsd_proc_read")!,
@@ -442,14 +444,16 @@ probe nfsd.proc4.read.return = kernel.function("nfsd4_read").return!,
* vlen : read blocks
* stable : argp->stable(only in nfs.proc3.write)
*/
-probe nfsd.proc.write = nfsd.proc2.write,
- nfsd.proc3.write,
- nfsd.proc4.write
+probe nfsd.proc.write =
+ nfsd.proc4.write ?,
+ nfsd.proc3.write,
+ nfsd.proc2.write
{}
-probe nfsd.proc.write.return = nfsd.proc2.write.return,
- nfsd.proc3.write.return,
- nfsd.proc4.write.return
+probe nfsd.proc.write.return =
+ nfsd.proc4.write.return ?,
+ nfsd.proc3.write.return,
+ nfsd.proc2.write.return
{}
probe nfsd.proc2.write = kernel.function("nfsd_proc_write")!,
@@ -492,7 +496,7 @@ probe nfsd.proc3.write = kernel.function("nfsd3_proc_write")!,
{
client_ip = addr_from_rqst_str($rqstp)
proto = $rqstp->rq_prot
- version = 3
+ version = 3
fh = & @cast($argp, "nfsd3_writeargs", "kernel:nfsd")->fh
count = $argp->count
@@ -556,6 +560,7 @@ probe nfsd.proc4.write.return = kernel.function("nfsd4_write").return!,
retstr = sprintf("%s", nfsderror($return))
}
+
/*
*probe nfsd.proc.commit
* Fires when client does a commit operation,which is
@@ -571,13 +576,15 @@ probe nfsd.proc4.write.return = kernel.function("nfsd4_write").return!,
* count : read bytes
* offset : the offset of file
*/
-probe nfsd.proc.commit = nfsd.proc3.commit
+probe nfsd.proc.commit =
+ nfsd.proc4.commit ?,
+ nfsd.proc3.commit
{}
-probe nfsd.proc.commit.return = nfsd.proc3.commit.return
-{
-
-}
+probe nfsd.proc.commit.return =
+ nfsd.proc4.commit.return ?,
+ nfsd.proc3.commit.return
+{}
probe nfsd.proc3.commit = kernel.function("nfsd3_proc_commit")!,
module("nfsd").function("nfsd3_proc_commit")?
@@ -624,7 +631,7 @@ probe nfsd.proc4.commit = kernel.function("nfsd4_commit") !,
units = "bytes"
}
-probe nfsd.proc4.write.commit = kernel.function("nfsd4_commit").return!,
+probe nfsd.proc4.commit.return = kernel.function("nfsd4_commit").return!,
module("nfsd").function("nfsd4_commit").return?
{
client_ip = addr_from_rqst_str($rqstp)
@@ -646,13 +653,15 @@ probe nfsd.proc4.write.commit = kernel.function("nfsd4_commit").return!,
* filename : file name
* filelen : length of file name
*/
-probe nfsd.proc.create = nfsd.proc2.create,
- nfsd.proc3.create,
- nfsd.proc4.create
+probe nfsd.proc.create =
+ nfsd.proc4.create ?,
+ nfsd.proc3.create,
+ nfsd.proc2.create
{}
-probe nfsd.proc.create.return = nfsd.proc2.create.return,
- nfsd.proc3.create.return,
- nfsd.proc4.create.return
+probe nfsd.proc.create.return =
+ nfsd.proc4.create.return ?,
+ nfsd.proc3.create.return,
+ nfsd.proc2.create.return
{}
probe nfsd.proc2.create = kernel.function("nfsd_proc_create")!,
@@ -660,7 +669,7 @@ probe nfsd.proc2.create = kernel.function("nfsd_proc_create")!,
{
client_ip = addr_from_rqst_str($rqstp)
proto = $rqstp->rq_prot
- version = 2
+ version = 2
fh = & @cast($argp, "struct nfsd_createargs", "kernel:nfsd")->fh
filelen = $argp->len
@@ -725,8 +734,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?
+probe nfsd.proc4.create.return = kernel.function("nfsd4_create").return !,
+ module("nfsd").function("nfsd4_create").return ?
{
client_ip = addr_from_rqst_str($rqstp)
@@ -747,13 +756,15 @@ probe nfsd.proc4.write.create = kernel.function("nfsd4_create").return!,
* filename : file name
* filelen : length of file name
*/
-probe nfsd.proc.remove = nfsd.proc2.remove,
- nfsd.proc3.remove,
- nfsd.proc4.remove
+probe nfsd.proc.remove =
+ nfsd.proc4.remove ?,
+ nfsd.proc3.remove,
+ nfsd.proc2.remove
{}
-probe nfsd.proc.remove.return = nfsd.proc2.remove.return,
- nfsd.proc3.remove.return,
- nfsd.proc4.remove.return
+probe nfsd.proc.remove.return =
+ nfsd.proc4.remove.return ?,
+ nfsd.proc3.remove.return,
+ nfsd.proc2.remove.return
{}
probe nfsd.proc2.remove = kernel.function("nfsd_proc_remove")!,
@@ -831,6 +842,7 @@ probe nfsd.proc4.remove.return = kernel.function("nfsd4_remove").return!,
version = 4
retstr = sprintf("%s", nfsderror($return))
}
+
/*
* probe nfsd.proc.rename
* Fires when clients rename a file on server side
@@ -844,14 +856,16 @@ probe nfsd.proc4.remove.return = kernel.function("nfsd4_remove").return!,
* flen : length of old file name
* tlen : length of new file name
*/
-probe nfsd.proc.rename = nfsd.proc2.rename,
- nfsd.proc3.rename,
- nfsd.proc4.rename
+probe nfsd.proc.rename =
+ nfsd.proc4.rename ?,
+ nfsd.proc3.rename,
+ nfsd.proc2.rename
{}
-probe nfsd.proc.rename.return = nfsd.proc2.rename.return,
- nfsd.proc3.rename.return,
- nfsd.proc4.rename.return
+probe nfsd.proc.rename.return =
+ nfsd.proc4.rename.return ?,
+ nfsd.proc3.rename.return,
+ nfsd.proc2.rename.return
{}
probe nfsd.proc2.rename = kernel.function("nfsd_proc_rename")!,
@@ -1007,6 +1021,7 @@ probe nfsd.open.return = kernel.function("nfsd_open").return !,
probe nfsd.close = kernel.function("nfsd_close")!,
module("nfsd").function("nfsd_close")?
{
+ client_ip ="N/A"
filename = __file_filename($filp)
name = "nfsd.close"
@@ -1084,7 +1099,11 @@ probe nfsd.write = kernel.function("nfsd_write")!,
%( kernel_v >= "2.6.12" %?
file = $file
%)
+%( kernel_v >= "2.6.30" %?
count = p_long($cnt)
+%:
+ count = $cnt
+%)
offset = $offset
vec = $vec
vlen = $vlen
diff --git a/tapset/nfsderrno.stp b/tapset/nfsderrno.stp
index 6ac4cac..5472892 100644
--- a/tapset/nfsderrno.stp
+++ b/tapset/nfsderrno.stp
@@ -73,6 +73,7 @@
#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)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
#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)
@@ -111,6 +112,7 @@
#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)
+#endif
%}
function nfsderror:string(err:long)
@@ -182,6 +184,7 @@ function nfsderror:string(err:long)
{nfserr_cb_path_down, "NFSERR_CB_PATH_DOWN"},
{nfserr_locked, "NFSERR_LOCKED"},
{nfserr_wrongsec, "NFSERR_WRONGSEC"},
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
{nfserr_badiomode, "NFS4ERR_BADIOMODE"},
{nfserr_badlayout, "NFS4ERR_BADLAYOUT"},
{nfserr_bad_session_digest, "NFS4ERR_BAD_SESSION_DIGEST"},
@@ -220,6 +223,7 @@ function nfsderror:string(err:long)
{nfserr_reject_deleg, "NFS4ERR_REJECT_DELEG"},
{nfserr_returnconflict, "NFS4ERR_RETURNCONFLICT"},
{nfserr_deleg_revoked, "NFS4ERR_DELEG_REVOKED"},
+#endif
};
int i;
int tabsz = (sizeof(nfs_errtbl)/sizeof(nfs_errtbl[0]));
diff --git a/tapset/rpc.stp b/tapset/rpc.stp
index 3e65d0e..d8f2fad 100644
--- a/tapset/rpc.stp
+++ b/tapset/rpc.stp
@@ -996,7 +996,12 @@ function addr_from_rqst_str:string(_rqstp:long)
unsigned char *bytes;
if (rqstp) {
- if (rqstp->rq_addr.ss_family == AF_INET) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)
+ if (rqstp->rq_addr.ss_family == AF_INET)
+#else
+ if (rqstp->rq_addr.sin_family == AF_INET)
+#endif
+ {
addr = (struct sockaddr_in *) &rqstp->rq_addr;
bytes = (unsigned char *)&addr->sin_addr.s_addr;