From patchwork Wed Feb 27 06:06:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 10831217 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DF1A1922 for ; Wed, 27 Feb 2019 06:06:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C49042CB37 for ; Wed, 27 Feb 2019 06:06:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B8DEC2CDA0; Wed, 27 Feb 2019 06:06:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2FAC02CB37 for ; Wed, 27 Feb 2019 06:06:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726268AbfB0GGo (ORCPT ); Wed, 27 Feb 2019 01:06:44 -0500 Received: from mail-pf1-f177.google.com ([209.85.210.177]:35399 "EHLO mail-pf1-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729824AbfB0GGn (ORCPT ); Wed, 27 Feb 2019 01:06:43 -0500 Received: by mail-pf1-f177.google.com with SMTP id j5so7479707pfa.2 for ; Tue, 26 Feb 2019 22:06:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=X7A3SIi/jY9sow6pJz7he43k3UQxmVOwMmupuC6XJIo=; b=YIxzmejXwb1gAFNAOHjrAOtOTrXit4FtxqVvpI//xoc21qPug0Bf9ZOZQRBvC/oKpH 6KmAMtcbhAEoUnvl0zBcAogYp5/JMh87DM+Mntg8bVOvuLce8fLu7lTe87lLjpZdzxMM XLxuh0ncrwGbXtSdw0wTBLcBKd0qO7+jSxlSTT9orkeojdgjqkBEtu/DeiF4MQ74L+kJ 99ehgE23aYRVULZ6K4XQQHfq+ykdNsC+NQYKr5U6Zm6385KIFcp0ipYK+C5cbh56Ko+2 Xru65OvLamkmpSA15VmDjqGAnBrqhCe3pFaM1yITPAKrdaLC+XhQaA81pAGVjElF7uwv 8wPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=X7A3SIi/jY9sow6pJz7he43k3UQxmVOwMmupuC6XJIo=; b=Efos5yGjeOXKdPHrWgl0CG8Yw8ONfGmAHf+R2Dh2ot9/v0N7WybPuZl2pNVjJIxrnk h524R7Y9djaM6JzH7xUUnNBQb3KyQw+clcpUvXY/s7ODZuUKag0ChCa6TQYuum6euale d/O1KXAu24GDivatkUK41ZixTfpgnElcMnzBWpXfN3CirhY5IGTFIWUg1GZlsvrgAxuw sVAIAbVJeRUeQwvtUdrYAGMuyUf3UUel1rbXJb69SOCV9pziFoQpVTTuQT5s0ynCkASs z+4e7FqSg5x0oHijAoGDKlHSvPDtREaMWJoKNHuNij7udHyAgSSRQLDM1YqPM6YGJHhp BRsw== X-Gm-Message-State: AHQUAubmy+z70XDdc1elAtuu4NiiAzHSS5rJhJrsxEzizTYBtPOWDQlq yAK1OfYn7hqxnZfxv1ByNpnQTcMmTYRFGYRT3CWcMsjt X-Google-Smtp-Source: AHgI3IaQEWHCNrVEQnmICyRZdiQeHKw1twHRMsVfXVc2Ld0BiWuoiTnGhG8b7byEcpmlzwtXYEm4RRGKROmrALuPFkY= X-Received: by 2002:a65:508b:: with SMTP id r11mr1408891pgp.242.1551247601914; Tue, 26 Feb 2019 22:06:41 -0800 (PST) MIME-Version: 1.0 From: Steve French Date: Wed, 27 Feb 2019 00:06:30 -0600 Message-ID: Subject: [PATCH] add dynamic trace points for compounded query/setinfo paths To: CIFS Cc: Pavel Shilovsky Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 From 7857c2f6a17851aac10232da9162b688b35dc368 Mon Sep 17 00:00:00 2001 From: Steve French 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 --- 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