From patchwork Tue Jul 31 00:28:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 10549717 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 B9C6714E0 for ; Tue, 31 Jul 2018 00:28:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF55F2A1B4 for ; Tue, 31 Jul 2018 00:28:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A11D02A1B9; Tue, 31 Jul 2018 00:28:39 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, T_DKIM_INVALID,T_TVD_MIME_EPI 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 18EE72A1B4 for ; Tue, 31 Jul 2018 00:28:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732078AbeGaCGI (ORCPT ); Mon, 30 Jul 2018 22:06:08 -0400 Received: from mail-pf1-f173.google.com ([209.85.210.173]:43206 "EHLO mail-pf1-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732079AbeGaCGI (ORCPT ); Mon, 30 Jul 2018 22:06:08 -0400 Received: by mail-pf1-f173.google.com with SMTP id j26-v6so5258999pfi.10 for ; Mon, 30 Jul 2018 17:28:37 -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=cq8cms/n1zVSliABwTTsZHpyoGzlz645O79MuQFzAk8=; b=bAstIiVe8TS75XeC6sYTBC2ezuUnZ2f4dN415XJ49S7MXZc8UyHhuPLcSNIy62wlZT 8XSAAaBMoxYP9TB9jLalCZwx5yIeWyIWdTqY9rNUrVtmV/Tb8wrUcXZSoIypWBHI/mbr zLOe1mo0E8VfMwE9GdJkOOiM8t/uFlPwcdSQJU0QzVkYuzCB6ZtxzDWbaCCzIajtDG0z EOBGUcGdSNX0zDostG71OScsmhrMcuqKg90N0wsgi+7k79HCfmY+RPLrHKK/aLOtw+/8 KADpQ5CNtbKAPBSKjgTfxhQyWs8XQprQZypOPSnK4+8iKazIkdk5C535zv1s0Lijqi8C aWGQ== 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=cq8cms/n1zVSliABwTTsZHpyoGzlz645O79MuQFzAk8=; b=U/jFDEXeiHIwFq5oV2SNn2JYCppAmrgh/0a44VYM3sojuen6/e0dX81fe532rgEWhX 9qbUxCgJ0BaP8fa3mWeFangADpx3IWRlgYKo8eVb8S+qYx1Tmxj16tpglDuSSSjHjIZJ 0F8lsXOUtE3ZXCZIlFzD56n2SIcUbFgmjuF6nZDFshI0HRKaYpOASNIxWx8fDMf8vMoa E4/OjW6AyrPwJ3O1qYlSf4aSfYu943kmkWwmfFZUtmiUl6pcoXdctCTte3Y68MiDTD/X KTbTPPJiS+sYSOjhu7EUWs/82b5RTJnX71XhP15k2hs/rmY+z3LeVu5CRwAqd8HpSZLh 1cAA== X-Gm-Message-State: AOUpUlHdU3XYTXDmrGRHRdFd56DkwwSnPbyPd7W7j7TJBuinQBHefpdv 6S7fBPXMzkefNKHSl+0lY1t1DZTCxXSgfwsnApXiTx8/ X-Google-Smtp-Source: AAOMgpc1qi1UG15ZpjJpOSZoGN9cW7ICBcW6L7hF1GrOLNIM/67y0lgjm/RFUbr2IWlYexdsmQ9ih+ju3DVBeg8UBxY= X-Received: by 2002:a63:1d3:: with SMTP id 202-v6mr18092347pgb.136.1532996916606; Mon, 30 Jul 2018 17:28:36 -0700 (PDT) MIME-Version: 1.0 From: Steve French Date: Mon, 30 Jul 2018 19:28:25 -0500 Message-ID: Subject: [PATCH][SMB3] add reconnect tracepoints 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 Add tracepoints for reconnecting an smb3 session Example output (from trace-cmd) with the patch (showing the session marked for reconnect, the stat failing, and then the subsequent SMB3 commands after the server comes back up). The "smb3_reconnect" event is the new one. cifsd-25993 [000] .... 29635.368265: smb3_reconnect: server=localhost current_mid=0x1e stat-26200 [001] .... 29638.516403: smb3_enter: cifs_revalidate_dentry_attr: xid=22 stat-26200 [001] .... 29648.723296: smb3_exit_err: cifs_revalidate_dentry_attr: xid=22 rc=-112 kworker/0:1-22830 [000] .... 29653.850947: smb3_cmd_done: sid=0x0 tid=0x0 cmd=0 mid=0 kworker/0:1-22830 [000] .... 29653.851191: smb3_cmd_err: sid=0x8ae4683c tid=0x0 cmd=1 mid=1 status=0xc0000016 rc=-5 kworker/0:1-22830 [000] .... 29653.855254: smb3_cmd_done: sid=0x8ae4683c tid=0x0 cmd=1 mid=2 kworker/0:1-22830 [000] .... 29653.855482: smb3_cmd_done: sid=0x8ae4683c tid=0x8084f30d cmd=3 mid=3 Reviewed-by: Aurelien Aptel From 745929a07ac8b076d139f4479cb16b2b460cd335 Mon Sep 17 00:00:00 2001 From: Steve French Date: Mon, 30 Jul 2018 19:23:09 -0500 Subject: [PATCH] smb3: add reconnect tracepoints Add tracepoints for reconnecting an smb3 session Example output (from trace-cmd) with the patch (showing the session marked for reconnect, the stat failing, and then the subsequent SMB3 commands after the server comes back up). The "smb3_reconnect" event is the new one. cifsd-25993 [000] .... 29635.368265: smb3_reconnect: server=localhost current_mid=0x1e stat-26200 [001] .... 29638.516403: smb3_enter: cifs_revalidate_dentry_attr: xid=22 stat-26200 [001] .... 29648.723296: smb3_exit_err: cifs_revalidate_dentry_attr: xid=22 rc=-112 kworker/0:1-22830 [000] .... 29653.850947: smb3_cmd_done: sid=0x0 tid=0x0 cmd=0 mid=0 kworker/0:1-22830 [000] .... 29653.851191: smb3_cmd_err: sid=0x8ae4683c tid=0x0 cmd=1 mid=1 status=0xc0000016 rc=-5 kworker/0:1-22830 [000] .... 29653.855254: smb3_cmd_done: sid=0x8ae4683c tid=0x0 cmd=1 mid=2 kworker/0:1-22830 [000] .... 29653.855482: smb3_cmd_done: sid=0x8ae4683c tid=0x8084f30d cmd=3 mid=3 Signed-off-by: Steve French --- fs/cifs/connect.c | 1 + fs/cifs/trace.h | 26 ++++++++++++++++++++++++++ fs/cifs/transport.c | 2 ++ 3 files changed, 29 insertions(+) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 67f91a6313a0..d9bd10d295a9 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -348,6 +348,7 @@ cifs_reconnect(struct TCP_Server_Info *server) server->max_read = 0; cifs_dbg(FYI, "Reconnecting tcp session\n"); + trace_smb3_reconnect(server->CurrentMid, server->hostname); /* before reconnecting the tcp session, mark the smb session (uid) and the tid bad so they are not used until reconnected */ diff --git a/fs/cifs/trace.h b/fs/cifs/trace.h index 0fdf2f5c07ba..6b50b57e2416 100644 --- a/fs/cifs/trace.h +++ b/fs/cifs/trace.h @@ -423,6 +423,32 @@ DEFINE_EVENT(smb3_open_done_class, smb3_##name, \ DEFINE_SMB3_OPEN_DONE_EVENT(open_done); DEFINE_SMB3_OPEN_DONE_EVENT(posix_mkdir_done); +DECLARE_EVENT_CLASS(smb3_reconnect_class, + TP_PROTO(__u64 currmid, + char *hostname), + TP_ARGS(currmid, hostname), + TP_STRUCT__entry( + __field(__u64, currmid) + __field(char *, hostname) + ), + TP_fast_assign( + __entry->currmid = currmid; + __entry->hostname = hostname; + ), + TP_printk("server=%s current_mid=0x%llx", + __entry->hostname, + __entry->currmid) +) + +#define DEFINE_SMB3_RECONNECT_EVENT(name) \ +DEFINE_EVENT(smb3_reconnect_class, smb3_##name, \ + TP_PROTO(__u64 currmid, \ + char *hostname), \ + TP_ARGS(currmid, hostname)) + +DEFINE_SMB3_RECONNECT_EVENT(reconnect); +DEFINE_SMB3_RECONNECT_EVENT(partial_send_reconnect); + #endif /* _CIFS_TRACE_H */ #undef TRACE_INCLUDE_PATH diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index 0f9156af5eb0..357d25351ffa 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c @@ -361,6 +361,8 @@ __smb_send_rqst(struct TCP_Server_Info *server, int num_rqst, * socket so the server throws away the partial SMB */ server->tcpStatus = CifsNeedReconnect; + trace_smb3_partial_send_reconnect(server->CurrentMid, + server->hostname); } smbd_done: if (rc < 0 && rc != -EINTR) -- 2.17.1