From patchwork Wed Feb 27 01:14: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: 10830983 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 D862B1805 for ; Wed, 27 Feb 2019 01:15:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B28E62C733 for ; Wed, 27 Feb 2019 01:15:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A65A22C74E; Wed, 27 Feb 2019 01:15:36 +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 308142C733 for ; Wed, 27 Feb 2019 01:15:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729435AbfB0BOw (ORCPT ); Tue, 26 Feb 2019 20:14:52 -0500 Received: from mail-pg1-f176.google.com ([209.85.215.176]:39250 "EHLO mail-pg1-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729598AbfB0BOv (ORCPT ); Tue, 26 Feb 2019 20:14:51 -0500 Received: by mail-pg1-f176.google.com with SMTP id h8so6560477pgp.6 for ; Tue, 26 Feb 2019 17:14:50 -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; bh=OM/0csad5bkztAf7K9zzkCAHVvjMK1m17t/0RLvpaHY=; b=oJUBcVCeYi/CiDLCu5WQbE9M2ifSQ8IoqUU3PnbzeOusW6Jv2GrO1FLqvd06EQilfl +4hHUkwaDtxac86we/vnXW5H+Qop1gGbblDsUfXySoil6eNO9bO5jOcDBLSqp+QOo6e/ SW0YQrEJik5ZswANSjivAKkwpdA6MhCOfJ90fenizfx5V8xBcbrF5Y4f2wwe6frjlhao PeMT4/FhMDAGpssNoqaUFx5vbeZBuSgpcss6nXC6HahTUxuqiAHCoBUirSUcFnT+tkmQ qG74ePM/O5KFm9ZC/gqY7G08qMfprKv0S1EabxZ/vFiNJausc/W/7N5l6syAVivgTyJ8 qBvQ== 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=OM/0csad5bkztAf7K9zzkCAHVvjMK1m17t/0RLvpaHY=; b=rilERdTPPHNp/+JMDsw/LTuJoGI3yVM1cf8eusURsmN/GAv7wWCjF55VTuqhjaOKRs tRlE131jOGf5uFBDGQGrTUEW75o/7Jg6duncESF4sfs0HELIW6iRafZkYoqxaL5rnYEn cIS/Nh6rsPso+jS6+3HXuRATWUBh4sqM/NHKK/H5/09C7pMZzUQ2AuoWaNPVrM5mV4DH gILZ/Bmp4ulEhfKy9ghZYXux4abgURCvY7oqHfrmumpQr8lo9yA/K6xtwhoqPRRhW3JJ FS8E0R7C3Nw44tTJbjlHbeFjOihTj9Rpgn7ued3zdHeFPMhJqmdaT7CQFWoMp2rVqsLy JDZw== X-Gm-Message-State: AHQUAuYXl34mtkryA7WpOWzyAPr3TM9I1UgvpGMKGe1ObbrA6mVk1jX/ kdCzYnXUfoxdGZxX1HR4DmEahKQnRW5rOXAeP+aeMKGN X-Google-Smtp-Source: AHgI3IauDsvVKbwCK67oIRwyYy+EsQkihe3Cec89JbqbBhUV3UTAd/L123Ct5XB52Iu6K3dpMaVGzONhCLYFArhm8Lc= X-Received: by 2002:a63:8743:: with SMTP id i64mr342793pge.69.1551230089959; Tue, 26 Feb 2019 17:14:49 -0800 (PST) MIME-Version: 1.0 From: Steve French Date: Tue, 26 Feb 2019 19:14:37 -0600 Message-ID: Subject: [PATCH] Improve dynamic tracing of open and posix mkdir To: CIFS 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 Updated to limit it to open and mkdir (not compounded operations) with feedback from Pavel. Sample output # trace-cmd show # tracer: nop # # _-----=> irqs-off # / _----=> need-resched # | / _---=> hardirq/softirq # || / _--=> preempt-depth # ||| / delay # TASK-PID CPU# |||| TIMESTAMP FUNCTION # | | | |||| | | mkdir-19287 [002] .... 17897.136632: smb3_posix_mkdir_enter: xid=8 sid=0xd29a497f tid=0xbc99b185 cr_opts=0x1 des_access=0x100 mkdir-19287 [002] .... 17897.141109: smb3_posix_mkdir_done: xid=8 sid=0xd29a497f tid=0xbc99b185 fid=0x3d0ea06a cr_opts=0x1 des_access=0x100 touch-19289 [002] .... 17910.203266: smb3_open_enter: xid=12 sid=0xd29a497f tid=0xbc99b185 cr_opts=0x40 des_access=0x40000080 touch-19289 [002] .... 17910.214443: smb3_open_done: xid=12 sid=0xd29a497f tid=0xbc99b185 fid=0x74770519 cr_opts=0x40 des_access=0x40000080 Reviewed-by: Pavel Shilovsky From 6f09d3f03ec3490a964b9ef6983c79f389cd0e8c Mon Sep 17 00:00:00 2001 From: Steve French Date: Tue, 26 Feb 2019 19:08:12 -0600 Subject: [PATCH] smb3: improve dynamic tracing of open and posix mkdir Add dynamic trace point for open_enter (and mkdir enter) Signed-off-by: Steve French --- fs/cifs/smb2pdu.c | 5 +++++ fs/cifs/trace.h | 41 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index b774b43edfbd..5e34a7b54d1e 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -2196,6 +2196,8 @@ int smb311_posix_mkdir(const unsigned int xid, struct inode *inode, rqst.rq_iov = iov; rqst.rq_nvec = n_iov; + trace_smb3_posix_mkdir_enter(xid, tcon->tid, ses->Suid, CREATE_NOT_FILE, + FILE_WRITE_ATTRIBUTES); /* resource #4: response buffer */ rc = cifs_send_recv(xid, ses, &rqst, &resp_buftype, flags, &rsp_iov); if (rc) { @@ -2414,6 +2416,9 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path, if (rc) goto creat_exit; + trace_smb3_open_enter(xid, tcon->tid, tcon->ses->Suid, + oparms->create_options, oparms->desired_access); + rc = cifs_send_recv(xid, ses, &rqst, &resp_buftype, flags, &rsp_iov); rsp = (struct smb2_create_rsp *)rsp_iov.iov_base; diff --git a/fs/cifs/trace.h b/fs/cifs/trace.h index 660176e34dde..b6352b68f18b 100644 --- a/fs/cifs/trace.h +++ b/fs/cifs/trace.h @@ -411,8 +411,47 @@ DEFINE_SMB3_TCON_EVENT(tcon); /* - * For smb2/smb3 open call + * For smb2/smb3 open (including create and mkdir) calls */ + +DECLARE_EVENT_CLASS(smb3_open_enter_class, + TP_PROTO(unsigned int xid, + __u32 tid, + __u64 sesid, + int create_options, + int desired_access), + TP_ARGS(xid, tid, sesid, create_options, desired_access), + TP_STRUCT__entry( + __field(unsigned int, xid) + __field(__u32, tid) + __field(__u64, sesid) + __field(int, create_options) + __field(int, desired_access) + ), + TP_fast_assign( + __entry->xid = xid; + __entry->tid = tid; + __entry->sesid = sesid; + __entry->create_options = create_options; + __entry->desired_access = desired_access; + ), + TP_printk("xid=%u sid=0x%llx tid=0x%x cr_opts=0x%x des_access=0x%x", + __entry->xid, __entry->sesid, __entry->tid, + __entry->create_options, __entry->desired_access) +) + +#define DEFINE_SMB3_OPEN_ENTER_EVENT(name) \ +DEFINE_EVENT(smb3_open_enter_class, smb3_##name, \ + TP_PROTO(unsigned int xid, \ + __u32 tid, \ + __u64 sesid, \ + int create_options, \ + int desired_access), \ + TP_ARGS(xid, tid, sesid, create_options, desired_access)) + +DEFINE_SMB3_OPEN_ENTER_EVENT(open_enter); +DEFINE_SMB3_OPEN_ENTER_EVENT(posix_mkdir_enter); + DECLARE_EVENT_CLASS(smb3_open_err_class, TP_PROTO(unsigned int xid, __u32 tid, -- 2.17.1