All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve French <smfrench@gmail.com>
To: CIFS <linux-cifs@vger.kernel.org>
Cc: Pavel Shilovsky <piastryyy@gmail.com>
Subject: [PATCH] add dynamic trace points for compounded query/setinfo paths
Date: Wed, 27 Feb 2019 00:06:30 -0600	[thread overview]
Message-ID: <CAH2r5muZ4EQuFSsBA8FtMuj7_fbtUz+LT62bArMS0O0T=0pk0w@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 608 bytes --]

Add tracepoints for enter/exit (error or done without error)
for compounded query_info and set_info

Sample output (trace-cmd record -e smb3_*compound*):
    touch-30074 [005] .... 33989.459514: smb3_set_info_compound_enter:
xid=8 sid=0xbe534a7e tid=0x82c96a43
    touch-30074 [005] .N.. 33989.471834: smb3_set_info_compound_done:
xid=8 sid=0xbe534a7e tid=0x82c96a43
    mkdir-30076 [007] .... 33999.239926:
smb3_query_info_compound_enter: xid=10 sid=0xbe534a7e tid=0x82c96a43
    mkdir-30076 [007] .... 33999.247180:
smb3_query_info_compound_done: xid=10 sid=0xbe534a7e tid=0x82c96a43



-- 
Thanks,

Steve

[-- Attachment #2: 0001-smb3-add-dynamic-trace-points-for-compound-query-and.patch --]
[-- Type: text/x-patch, Size: 5130 bytes --]

From 7857c2f6a17851aac10232da9162b688b35dc368 Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@microsoft.com>
Date: Wed, 27 Feb 2019 00:01:35 -0600
Subject: [PATCH] smb3: add dynamic trace points for compound query and setinfo

Add tracepoints for enter/exit (error or done without error)
for compounded query_info and set_info

Sample output (trace-cmd record -e smb3_*compound*):
    touch-30074 [005] .... 33989.459514: smb3_set_info_compound_enter: xid=8 sid=0xbe534a7e tid=0x82c96a43
    touch-30074 [005] .N.. 33989.471834: smb3_set_info_compound_done: xid=8 sid=0xbe534a7e tid=0x82c96a43
    mkdir-30076 [007] .... 33999.239926: smb3_query_info_compound_enter: xid=10 sid=0xbe534a7e tid=0x82c96a43
    mkdir-30076 [007] .... 33999.247180: smb3_query_info_compound_done: xid=10 sid=0xbe534a7e tid=0x82c96a43

Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/cifs/smb2inode.c | 19 +++++++++++++-
 fs/cifs/trace.h     | 64 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 82 insertions(+), 1 deletion(-)

diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c
index 01a76bccdb8d..b645b8626e7d 100644
--- a/fs/cifs/smb2inode.c
+++ b/fs/cifs/smb2inode.c
@@ -112,6 +112,7 @@ smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
 					  PATH_MAX * 2, 0, NULL);
 		smb2_set_next_command(tcon, &rqst[num_rqst]);
 		smb2_set_related(&rqst[num_rqst++]);
+		trace_smb3_query_info_compound_enter(xid, tcon->tid, ses->Suid);
 		break;
 	case SMB2_OP_DELETE:
 		break;
@@ -166,6 +167,7 @@ smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
 					SMB2_O_INFO_FILE, 0, data, size);
 		smb2_set_next_command(tcon, &rqst[num_rqst]);
 		smb2_set_related(&rqst[num_rqst++]);
+		trace_smb3_set_info_compound_enter(xid, tcon->tid, ses->Suid);
 		break;
 	case SMB2_OP_RENAME:
 		memset(&si_iov, 0, sizeof(si_iov));
@@ -247,7 +249,11 @@ smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
 				le32_to_cpu(qi_rsp->OutputBufferLength),
 				&rsp_iov[1], sizeof(struct smb2_file_all_info),
 				ptr);
-		}
+			trace_smb3_query_info_compound_done(xid, tcon->tid,
+							     ses->Suid);
+		} else
+			trace_smb3_query_info_compound_err(xid, tcon->tid,
+							   ses->Suid, rc);
 		if (rqst[1].rq_iov)
 			SMB2_query_info_free(&rqst[1]);
 		if (rqst[2].rq_iov)
