Adds two tracepoints - one for query_dir done (no err) and one for query_dir_err (no more files, or error on query dir) e.g. In one window: # trace-cmd record -e smb3_query_dir* Hit Ctrl^C to stop recording In another window do an ls /mnt And then do: # trace-cmd show # _-----=> irqs-off # / _----=> need-resched # | / _---=> hardirq/softirq # || / _--=> preempt-depth # ||| / delay # TASK-PID CPU# |||| TIMESTAMP FUNCTION # | | | |||| | | ls-27625 [006] .... 74313.708032: smb3_query_dir_done: xid=20 sid=0xaf0a6274 tid=0x9f398492 fid=0x7a50dd5a offset=0x0 len=0x13 ls-27625 [006] .... 74313.708713: smb3_query_dir_err: xid=21 sid=0xaf0a6274 tid=0x9f398492 fid=0x7a50dd5a offset=0x0 len=0x0 rc=0 Patch attached -- Thanks, Steve
From c5cd7cf176c933cb7122906d5725d9f9598e2ee3 Mon Sep 17 00:00:00 2001 From: Steve French <stfrench@xxxxxxxxxxxxx> Date: Mon, 25 Feb 2019 00:11:43 -0600 Subject: [PATCH] smb3: add tracepoints for query dir Adds two tracepoints - one for query_dir done (no err) and one for query_dir_err (no more files, or error on query dir) Sanple output: To start the trace in one window: trace-cmd record -e smb3_query_dir* Then in another window after doing an ls /mnt View the trace output by: trace-cmd show Sample output (note that the "error" in no more files, so is rc=0) ls-27625 [006] .... 74313.708032: smb3_query_dir_done: xid=20 sid=0xaf0a6274 tid=0x9f398492 fid=0x7a50dd5a offset=0x0 len=0x13 ls-27625 [006] .... 74313.708713: smb3_query_dir_err: xid=21 sid=0xaf0a6274 tid=0x9f398492 fid=0x7a50dd5a offset=0x0 len=0x0 rc=0 Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx> --- fs/cifs/smb2pdu.c | 4 ++++ fs/cifs/trace.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 64e172633bc4..b6e2a1f40078 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -3896,9 +3896,13 @@ SMB2_query_directory(const unsigned int xid, struct cifs_tcon *tcon, else cifs_dbg(VFS, "illegal search buffer type\n"); + trace_smb3_query_dir_done(xid, persistent_fid, tcon->tid, + tcon->ses->Suid, index, srch_inf->entries_in_buffer); return rc; qdir_exit: + trace_smb3_query_dir_err(xid, persistent_fid, tcon->tid, + tcon->ses->Suid, index, 0, rc); free_rsp_buf(resp_buftype, rsp); return rc; } diff --git a/fs/cifs/trace.h b/fs/cifs/trace.h index 59be48206932..bf4f43f6893b 100644 --- a/fs/cifs/trace.h +++ b/fs/cifs/trace.h @@ -58,6 +58,7 @@ DEFINE_EVENT(smb3_rw_err_class, smb3_##name, \ DEFINE_SMB3_RW_ERR_EVENT(write_err); DEFINE_SMB3_RW_ERR_EVENT(read_err); +DEFINE_SMB3_RW_ERR_EVENT(query_dir_err); /* For logging successful read or write */ @@ -102,6 +103,7 @@ DEFINE_EVENT(smb3_rw_done_class, smb3_##name, \ DEFINE_SMB3_RW_DONE_EVENT(write_done); DEFINE_SMB3_RW_DONE_EVENT(read_done); +DEFINE_SMB3_RW_DONE_EVENT(query_dir_done); /* * For handle based calls other than read and write, and get/set info -- 2.17.1