diff options
author | Steve French <stfrench@microsoft.com> | 2018-05-19 02:28:53 -0500 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2018-05-30 16:06:18 -0500 |
commit | d683bcd3e5d157545af705e4807e38f8e511232c (patch) | |
tree | bc7ae0d642233759746a3c9b958e0d1f6583a146 | |
parent | cfe89091644c441a1ade6dae6d2e47b715648615 (diff) |
smb3: add additional ftrace entry points for entry/exit to cifs.ko
Signed-off-by: Steve French <smfrench@gmail.com>
-rw-r--r-- | fs/cifs/cifsproto.h | 8 | ||||
-rw-r--r-- | fs/cifs/smb2maperror.c | 9 | ||||
-rw-r--r-- | fs/cifs/trace.h | 103 |
3 files changed, 85 insertions, 35 deletions
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index 6c4da5de1ab5..dc80f84b4b79 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h @@ -21,6 +21,7 @@ #ifndef _CIFSPROTO_H #define _CIFSPROTO_H #include <linux/nls.h> +#include "trace.h" struct statfs; struct smb_vol; @@ -47,6 +48,7 @@ extern void _free_xid(unsigned int); cifs_dbg(FYI, "CIFS VFS: in %s as Xid: %u with uid: %d\n", \ __func__, __xid, \ from_kuid(&init_user_ns, current_fsuid())); \ + trace_smb3_enter(__xid, __func__); \ __xid; \ }) @@ -54,7 +56,11 @@ extern void _free_xid(unsigned int); do { \ _free_xid(curr_xid); \ cifs_dbg(FYI, "CIFS VFS: leaving %s (xid = %u) rc = %d\n", \ - __func__, curr_xid, (int)rc); \ + __func__, curr_xid, (int)rc); \ + if (rc) \ + trace_smb3_exit_err(curr_xid, __func__, (int)rc); \ + else \ + trace_smb3_exit_done(curr_xid, __func__); \ } while (0) extern int init_cifs_idmap(void); extern void exit_cifs_idmap(void); diff --git a/fs/cifs/smb2maperror.c b/fs/cifs/smb2maperror.c index 20185be4a93d..86f1acaa759b 100644 --- a/fs/cifs/smb2maperror.c +++ b/fs/cifs/smb2maperror.c @@ -2457,9 +2457,8 @@ map_smb2_to_linux_error(char *buf, bool log_err) __le32 smb2err = shdr->Status; if (smb2err == 0) { - trace_smb3_cmd_done(le32_to_cpu(shdr->ProcessId), shdr->TreeId, - shdr->SessionId, le16_to_cpu(shdr->Command), - le64_to_cpu(shdr->MessageId)); + trace_smb3_cmd_done(shdr->TreeId, shdr->SessionId, + le16_to_cpu(shdr->Command), le64_to_cpu(shdr->MessageId)); return 0; } @@ -2483,8 +2482,8 @@ map_smb2_to_linux_error(char *buf, bool log_err) cifs_dbg(FYI, "Mapping SMB2 status code 0x%08x to POSIX err %d\n", __le32_to_cpu(smb2err), rc); - trace_smb3_cmd_err(le32_to_cpu(shdr->ProcessId), shdr->TreeId, - shdr->SessionId, le16_to_cpu(shdr->Command), + trace_smb3_cmd_err(shdr->TreeId, shdr->SessionId, + le16_to_cpu(shdr->Command), le64_to_cpu(shdr->MessageId), le32_to_cpu(smb2err), rc); return rc; } diff --git a/fs/cifs/trace.h b/fs/cifs/trace.h index 935a58979e1b..9bba8e1b00ba 100644 --- a/fs/cifs/trace.h +++ b/fs/cifs/trace.h @@ -50,8 +50,8 @@ DECLARE_EVENT_CLASS(smb3_rw_err_class, __entry->len = len; __entry->rc = rc; ), - TP_printk("xid=%u fid=0x%llx tid=0x%x sid=0x%llx offset=0x%llx len=0x%x rc=%d", - __entry->xid, __entry->fid, __entry->tid, __entry->sesid, + TP_printk("\txid=%u sid=0x%llx tid=0x%x fid=0x%llx offset=0x%llx len=0x%x rc=%d", + __entry->xid, __entry->sesid, __entry->tid, __entry->fid, __entry->offset, __entry->len, __entry->rc) ) @@ -95,8 +95,8 @@ DECLARE_EVENT_CLASS(smb3_rw_done_class, __entry->offset = offset; __entry->len = len; ), - TP_printk("xid=%u fid=0x%llx tid=0x%x sid=0x%llx offset=0x%llx len=0x%x", - __entry->xid, __entry->fid, __entry->tid, __entry->sesid, + TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx offset=0x%llx len=0x%x", + __entry->xid, __entry->sesid, __entry->tid, __entry->fid, __entry->offset, __entry->len) ) @@ -137,8 +137,8 @@ DECLARE_EVENT_CLASS(smb3_fd_err_class, __entry->sesid = sesid; __entry->rc = rc; ), - TP_printk("xid=%u fid=0x%llx tid=0x%x sid=0x%llx rc=%d", - __entry->xid, __entry->fid, __entry->tid, __entry->sesid, + TP_printk("\txid=%u sid=0x%llx tid=0x%x fid=0x%llx rc=%d", + __entry->xid, __entry->sesid, __entry->tid, __entry->fid, __entry->rc) ) @@ -185,8 +185,8 @@ DECLARE_EVENT_CLASS(smb3_inf_err_class, __entry->type = type; __entry->rc = rc; ), - TP_printk("xid=%u fid=0x%llx tid=0x%x sid=0x%llx class=%u type=0x%x rc=%d", - __entry->xid, __entry->fid, __entry->tid, __entry->sesid, + TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx class=%u type=0x%x rc=%d", + __entry->xid, __entry->sesid, __entry->tid, __entry->fid, __entry->infclass, __entry->type, __entry->rc) ) @@ -209,16 +209,14 @@ DEFINE_SMB3_INF_ERR_EVENT(fsctl_err); * For logging SMB3 Status code and Command for responses which return errors */ DECLARE_EVENT_CLASS(smb3_cmd_err_class, - TP_PROTO(__u32 pid, - __u32 tid, + TP_PROTO(__u32 tid, __u64 sesid, __u16 cmd, __u64 mid, __u32 status, int rc), - TP_ARGS(pid, tid, sesid, cmd, mid, status, rc), + TP_ARGS(tid, sesid, cmd, mid, status, rc), TP_STRUCT__entry( - __field(__u32, pid) __field(__u32, tid) __field(__u64, sesid) __field(__u16, cmd) @@ -227,7 +225,6 @@ DECLARE_EVENT_CLASS(smb3_cmd_err_class, __field(int, rc) ), TP_fast_assign( - __entry->pid = pid; __entry->tid = tid; __entry->sesid = sesid; __entry->cmd = cmd; @@ -235,61 +232,109 @@ DECLARE_EVENT_CLASS(smb3_cmd_err_class, __entry->status = status; __entry->rc = rc; ), - TP_printk(" pid=%u tid=0x%x sid=0x%llx cmd=%u mid=%llu status=0x%x rc=%d", - __entry->pid, __entry->tid, __entry->sesid, - __entry->cmd, __entry->mid, __entry->status, __entry->rc) + TP_printk("\tsid=0x%llx tid=0x%x cmd=%u mid=%llu status=0x%x rc=%d", + __entry->sesid, __entry->tid, __entry->cmd, __entry->mid, + __entry->status, __entry->rc) ) #define DEFINE_SMB3_CMD_ERR_EVENT(name) \ DEFINE_EVENT(smb3_cmd_err_class, smb3_##name, \ - TP_PROTO(unsigned int pid, \ - __u32 tid, \ + TP_PROTO(__u32 tid, \ __u64 sesid, \ __u16 cmd, \ __u64 mid, \ __u32 status, \ int rc), \ - TP_ARGS(pid, tid, sesid, cmd, mid, status, rc)) + TP_ARGS(tid, sesid, cmd, mid, status, rc)) DEFINE_SMB3_CMD_ERR_EVENT(cmd_err); DECLARE_EVENT_CLASS(smb3_cmd_done_class, - TP_PROTO(__u32 pid, - __u32 tid, + TP_PROTO(__u32 tid, __u64 sesid, __u16 cmd, __u64 mid), - TP_ARGS(pid, tid, sesid, cmd, mid), + TP_ARGS(tid, sesid, cmd, mid), TP_STRUCT__entry( - __field(__u32, pid) __field(__u32, tid) __field(__u64, sesid) __field(__u16, cmd) __field(__u64, mid) ), TP_fast_assign( - __entry->pid = pid; __entry->tid = tid; __entry->sesid = sesid; __entry->cmd = cmd; __entry->mid = mid; ), - TP_printk("pid=%u tid=0x%x sid=0x%llx cmd=%u mid=%llu", - __entry->pid, __entry->tid, __entry->sesid, + TP_printk("\tsid=0x%llx tid=0x%x cmd=%u mid=%llu", + __entry->sesid, __entry->tid, __entry->cmd, __entry->mid) ) #define DEFINE_SMB3_CMD_DONE_EVENT(name) \ DEFINE_EVENT(smb3_cmd_done_class, smb3_##name, \ - TP_PROTO(unsigned int pid, \ - __u32 tid, \ + TP_PROTO(__u32 tid, \ __u64 sesid, \ __u16 cmd, \ __u64 mid), \ - TP_ARGS(pid, tid, sesid, cmd, mid)) + TP_ARGS(tid, sesid, cmd, mid)) DEFINE_SMB3_CMD_DONE_EVENT(cmd_done); +DECLARE_EVENT_CLASS(smb3_exit_err_class, + TP_PROTO(unsigned int xid, + const char *func_name, + int rc), + TP_ARGS(xid, func_name, rc), + TP_STRUCT__entry( + __field(unsigned int, xid) + __field(const char *, func_name) + __field(int, rc) + ), + TP_fast_assign( + __entry->xid = xid; + __entry->func_name = func_name; + __entry->rc = rc; + ), + TP_printk("\t%s: xid=%u rc=%d", + __entry->func_name, __entry->xid, __entry->rc) +) + +#define DEFINE_SMB3_EXIT_ERR_EVENT(name) \ +DEFINE_EVENT(smb3_exit_err_class, smb3_##name, \ + TP_PROTO(unsigned int xid, \ + const char *func_name, \ + int rc), \ + TP_ARGS(xid, func_name, rc)) + +DEFINE_SMB3_EXIT_ERR_EVENT(exit_err); + +DECLARE_EVENT_CLASS(smb3_enter_exit_class, + TP_PROTO(unsigned int xid, + const char *func_name), + TP_ARGS(xid, func_name), + TP_STRUCT__entry( + __field(unsigned int, xid) + __field(const char *, func_name) + ), + TP_fast_assign( + __entry->xid = xid; + __entry->func_name = func_name; + ), + TP_printk("\t%s: xid=%u", + __entry->func_name, __entry->xid) +) + +#define DEFINE_SMB3_ENTER_EXIT_EVENT(name) \ +DEFINE_EVENT(smb3_enter_exit_class, smb3_##name, \ + TP_PROTO(unsigned int xid, \ + const char *func_name), \ + TP_ARGS(xid, func_name)) + +DEFINE_SMB3_ENTER_EXIT_EVENT(enter); +DEFINE_SMB3_ENTER_EXIT_EVENT(exit_done); + #endif /* _CIFS_TRACE_H */ #undef TRACE_INCLUDE_PATH |