From patchwork Thu May 31 02:47:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 923119 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=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Qg9tfmWj"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40xBj22m3pz9s0W for ; Thu, 31 May 2018 12:48:06 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932672AbeEaCsF (ORCPT ); Wed, 30 May 2018 22:48:05 -0400 Received: from mail-pg0-f46.google.com ([74.125.83.46]:33826 "EHLO mail-pg0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932621AbeEaCsE (ORCPT ); Wed, 30 May 2018 22:48:04 -0400 Received: by mail-pg0-f46.google.com with SMTP id k2-v6so9017082pgc.1 for ; Wed, 30 May 2018 19:48:04 -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=o16170goRFXT0SEsrqwXjKUUvWsbWSJ1NdjQ/jG+n3w=; b=Qg9tfmWj/u8Kg3y+wtjmJ7OCmQ9lyWddQxN1PAeefbquTJOFI70ZzzPWV9VSONbW0i IFn8meBOxEvILwvpqFW/qQHMqaX6KRYb48AdiQrxgUFBRoyjKUuzf6ICroLoLPhm9tyO K++8eJh2abW/0pYZkcUxwbBvQxukjFI9NMD4yZbKKCkKRhtYWGWyHtwxb63sHfNwNqno v08pymXAakHtt1gTcgOsIVxBH824cHwPXC0OpVXD5ZbDMiDDR0mTPI2DsxoIr9c0v+v4 rzA2CVEma1yME08OJe4GUJPIrCYR4VYyBLuqbB1G7m3EZL2Xk3CnMQG8qd7XdZj+we1c lFIg== 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=o16170goRFXT0SEsrqwXjKUUvWsbWSJ1NdjQ/jG+n3w=; b=dPPm0mVEbBjMs0ivERzcC5IG/62nffM5cOh9CC22h02egmiJihijPepPgcLoRXJw3m y74DjyoBR3txxB0dfE/Pj4NS2BMlWJI1MK7ucc/5opYGQh4H8ViqU3VDrsv//rMZ061p cnoEUigXJUgiMLwrd6/Wo+K29OL7V7CmKRQgLsuvPsH0s9pywk+zBGzIwwWTD0PbIE+X +/DrDO9wJ3muyrFIc8L3fVP88gRcHr5XF5TcGb/VkhKz2Au7wfJSuwsitUIcBOlLbrxC MaIKCUCzWCSH9fcVWlHaLsiCrXFk42rRzdlHMIW1/uFYb0pBsZZFP31okuszBdYlepqg Edxw== X-Gm-Message-State: ALKqPwfUxLaeN3oKLEY025OTrjXFJMGwtRRyKDNDRgzP4YQOiatIwGBA Kqg8ZVwI/cXn4xHBPFMsHfXnNS2vKae5EVYqhFDLKg== X-Google-Smtp-Source: ADUXVKIrU79p9QQe2eEn9iD6BXDHLFyuBNOVcNf3klzE2+N4mgtg6Y0dV6hLne/0jXa4X74VlnLgq7zhvyTaZhdc0Kg= X-Received: by 2002:a62:581:: with SMTP id 123-v6mr5156999pff.38.1527734883565; Wed, 30 May 2018 19:48:03 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a17:90a:80cc:0:0:0:0 with HTTP; Wed, 30 May 2018 19:47:42 -0700 (PDT) From: Steve French Date: Wed, 30 May 2018 21:47:42 -0500 Message-ID: Subject: [patch][smb3] Add tracepoints for smb2_open_done and smb2_open_err To: CIFS Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Add two additional traceptoints From 28d59363ae746d01e7841479da718631f941353d Mon Sep 17 00:00:00 2001 From: Steve French Date: Wed, 30 May 2018 21:42:34 -0500 Subject: [PATCH] smb3: add tracepoints for smb2/smb3 open add two tracepoints for open completion. One for error one for completion (open_done). Sample output below TASK-PID CPU# |||| TIMESTAMP FUNCTION | | | |||| | | bash-15348 [007] .... 42441.027492: smb3_enter: cifs_lookup: xid=45 bash-15348 [007] .... 42441.028214: smb3_cmd_err: sid=0x6173e4ce tid=0xa05150e6 cmd=5 mid=105 status=0xc0000034 rc=-2 bash-15348 [007] .... 42441.028219: smb3_open_err: xid=45 sid=0x6173e4ce tid=0xa05150e6 cr_opts=0x0 des_access=0x80 rc=-2 bash-15348 [007] .... 42441.028225: smb3_exit_done: cifs_lookup: xid=45 fop777-24560 [002] .... 42442.627617: smb3_enter: cifs_revalidate_dentry_attr: xid=46 fop777-24560 [003] .... 42442.628301: smb3_cmd_err: sid=0x6173e4ce tid=0xa05150e6 cmd=5 mid=106 status=0xc0000034 rc=-2 fop777-24560 [003] .... 42442.628319: smb3_open_err: xid=46 sid=0x6173e4ce tid=0xa05150e6 cr_opts=0x0 des_access=0x80 rc=-2 fop777-24560 [003] .... 42442.628335: smb3_enter: cifs_atomic_open: xid=47 fop777-24560 [003] .... 42442.629587: smb3_cmd_done: sid=0x6173e4ce tid=0xa05150e6 cmd=5 mid=107 fop777-24560 [003] .... 42442.629592: smb3_open_done: xid=47 sid=0x6173e4ce tid=0xa05150e6 fid=0xb8a0984d cr_opts=0x40 des_access=0x40000080 Signed-off-by: Steve French --- fs/cifs/smb2pdu.c | 7 +++- fs/cifs/trace.h | 86 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+), 1 deletion(-) diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 5e947db322a7..6436e9187045 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -1975,8 +1975,13 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path, resp_buftype = CIFS_NO_BUFFER; rsp = NULL; } + trace_smb3_open_err(xid, tcon->tid, ses->Suid, + oparms->create_options, oparms->desired_access, rc); goto creat_exit; - } + } else + trace_smb3_open_done(xid, rsp->PersistentFileId, tcon->tid, + ses->Suid, oparms->create_options, + oparms->desired_access); oparms->fid->persistent_fid = rsp->PersistentFileId; oparms->fid->volatile_fid = rsp->VolatileFileId; diff --git a/fs/cifs/trace.h b/fs/cifs/trace.h index 9bba8e1b00ba..61e74d455d90 100644 --- a/fs/cifs/trace.h +++ b/fs/cifs/trace.h @@ -335,6 +335,92 @@ DEFINE_EVENT(smb3_enter_exit_class, smb3_##name, \ DEFINE_SMB3_ENTER_EXIT_EVENT(enter); DEFINE_SMB3_ENTER_EXIT_EVENT(exit_done); +/* + * For smb2/smb3 open call + */ +DECLARE_EVENT_CLASS(smb3_open_err_class, + TP_PROTO(unsigned int xid, + __u32 tid, + __u64 sesid, + int create_options, + int desired_access, + int rc), + TP_ARGS(xid, tid, sesid, create_options, desired_access, rc), + TP_STRUCT__entry( + __field(unsigned int, xid) + __field(__u32, tid) + __field(__u64, sesid) + __field(int, create_options) + __field(int, desired_access) + __field(int, rc) + ), + TP_fast_assign( + __entry->xid = xid; + __entry->tid = tid; + __entry->sesid = sesid; + __entry->create_options = create_options; + __entry->desired_access = desired_access; + __entry->rc = rc; + ), + TP_printk("xid=%u sid=0x%llx tid=0x%x cr_opts=0x%x des_access=0x%x rc=%d", + __entry->xid, __entry->sesid, __entry->tid, + __entry->create_options, __entry->desired_access, __entry->rc) +) + +#define DEFINE_SMB3_OPEN_ERR_EVENT(name) \ +DEFINE_EVENT(smb3_open_err_class, smb3_##name, \ + TP_PROTO(unsigned int xid, \ + __u32 tid, \ + __u64 sesid, \ + int create_options, \ + int desired_access, \ + int rc), \ + TP_ARGS(xid, tid, sesid, create_options, desired_access, rc)) + +DEFINE_SMB3_OPEN_ERR_EVENT(open_err); + + +DECLARE_EVENT_CLASS(smb3_open_done_class, + TP_PROTO(unsigned int xid, + __u64 fid, + __u32 tid, + __u64 sesid, + int create_options, + int desired_access), + TP_ARGS(xid, fid, tid, sesid, create_options, desired_access), + TP_STRUCT__entry( + __field(unsigned int, xid) + __field(__u64, fid) + __field(__u32, tid) + __field(__u64, sesid) + __field(int, create_options) + __field(int, desired_access) + ), + TP_fast_assign( + __entry->xid = xid; + __entry->fid = fid; + __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 fid=0x%llx cr_opts=0x%x des_access=0x%x", + __entry->xid, __entry->sesid, __entry->tid, __entry->fid, + __entry->create_options, __entry->desired_access) +) + +#define DEFINE_SMB3_OPEN_DONE_EVENT(name) \ +DEFINE_EVENT(smb3_open_done_class, smb3_##name, \ + TP_PROTO(unsigned int xid, \ + __u64 fid, \ + __u32 tid, \ + __u64 sesid, \ + int create_options, \ + int desired_access), \ + TP_ARGS(xid, fid, tid, sesid, create_options, desired_access)) + +DEFINE_SMB3_OPEN_DONE_EVENT(open_done); + #endif /* _CIFS_TRACE_H */ #undef TRACE_INCLUDE_PATH -- 2.17.0