@@ -262,11 +268,22 @@ smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
 	case SMB2_OP_RENAME:
 	case SMB2_OP_RMDIR:
 	case SMB2_OP_SET_EOF:
+		if (rqst[1].rq_iov)
+			SMB2_set_info_free(&rqst[1]);
+		if (rqst[2].rq_iov)
+			SMB2_close_free(&rqst[2]);
+		break;
 	case SMB2_OP_SET_INFO:
 		if (rqst[1].rq_iov)
 			SMB2_set_info_free(&rqst[1]);
 		if (rqst[2].rq_iov)
 			SMB2_close_free(&rqst[2]);
+		if (rc)
+			trace_smb3_set_info_compound_err(xid, tcon->tid,
+							   ses->Suid, rc);
+		else
+			trace_smb3_set_info_compound_done(xid, tcon->tid,
+							   ses->Suid);
 		break;
 	}
 	free_rsp_buf(resp_buftype[0], rsp_iov[0].iov_base);
diff --git a/fs/cifs/trace.h b/fs/cifs/trace.h
index d8b049afa606..a8837d6efbc0 100644
--- a/fs/cifs/trace.h
+++ b/fs/cifs/trace.h
@@ -242,6 +242,70 @@ DEFINE_SMB3_INF_ERR_EVENT(query_info_err);
 DEFINE_SMB3_INF_ERR_EVENT(set_info_err);
 DEFINE_SMB3_INF_ERR_EVENT(fsctl_err);
 
+DECLARE_EVENT_CLASS(smb3_inf_compound_enter_class,
+	TP_PROTO(unsigned int xid,
+		__u32	tid,
+		__u64	sesid),
+	TP_ARGS(xid, tid, sesid),
+	TP_STRUCT__entry(
+		__field(unsigned int, xid)
+		__field(__u32, tid)
+		__field(__u64, sesid)
+	),
+	TP_fast_assign(
+		__entry->xid = xid;
+		__entry->tid = tid;
+		__entry->sesid = sesid;
+	),
+	TP_printk("xid=%u sid=0x%llx tid=0x%x",
+		__entry->xid, __entry->sesid, __entry->tid)
+)
+
+#define DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(name)     \
+DEFINE_EVENT(smb3_inf_compound_enter_class, smb3_##name,    \
+	TP_PROTO(unsigned int xid,		\
+		__u32	tid,			\
+		__u64	sesid),			\
+	TP_ARGS(xid, tid, sesid))
+
+DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(query_info_compound_enter);
+DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(query_info_compound_done);
+DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(set_info_compound_enter);
+DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(set_info_compound_done);
+
+DECLARE_EVENT_CLASS(smb3_inf_compound_err_class,
+	TP_PROTO(unsigned int xid,
+		__u32	tid,
+		__u64	sesid,
+		int	rc),
+	TP_ARGS(xid, tid, sesid, rc),
+	TP_STRUCT__entry(
+		__field(unsigned int, xid)
+		__field(__u32, tid)
+		__field(__u64, sesid)
+		__field(int, rc)
+	),
+	TP_fast_assign(
+		__entry->xid = xid;
+		__entry->tid = tid;
+		__entry->sesid = sesid;
+		__entry->rc = rc;
+	),
+	TP_printk("xid=%u sid=0x%llx tid=0x%x rc=%d",
+		__entry->xid, __entry->sesid, __entry->tid, __entry->rc)
+)
+
+#define DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(name)     \
+DEFINE_EVENT(smb3_inf_compound_err_class, smb3_##name,    \
+	TP_PROTO(unsigned int xid,		\
+		__u32	tid,			\
+		__u64	sesid,			\
+		int rc),			\
+	TP_ARGS(xid, tid, sesid, rc))
+
+DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(query_info_compound_err);
+DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(set_info_compound_err);
+
 /*
  * For logging SMB3 Status code and Command for responses which return errors
  */
-- 
2.17.1


             reply	other threads:[~2019-02-27  6:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-27  6:06 Steve French [this message]
2019-02-27 19:15 ` [PATCH] add dynamic trace points for compounded query/setinfo paths Pavel Shilovsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH2r5muZ4EQuFSsBA8FtMuj7_fbtUz+LT62bArMS0O0T=0pk0w@mail.gmail.com' \
    --to=smfrench@gmail.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=piastryyy@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.