Skip to content

Commit 073dd87

Browse files
author
Steve French
committed
smb3: add dynamic trace point for ioctls
It can be helpful in debugging to know which ioctls are called to better correlate them with smb3 fsctls (and opens). Add a dynamic trace point to trace ioctls into cifs.ko Here is sample output: TASK-PID CPU# ||||| TIMESTAMP FUNCTION | | | ||||| | | new-inotify-ioc-90418 [001] ..... 142157.397024: smb3_ioctl: xid=18 fid=0x0 ioctl cmd=0xc009cf0b new-inotify-ioc-90457 [007] ..... 142217.943569: smb3_ioctl: xid=22 fid=0x389bf5b6 ioctl cmd=0xc009cf0b Signed-off-by: Steve French <[email protected]>
1 parent f3dc1bd commit 073dd87

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

fs/smb/client/ioctl.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,11 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
345345
xid = get_xid();
346346

347347
cifs_dbg(FYI, "cifs ioctl 0x%x\n", command);
348+
if (pSMBFile == NULL)
349+
trace_smb3_ioctl(xid, 0, command);
350+
else
351+
trace_smb3_ioctl(xid, pSMBFile->fid.persistent_fid, command);
352+
348353
switch (command) {
349354
case FS_IOC_GETFLAGS:
350355
if (pSMBFile == NULL)

fs/smb/client/trace.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,38 @@ DEFINE_EVENT(smb3_ses_class, smb3_##name, \
10321032

10331033
DEFINE_SMB3_SES_EVENT(ses_not_found);
10341034

1035+
DECLARE_EVENT_CLASS(smb3_ioctl_class,
1036+
TP_PROTO(unsigned int xid,
1037+
__u64 fid,
1038+
unsigned int command),
1039+
TP_ARGS(xid, fid, command),
1040+
TP_STRUCT__entry(
1041+
__field(unsigned int, xid)
1042+
__field(__u64, fid)
1043+
__field(unsigned int, command)
1044+
),
1045+
TP_fast_assign(
1046+
__entry->xid = xid;
1047+
__entry->fid = fid;
1048+
__entry->command = command;
1049+
),
1050+
TP_printk("xid=%u fid=0x%llx ioctl cmd=0x%x",
1051+
__entry->xid, __entry->fid, __entry->command)
1052+
)
1053+
1054+
#define DEFINE_SMB3_IOCTL_EVENT(name) \
1055+
DEFINE_EVENT(smb3_ioctl_class, smb3_##name, \
1056+
TP_PROTO(unsigned int xid, \
1057+
__u64 fid, \
1058+
unsigned int command), \
1059+
TP_ARGS(xid, fid, command))
1060+
1061+
DEFINE_SMB3_IOCTL_EVENT(ioctl);
1062+
1063+
1064+
1065+
1066+
10351067
DECLARE_EVENT_CLASS(smb3_credit_class,
10361068
TP_PROTO(__u64 currmid,
10371069
__u64 conn_id,

0 commit comments

Comments
 (0)