diff options
-rw-r--r-- | ext3/ext3_acl.stp | 25 | ||||
-rw-r--r-- | nfsd/nfsd4_open.stp | 49 | ||||
-rw-r--r-- | nfsd/nfsd4_set_nfs4_acl.stp | 29 | ||||
-rw-r--r-- | tapset/acl.stp | 27 | ||||
-rw-r--r-- | tapset/inode.stp | 13 | ||||
-rw-r--r-- | tracemarks/nfs_mount.stp | 52 | ||||
-rw-r--r-- | tracemarks/sched.stp | 3 |
7 files changed, 198 insertions, 0 deletions
diff --git a/ext3/ext3_acl.stp b/ext3/ext3_acl.stp new file mode 100644 index 0000000..904e146 --- /dev/null +++ b/ext3/ext3_acl.stp @@ -0,0 +1,25 @@ +/* + * To run: + * stap -g -I../tapset ext3_acl.stp + */ +probe module("ext3").function("ext3_get_acl") +{ + printf(" ext3_get_acl: inode %p\n", $inode); +} +probe module("ext3").function("ext3_get_acl").return +{ + if ($return) + printf(" ext3_get_acl: %s\n", acl_dump($return)); +} +probe module("ext3").function("ext3_check_acl") +{ + printf("ext3_check_acl: %s mask 0x%x\n", + inode_uid($inode), $mask); +} +probe module("ext3").function("ext3_check_acl").return +{ + printf("ext3_check_acl: %d\n", $return); +} +probe begin { log("starting ext3_acl probe") } +probe end { log("ending ext3_acl probe") } + diff --git a/nfsd/nfsd4_open.stp b/nfsd/nfsd4_open.stp new file mode 100644 index 0000000..73a14a6 --- /dev/null +++ b/nfsd/nfsd4_open.stp @@ -0,0 +1,49 @@ +/* + * To run: + * stap -g -I../tapset nfsd4_open.stp + */ +probe module("nfsd").function("nfsd4_process_open1") +{ + printf("nfsd4_process_open1: open %p\n", $open); +} +probe module("nfsd").function("nfsd4_process_open1").return +{ + printf("nfsd4_process_open1: %s\n", nfsderror($return)); +} + +probe module("nfsd").function("do_open_permission") +{ + printf("do_open_permission: open %p\n", $open); +} +probe module("nfsd").function("do_open_permission").return +{ + printf("do_open_permission: %s\n", nfsderror($return)); +} + +probe module("nfsd").function("nfsd4_process_open2") +{ + printf("nfsd4_process_open2: open %p\n", $open); +} +probe module("nfsd").function("nfsd4_process_open2").return +{ + printf("nfsd4_process_open2: %s\n", nfsderror($return)); +} +probe module("nfsd").function("nfsd_permission") +{ + printf("nfsd_permission: exp 0x%x\n", $acc); +} +probe module("nfsd").function("nfsd_permission").return +{ + printf("nfsd_permission: %s\n", nfsderror($return)); +} +probe module("ext3").function("ext3_check_acl") +{ + printf("ext3_check_acl: mask 0x%x\n", $mask); +} +probe module("ext3").function("ext3_check_acl").return +{ + printf("ext3_check_acl: %d\n", $return); +} +probe begin { log("starting nfsd4_open probe") } +probe end { log("ending nfsd4_open probe") } + diff --git a/nfsd/nfsd4_set_nfs4_acl.stp b/nfsd/nfsd4_set_nfs4_acl.stp new file mode 100644 index 0000000..45fcd85 --- /dev/null +++ b/nfsd/nfsd4_set_nfs4_acl.stp @@ -0,0 +1,29 @@ +#!/usr/bin/env stap +/* + * To run: + * stap -g -I../tapset nfsd4_set_nfs4_acl.stp + */ + +probe module("nfsd").function("nfsd4_set_nfs4_acl") +{ + printf("nfsd4_set_nfs4_acl: rqstp %p \n", $rqstp); +} +probe module("nfsd").function("nfsd4_set_nfs4_acl").return +{ + printf("nfsd4_set_nfs4_acl: %s\n", nfsderror($return)); +} +probe module("nfsd").function("nfs4_acl_nfsv4_to_posix").return +{ + printf(" nfs4_acl_nfsv4_to_posix: %d(%s)\n", $return, errno_str($return)); +} +probe module("nfsd").function("set_nfsv4_acl_one").return +{ + printf(" set_nfsv4_acl_one: %s\n", nfsderror($return)); +} +probe module("nfsd").function("_nfsv4_to_posix_one").return +{ + printf(" _nfsv4_to_posix_one: %p\n", $return); +} +probe begin { log("starting nfsd4_set_nfs4_acl probe") } +probe end { log("ending nfsd4_set_nfs4_acl probe") } + diff --git a/tapset/acl.stp b/tapset/acl.stp new file mode 100644 index 0000000..ad9f88d --- /dev/null +++ b/tapset/acl.stp @@ -0,0 +1,27 @@ +%{ +#include <linux/kernel.h> +#include <linux/posix_acl.h> +%} + +function acl_dump:string(_acl:long) +%{ + struct posix_acl *acl = (struct posix_acl *)(long) kread(&(THIS->_acl)); + struct posix_acl_entry *pa; + char buf[MAXSTRINGLEN]; + int cc=0, i; + + sprintf(buf+cc, "acl(%d) ", acl->a_count); + cc = strlen(buf); + pa = acl->a_entries; + + for (i=0; i < acl->a_count; i++) { + + sprintf(buf+cc, "[%d,%d,%d] ", pa->e_tag, pa->e_perm, pa->e_id); + cc = strlen(buf); + + pa++; + } + snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s", buf); + + CATCH_DEREF_FAULT(); +%} diff --git a/tapset/inode.stp b/tapset/inode.stp new file mode 100644 index 0000000..106cba1 --- /dev/null +++ b/tapset/inode.stp @@ -0,0 +1,13 @@ +%{ +#include <linux/kernel.h> +%} + +function inode_uid:string(_ino:long) +%{ + struct inode *inode = (struct inode *)(long) kread(&(THIS->_ino)); + + snprintf(THIS->__retvalue, MAXSTRINGLEN, "uid=%d gid=%d", + inode->i_uid, inode->i_gid); + + CATCH_DEREF_FAULT(); +%} diff --git a/tracemarks/nfs_mount.stp b/tracemarks/nfs_mount.stp new file mode 100644 index 0000000..b20e920 --- /dev/null +++ b/tracemarks/nfs_mount.stp @@ -0,0 +1,52 @@ +%{ +#include <linux/mount.h> +#include <linux/nfs_mount.h> +%} + +function _fstype_name:string (_fstype:long) %{ + struct file_system_type *fstype; + char *name; + + fstype = (struct file_system_type *)(long)kread(&(THIS->_fstype)); + name = (char *)(long)kread(&fstype->name); + + snprintf(THIS->__retvalue, MAXSTRINGLEN, "name %s flags 0x%x", + name, fstype->fs_flags); + + CATCH_DEREF_FAULT(); +%} +function _vfsmnt_dump:string (_vfsmnt:long) %{ + struct vfsmount *vfsmnt; + char *dev; + + vfsmnt = (struct vfsmount *)(long)kread(&(THIS->_vfsmnt)); + dev = (char *)(long)kread(&vfsmnt->mnt_devname); + + snprintf(THIS->__retvalue, MAXSTRINGLEN, "dev %s flags=0x%x", + vfsmnt->mnt_devname, vfsmnt->mnt_flags); + + CATCH_DEREF_FAULT(); +%} +function _nfsmnt_dump:string (_nfsmnt:long) %{ + struct nfs_mount_data *data; + unsigned char *bytes; + + data = (struct nfs_mount_data *)(long)kread(&(THIS->_nfsmnt)); + bytes = (unsigned char *)&data->addr.sin_addr.s_addr; + + snprintf(THIS->__retvalue, MAXSTRINGLEN, + "vers %d flags 0x%x flavor %d hostname %s(%d.%d.%d.%d)", + data->version, data->flags, data->pseudoflavor, + data->hostname, bytes[0], bytes[1], bytes[2], bytes[3]); + + CATCH_DEREF_FAULT(); +%} + +probe kernel.mark("nfs_mount") { + printf("nfs_mount:entry: fstype (%s) flags %x dev %s\n", + _fstype_name($arg1), $arg2, kernel_string($arg3)); + printf("\tdata: %s\n\tmnt: %s\n", + _nfsmnt_dump($arg4), _vfsmnt_dump($arg5)); + +} + diff --git a/tracemarks/sched.stp b/tracemarks/sched.stp new file mode 100644 index 0000000..0b3ffa2 --- /dev/null +++ b/tracemarks/sched.stp @@ -0,0 +1,3 @@ +probe kernel.mark("kernel_sched_schedule") { + printf("kernel_sched_schedule: pid %d\n", $arg1) +} |