summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Dickson <steved@redhat.com>2014-03-12 11:17:23 -0400
committerSteve Dickson <steved@redhat.com>2014-03-12 11:17:23 -0400
commitcd92912e1fb05263364350d2b036884b3ed5e305 (patch)
treeaa60a490d650b66356ac2c282c0768650aa2e1ce
parent3a479417ede79fdb1b96d2050d07549a58d10887 (diff)
downloadsystemtap-cd92912e1fb05263364350d2b036884b3ed5e305.tar.gz
systemtap-cd92912e1fb05263364350d2b036884b3ed5e305.tar.xz
systemtap-cd92912e1fb05263364350d2b036884b3ed5e305.zip
Added top-nfsxdrcalls.stp and nfsd/nfsd_permission.stp
Signed-off-by: steved <steved@redhat.com>
-rw-r--r--nfsd/nfsd_permission.stp22
-rw-r--r--tapset/inode.stp10
-rw-r--r--tapset/nfs4_callback.stp2
-rw-r--r--tapset/nfs4ops.stp2
-rwxr-xr-xtop-nfsxdrcalls.stp19
5 files changed, 47 insertions, 8 deletions
diff --git a/nfsd/nfsd_permission.stp b/nfsd/nfsd_permission.stp
index 63969a9..09786ea 100644
--- a/nfsd/nfsd_permission.stp
+++ b/nfsd/nfsd_permission.stp
@@ -1,6 +1,6 @@
#!/usr/bin/env stap
-global acl_inode, acl_mask, acl_check;
+global acl_inode, acl_mask, acl_check, inode_mask;
probe module("nfsd").function("nfsd_permission")
{
@@ -18,8 +18,16 @@ probe kernel.function("acl_permission_check")
probe kernel.function("acl_permission_check").return
{
if ($return)
- printf(" acl_permission_check: inode 0x%p uid %s %s error: %d\n",
- acl_inode, inode_uid(acl_inode), file_modes(acl_mask), $return);
+ printf(" acl_permission_check: inode 0x%p uid %s %s %s error: %d\n",
+ acl_inode, inode_uid(acl_inode), file_modes(acl_mask), file_modes(inode_mode(acl_inode)), $return);
+}
+probe kernel.function("ext4_check_acl").return
+{
+ printf(" ext4_check_acl: error: %d\n", $return);
+}
+probe kernel.function("posix_acl_permission").return
+{
+ printf(" posix_acl_permission: error: %d\n", $return);
}
/*
a very busy probe
@@ -30,11 +38,15 @@ probe kernel.function("selinux_inode_permission").return
}
*/
+probe kernel.function("inode_permission")
+{
+ inode_mask = $mask
+}
probe kernel.function("inode_permission").return
{
if ($return)
- printf(" inode_permission: uid %d gid %d: mode 0%o: flags 0x%x: mask 0x%x: error: %d\n",
- $inode->i_uid, $inode->i_gid, $inode->i_mode, $inode->i_flags,
+ printf(" inode_permission: uid %d gid %d: mask %s imode %s: iflags 0x%x: mask 0x%x: error: %d\n",
+ $inode->i_uid, $inode->i_gid, file_modes(inode_mask), file_modes($inode->i_mode), $inode->i_flags,
$mask, $return);
}
probe kernel.function("security_inode_permission").return
diff --git a/tapset/inode.stp b/tapset/inode.stp
index 56340d0..39c34b6 100644
--- a/tapset/inode.stp
+++ b/tapset/inode.stp
@@ -12,6 +12,14 @@ function inode_uid:string(_ino:long)
CATCH_DEREF_FAULT();
%}
+function inode_mode:long(_ino:long)
+%{
+ struct inode *inode = (struct inode *)(long) kread(&(THIS->_ino));
+
+ THIS->__retvalue = inode->i_mode;
+
+ CATCH_DEREF_FAULT();
+%}
function file_modes:string(_m:long)
%{
@@ -44,7 +52,7 @@ function file_modes:string(_m:long)
cc = strlen(buf);
}
if (cc)
- snprintf(THIS->__retvalue, MAXSTRINGLEN, "mode 0%o (%s)", _mod, buf);
+ snprintf(THIS->__retvalue, MAXSTRINGLEN, "0%o (%s)", _mod, buf);
else
snprintf(THIS->__retvalue, MAXSTRINGLEN, "mode 0%o", _mod);
diff --git a/tapset/nfs4_callback.stp b/tapset/nfs4_callback.stp
index c6492b7..05c756c 100644
--- a/tapset/nfs4_callback.stp
+++ b/tapset/nfs4_callback.stp
@@ -8,7 +8,7 @@
#include <linux/nfs4.h>
#include <linux/nfsd/nfsfh.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,33)
#include <linux/nfsd/state.h>
#include <linux/nfsd/xdr4.h>
#endif
diff --git a/tapset/nfs4ops.stp b/tapset/nfs4ops.stp
index c09be6a..22e7a71 100644
--- a/tapset/nfs4ops.stp
+++ b/tapset/nfs4ops.stp
@@ -10,7 +10,7 @@
#include <linux/nfsd/nfsfh.h>
#include <linux/nfsd/export.h>
#include <linux/nfsd/nfsd.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,33)
#include <linux/nfsd/state.h>
#include <linux/nfsd/xdr4.h>
#endif
diff --git a/top-nfsxdrcalls.stp b/top-nfsxdrcalls.stp
new file mode 100755
index 0000000..032e65f
--- /dev/null
+++ b/top-nfsxdrcalls.stp
@@ -0,0 +1,19 @@
+#!/usr/bin/env stap
+
+global nfscalls
+
+probe begin {
+ printf("Collecting top NFS procs...\n")
+}
+
+probe module("nfsv4").function("*@fs/nfs/nfs4xdr.c")
+{
+ nfscalls[probefunc()]++
+}
+
+probe end {
+ printf("Collating data...\n");
+ foreach (name in nfscalls- limit 20)
+ printf("%10d %s\n", nfscalls[name], name)
+}
+