From patchwork Tue Sep 3 23:43:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 1157404 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="tBu0BbZ9"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 46NNng3PbHz9sP3 for ; Wed, 4 Sep 2019 09:43:51 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726177AbfICXnu (ORCPT ); Tue, 3 Sep 2019 19:43:50 -0400 Received: from mail-io1-f54.google.com ([209.85.166.54]:33429 "EHLO mail-io1-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726451AbfICXnu (ORCPT ); Tue, 3 Sep 2019 19:43:50 -0400 Received: by mail-io1-f54.google.com with SMTP id m11so8083913ioo.0 for ; Tue, 03 Sep 2019 16:43:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=eMI5R1XNLBGpqSIPvixX15Za/Km4574QwAhHM/+if6g=; b=tBu0BbZ9tQgby0lMxShBLpfp19wm9IX6o5tHDeWGY0EXNXEnuvn2pcSyjki1rQ5SOc rALZJF6yOW7EvSN7oh0BNC9yX+fRkMEZ3MOdSOK79PUoay3ViMVVOy/RQdYOEmT0TzvX vUsN0FlyIrz/CR8U0cBiJ2AaVi+/zYXsBUPn1EduOwj0mSZcpGepbJ8HgrpMbpDaGITo 9p92UltmxoIJaqMO0oFmEQqr0ik3YDqq0G0MSSXGNXE1dnPfkfFtLeElogMPa1r5hknm ym2rW/UUwuFBIe10c3JDMWxh6quaQBWcLUMFOaEuT/kDkMHAzjSB7+Ya71YzQ0IqpoQY MbXQ== 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; bh=eMI5R1XNLBGpqSIPvixX15Za/Km4574QwAhHM/+if6g=; b=BGPucHj0GKxR6ZGIhhTMGPaT7Clt94gKlOaXgbRQ7bhWJgC85JA2d2FHtbKM32m9Su dF3Vwtj9J4LQAG1RLxswI5m5guFA6g6V6jHzjVnXbp7txiYcZzOdkHoh+FM74qHAlc4c UYfUX0czqoigrt7ZSY5g/abWdkaDOcyVlw5TuJLSUtsVng9EI3+TdpOLtcHNlxKC8gxG qdYzDM8lKh3VwfT/VzgimlT2eQBeMn/0/K65BwaP5ZIhEKxpkQkQfwgHOxlqMnIGbsJc be/oCrAelVnVtjNRB0+Q0gt/5qB6xqkjDGWejFRiofoCwmyjgjLhq4s9/gfZoVITq+4+ wvsw== X-Gm-Message-State: APjAAAXkg2CSlBR4IB8ZkwB8PHXdR34bcYflwkdoeaO60nWETAlCyg3M wtoQiGNf7z1+3HY4q1sQSnovtDEeYnZuUC6r3w3dQGSTUk4= X-Google-Smtp-Source: APXvYqzJpMp526oRErim1MRgt6o2MhZrTfYlqlJLbbHPYwL2QlWoo0XUZEg7PSnahIRyBWjdqLqeJLEfi37GW7NlMQo= X-Received: by 2002:a5d:9c4c:: with SMTP id 12mr1378404iof.5.1567554229107; Tue, 03 Sep 2019 16:43:49 -0700 (PDT) MIME-Version: 1.0 From: Steve French Date: Tue, 3 Sep 2019 18:43:37 -0500 Message-ID: Subject: [SMB3][PATCH] Add four more dynamic tracepoints To: CIFS Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Add four more dynamic tracepoints (for flush enter and non-error exit, and for close enter and non-error exit - we already had them for flush error and close error). For example: cp-22823 [002] .... 123439.179701: smb3_enter: _cifsFileInfo_put: xid=10 cp-22823 [002] .... 123439.179705: smb3_close_enter: xid=10 sid=0x98871327 tid=0xfcd585ff fid=0xc7f84682 cp-22823 [002] .... 123439.179711: smb3_cmd_enter: sid=0x98871327 tid=0xfcd585ff cmd=6 mid=43 cp-22823 [002] .... 123439.180175: smb3_cmd_done: sid=0x98871327 tid=0xfcd585ff cmd=6 mid=43 cp-22823 [002] .... 123439.180179: smb3_close_done: xid=10 sid=0x98871327 tid=0xfcd585ff fid=0xc7f84682 dd-22981 [003] .... 123696.946011: smb3_flush_enter: xid=24 sid=0x98871327 tid=0xfcd585ff fid=0x1917736f dd-22981 [003] .... 123696.946013: smb3_cmd_enter: sid=0x98871327 tid=0xfcd585ff cmd=7 mid=123 dd-22981 [003] .... 123696.956639: smb3_cmd_done: sid=0x98871327 tid=0x0 cmd=7 mid=123 dd-22981 [003] .... 123696.956644: smb3_flush_done: xid=24 sid=0x98871327 tid=0xfcd585ff fid=0x1917736f Reviewed-by: Ronnie Sahlberg From b069788a03920cd6212ac656a2864571f2cc1c7d Mon Sep 17 00:00:00 2001 From: Steve French Date: Tue, 3 Sep 2019 18:35:42 -0500 Subject: [PATCH] smb3: add dynamic tracepoints for flush and close We only had dynamic tracepoints on errors in flush and close, but may be helpful to trace enter and non-error exits for those. Sample trace examples (excerpts) from "cp" and "dd" show two of the new tracepoints. cp-22823 [002] .... 123439.179701: smb3_enter: _cifsFileInfo_put: xid=10 cp-22823 [002] .... 123439.179705: smb3_close_enter: xid=10 sid=0x98871327 tid=0xfcd585ff fid=0xc7f84682 cp-22823 [002] .... 123439.179711: smb3_cmd_enter: sid=0x98871327 tid=0xfcd585ff cmd=6 mid=43 cp-22823 [002] .... 123439.180175: smb3_cmd_done: sid=0x98871327 tid=0xfcd585ff cmd=6 mid=43 cp-22823 [002] .... 123439.180179: smb3_close_done: xid=10 sid=0x98871327 tid=0xfcd585ff fid=0xc7f84682 dd-22981 [003] .... 123696.946011: smb3_flush_enter: xid=24 sid=0x98871327 tid=0xfcd585ff fid=0x1917736f dd-22981 [003] .... 123696.946013: smb3_cmd_enter: sid=0x98871327 tid=0xfcd585ff cmd=7 mid=123 dd-22981 [003] .... 123696.956639: smb3_cmd_done: sid=0x98871327 tid=0x0 cmd=7 mid=123 dd-22981 [003] .... 123696.956644: smb3_flush_done: xid=24 sid=0x98871327 tid=0xfcd585ff fid=0x1917736f Signed-off-by: Steve French --- fs/cifs/smb2pdu.c | 10 ++++++++-- fs/cifs/trace.h | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 0e92983de0b7..4c9c34cdf05f 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -2918,6 +2918,7 @@ SMB2_close_flags(const unsigned int xid, struct cifs_tcon *tcon, rqst.rq_iov = iov; rqst.rq_nvec = 1; + trace_smb3_close_enter(xid, persistent_fid, tcon->tid, ses->Suid); rc = SMB2_close_init(tcon, &rqst, persistent_fid, volatile_fid); if (rc) goto close_exit; @@ -2930,7 +2931,9 @@ SMB2_close_flags(const unsigned int xid, struct cifs_tcon *tcon, trace_smb3_close_err(xid, persistent_fid, tcon->tid, ses->Suid, rc); goto close_exit; - } + } else + trace_smb3_close_done(xid, persistent_fid, tcon->tid, + ses->Suid); atomic_dec(&tcon->num_remote_opens); @@ -3353,13 +3356,16 @@ SMB2_flush(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, if (rc) goto flush_exit; + trace_smb3_flush_enter(xid, persistent_fid, tcon->tid, ses->Suid); rc = cifs_send_recv(xid, ses, &rqst, &resp_buftype, flags, &rsp_iov); if (rc != 0) { cifs_stats_fail_inc(tcon, SMB2_FLUSH_HE); trace_smb3_flush_err(xid, persistent_fid, tcon->tid, ses->Suid, rc); - } + } else + trace_smb3_flush_done(xid, persistent_fid, tcon->tid, + ses->Suid); flush_exit: SMB2_flush_free(&rqst); diff --git a/fs/cifs/trace.h b/fs/cifs/trace.h index 99c4d799c24b..f1339f4a2d07 100644 --- a/fs/cifs/trace.h +++ b/fs/cifs/trace.h @@ -117,6 +117,41 @@ DEFINE_SMB3_RW_DONE_EVENT(falloc_done); /* * For handle based calls other than read and write, and get/set info */ +DECLARE_EVENT_CLASS(smb3_fd_class, + TP_PROTO(unsigned int xid, + __u64 fid, + __u32 tid, + __u64 sesid), + TP_ARGS(xid, fid, tid, sesid), + TP_STRUCT__entry( + __field(unsigned int, xid) + __field(__u64, fid) + __field(__u32, tid) + __field(__u64, sesid) + ), + TP_fast_assign( + __entry->xid = xid; + __entry->fid = fid; + __entry->tid = tid; + __entry->sesid = sesid; + ), + TP_printk("\txid=%u sid=0x%llx tid=0x%x fid=0x%llx", + __entry->xid, __entry->sesid, __entry->tid, __entry->fid) +) + +#define DEFINE_SMB3_FD_EVENT(name) \ +DEFINE_EVENT(smb3_fd_class, smb3_##name, \ + TP_PROTO(unsigned int xid, \ + __u64 fid, \ + __u32 tid, \ + __u64 sesid), \ + TP_ARGS(xid, fid, tid, sesid)) + +DEFINE_SMB3_FD_EVENT(flush_enter); +DEFINE_SMB3_FD_EVENT(flush_done); +DEFINE_SMB3_FD_EVENT(close_enter); +DEFINE_SMB3_FD_EVENT(close_done); + DECLARE_EVENT_CLASS(smb3_fd_err_class, TP_PROTO(unsigned int xid, __u64 fid, -- 2.20.1