This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: [PATCH 02/02] Backport recently added probes to RHEL5(U5)
- From: David Smith <dsmith at redhat dot com>
- To: Steve Dickson <SteveD at redhat dot com>
- Cc: Systemtap Mailing list <systemtap at sources dot redhat dot com>
- Date: Thu, 04 Mar 2010 13:50:53 -0600
- Subject: Re: [PATCH 02/02] Backport recently added probes to RHEL5(U5)
- References: <4B8FE4D5.606@RedHat.com> <4B8FE581.9010009@RedHat.com>
On 03/04/2010 10:53 AM, Steve Dickson wrote:
> commit 35f22bd95cea2fb75573a27282f2a5edea84f2d7
> Author: Steve Dickson <steved@redhat.com>
> Date: Thu Mar 4 09:18:47 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 kernel.
>
> Signed-off-by: Steve Dickson <steved@redhat.com>
Thanks for the work here. But, as much as possible, we're trying to
move away from kernel version checks. (Yes, I know there are lots of
kernel version checks in the tapsets, but we're in the process of trying
to remove as many as possible. So, "do as we say" here, not "do as we
currently do".)
To do this, you'll make those functions that might not exist optional
(using '?'). For example, instead of:
====
probe nfsd.proc.lookup =
%( kernel_v >= "2.6.25" %?
nfsd.proc4.lookup,
%)
nfsd.proc3.lookup,
nfsd.proc2.lookup
====
You'd have:
====
probe nfsd.proc.lookup =
nfsd.proc4.lookup ?,
nfsd.proc3.lookup,
nfsd.proc2.lookup
====
You'd also remove the kernel version check around the
'nfsd.proc4.lookup' probe itself.
I believe this should allow you to remove the majority of the kernel
version checks you added in this patch. (If this doesn't work, let me
know and let's see if we can't figure another way around it.)
> diff --git a/tapset/nfsd.stp b/tapset/nfsd.stp
> index 96fd285..a5dc86b 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,20 @@ 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 =
> +%( kernel_v >= "2.6.25" %?
> + 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 =
> +%( kernel_v >= "2.6.25" %?
> + nfsd.proc4.lookup.return,
> +%)
> + nfsd.proc3.lookup.return,
> + nfsd.proc2.lookup.return
> {}
>
> probe nfsd.proc2.lookup = kernel.function("nfsd_proc_lookup") !,
> @@ -275,6 +279,7 @@ probe nfsd.proc3.lookup.return = kernel.function("nfsd3_proc_lookup").return !,
> retstr = sprintf("%s", nfsderror($return))
> }
>
> +%( kernel_v >= "2.6.25" %?
> probe nfsd.proc4.lookup = kernel.function("nfsd4_lookup") !,
> module("nfsd").function("nfsd4_lookup") ?
> {
> @@ -299,6 +304,7 @@ probe nfsd.proc4.lookup.return = kernel.function("nfsd4_lookup").return !,
> version = 4
> retstr = sprintf("%s", nfsderror($return))
> }
> +%)
>
> /*
> *probe nfsd.proc.read
> @@ -316,14 +322,20 @@ 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 =
> +%( kernel_v >= "2.6.25" %?
> + 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 =
> +%( kernel_v >= "2.6.25" %?
> + nfsd.proc4.read.return,
> +%)
> + nfsd.proc3.read.return,
> + nfsd.proc2.read.return
> {}
>
> probe nfsd.proc2.read = kernel.function("nfsd_proc_read")!,
> @@ -396,6 +408,7 @@ probe nfsd.proc3.read.return = kernel.function("nfsd3_proc_read").return!,
> retstr = sprintf("%s", nfsderror($return))
> }
>
> +%( kernel_v >= "2.6.25" %?
> probe nfsd.proc4.read = kernel.function("nfsd4_read") !,
> module("nfsd").function("nfsd4_read") ?
> {
> @@ -424,6 +437,7 @@ probe nfsd.proc4.read.return = kernel.function("nfsd4_read").return!,
> version = 4
> retstr = sprintf("%s", nfsderror($return))
> }
> +%)
>
> /*
> *probe nfsd.proc.write
> @@ -442,14 +456,20 @@ 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 =
> +%( kernel_v >= "2.6.25" %?
> + 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 =
> +%( kernel_v >= "2.6.25" %?
> + nfsd.proc4.write.return,
> +%)
> + nfsd.proc3.write.return,
> + nfsd.proc2.write.return
> {}
>
> probe nfsd.proc2.write = kernel.function("nfsd_proc_write")!,
> @@ -492,7 +512,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
> @@ -525,6 +545,7 @@ probe nfsd.proc3.write.return = kernel.function("nfsd3_proc_write").return!,
> stable = $resp->committed
> }
>
> +%( kernel_v >= "2.6.25" %?
> probe nfsd.proc4.write = kernel.function("nfsd4_write") !,
> module("nfsd").function("nfsd4_write") ?
> {
> @@ -556,6 +577,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 +593,19 @@ 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 =
> +%( kernel_v >= "2.6.25" %?
> + nfsd.proc4.commit,
> +%)
> + nfsd.proc3.commit
> {}
>
> -probe nfsd.proc.commit.return = nfsd.proc3.commit.return
> -{
> -
> -}
> +probe nfsd.proc.commit.return =
> +%( kernel_v >= "2.6.25" %?
> + nfsd.proc4.commit.return,
> +%)
> + nfsd.proc3.commit.return
> +{}
>
> probe nfsd.proc3.commit = kernel.function("nfsd3_proc_commit")!,
> module("nfsd").function("nfsd3_proc_commit")?
> @@ -607,6 +635,7 @@ probe nfsd.proc3.commit.return = kernel.function("nfsd3_proc_commit").return!,
> retstr = sprintf("%s", nfsderror($return))
> }
>
> +%( kernel_v >= "2.6.25" %?
> probe nfsd.proc4.commit = kernel.function("nfsd4_commit") !,
> module("nfsd").function("nfsd4_commit") ?
> {
> @@ -624,7 +653,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)
> @@ -633,6 +662,7 @@ probe nfsd.proc4.write.commit = kernel.function("nfsd4_commit").return!,
> version = 4
> retstr = sprintf("%s", nfsderror($return))
> }
> +%)
>
> /*
> *probe nfsd.proc.create
> @@ -646,13 +676,19 @@ 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 =
> +%( kernel_v >= "2.6.25" %?
> + 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 =
> +%( kernel_v >= "2.6.25" %?
> + nfsd.proc4.create.return,
> +%)
> + nfsd.proc3.create.return,
> + nfsd.proc2.create.return
> {}
>
> probe nfsd.proc2.create = kernel.function("nfsd_proc_create")!,
> @@ -660,7 +696,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
> @@ -707,6 +743,7 @@ probe nfsd.proc3.create.return = kernel.function("nfsd3_proc_create").return!,
> retstr = sprintf("%s", nfsderror($return))
> }
>
> +%( kernel_v >= "2.6.25" %?
> probe nfsd.proc4.create = kernel.function("nfsd4_create") !,
> module("nfsd").function("nfsd4_create") ?
> {
> @@ -725,8 +762,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)
>
> @@ -734,6 +771,7 @@ probe nfsd.proc4.write.create = kernel.function("nfsd4_create").return!,
> version = 4
> retstr = sprintf("%s", nfsderror($return))
> }
> +%)
>
> /*
> *probe nfsd.proc.remove
> @@ -747,13 +785,19 @@ 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 =
> +%( kernel_v >= "2.6.25" %?
> + 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 =
> +%( kernel_v >= "2.6.25" %?
> + nfsd.proc4.remove.return,
> +%)
> + nfsd.proc3.remove.return,
> + nfsd.proc2.remove.return
> {}
>
> probe nfsd.proc2.remove = kernel.function("nfsd_proc_remove")!,
> @@ -806,6 +850,7 @@ probe nfsd.proc3.remove.return = kernel.function("nfsd3_proc_remove").return!,
> retstr = sprintf("%s", nfsderror($return))
> }
>
> +%( kernel_v >= "2.6.25" %?
> probe nfsd.proc4.remove = kernel.function("nfsd4_remove") !,
> module("nfsd").function("nfsd4_remove") ?
> {
> @@ -831,6 +876,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 +890,20 @@ 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 =
> +%( kernel_v >= "2.6.25" %?
> + 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 =
> +%( kernel_v >= "2.6.25" %?
> + nfsd.proc4.rename.return,
> +%)
> + nfsd.proc3.rename.return,
> + nfsd.proc2.rename.return
> {}
>
> probe nfsd.proc2.rename = kernel.function("nfsd_proc_rename")!,
> @@ -914,6 +966,7 @@ probe nfsd.proc3.rename.return = kernel.function("nfsd3_proc_rename").return!,
> retstr = sprintf("%s", nfsderror($return))
> }
>
> +%( kernel_v >= "2.6.25" %?
> probe nfsd.proc4.rename = kernel.function("nfsd4_rename") !,
> module("nfsd").function("nfsd4_rename") ?
> {
> @@ -943,6 +996,7 @@ probe nfsd.proc4.rename.return = kernel.function("nfsd4_rename").return!,
> version = 4
> retstr = sprintf("%s", nfsderror($return))
> }
> +%)
>
> probe nfsd.entries = nfsd.open,
> nfsd.read,
> @@ -1007,6 +1061,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 +1139,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;
>
>
--
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)