From patchwork Sat Sep 29 03:36:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 10620609 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 88B0D112B for ; Sat, 29 Sep 2018 03:37:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 71A3F2B63A for ; Sat, 29 Sep 2018 03:37:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 655492BA9B; Sat, 29 Sep 2018 03:37:14 +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 AAD232B63A for ; Sat, 29 Sep 2018 03:37:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727396AbeI2KD6 (ORCPT ); Sat, 29 Sep 2018 06:03:58 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:33653 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727359AbeI2KD6 (ORCPT ); Sat, 29 Sep 2018 06:03:58 -0400 Received: by mail-pf1-f195.google.com with SMTP id d4-v6so5560761pfn.0 for ; Fri, 28 Sep 2018 20:37:12 -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=2lwROOB46lIofFlqF1DqVSWTOUNygJJfyssNRgbHijQ=; b=VJLbK8A7wf5iHKCHTNO3b8fRYpwcqiznfkWNkR2DGknqOUxEh3mV7SR8kELLU8/alf UDDToVHcqR+IxXzqn2IgXrrIyYWNhGDFcNKeQiw+a7mWfr/lB/L/BEpw0ORF4hgXhsXE Z6jHdqCiJcGTGqsX8S6RRcvzbcdOW5pKWApS1sWni9McpypluvDPCileRtkqVEgqnTTt dymYk6/3qWqBJceRS7GuZzY0Xm9QUT5ni7NS+KZDaJ3+jGW2IuSMCYkRFIwPFecKTvc9 /bo6e0VosFCMQqeVWi7V7HI7uiYZUOZhTeIHOGXD9d+tO31RoUCi+HZboG+0kiZ6W2Ao qnqQ== 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=2lwROOB46lIofFlqF1DqVSWTOUNygJJfyssNRgbHijQ=; b=DtCPJaYE/Czo3vMIi84v499LtKLnFnLojAveqW4M01AJNHphdb1dvQKN4QXxyKskz3 NIaTb7fOA9A85RVVHzwmTBi0YVpJp6xyCohh+hINoYBG7fWFO9bagv8y7vwES00CL73v 3YoAc/h7CLdlXrjZOaNoEJo0tpGzUTzifbw30XWjwnu+9PJ/Zz3dvD7NNuayhxt4ckX9 Sk3YFJ0qJnhEhbe/CMkDwI5VzkKyqpD+U0wW1MEMiaCtdnZFEO08YBsgzmpQ4ccn+r0o D9DPBlkP/7+qqxSP2hjWRcViEMVYnkIzQu455mgBDg6Nop/umOvCMl3ucZ8PWyfBGBG/ kXHg== X-Gm-Message-State: ABuFfogjW34OYpDm0YRGNgSynmIQeWu4rXVD+ag3D3zSTc/wurhiuMgA rsc3zhtiHq53Qm8HtBNaLjZdvl/UOuiGViBDoVVk0f1b X-Google-Smtp-Source: ACcGV6227Dw2qG587f02te7hPQjQEpLgW5UK18/lEzRmocrlXEN9thPqVMGUGMy9mVTBaggHw7DzpGRIj01mfSePzUo= X-Received: by 2002:a62:225d:: with SMTP id i90-v6mr1437809pfi.246.1538192231301; Fri, 28 Sep 2018 20:37:11 -0700 (PDT) MIME-Version: 1.0 From: Steve French Date: Fri, 28 Sep 2018 22:36:55 -0500 Message-ID: Subject: [PATCH] smb3: add tracepoint for sending lease break responses to server 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 Be able to log a ftrace message on success and/or failure of sending a lease break response to the server. Example output: TASK-PID CPU# |||| TIMESTAMP FUNCTION | | | |||| | | kworker/1:1-5681 [001] .... 11123.530457: smb3_lease_done: sid=0x291e3e0f tid=0x8ba43071 lease_key=0x1852ca0d3ecd9b55847750a86716fde lease_state=0x0 Signed-off-by: Steve French Reviewed-by: Aurelien Aptel --- fs/cifs/smb2pdu.c | 10 +++++- fs/cifs/trace.h | 79 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+), 1 deletion(-) char *hostname), From b459a4fdefa1dddc13337a683595e6db8f327b05 Mon Sep 17 00:00:00 2001 From: Steve French Date: Fri, 28 Sep 2018 19:44:23 -0500 Subject: [PATCH] smb3: add tracepoint for sending lease break responses to server Be able to log a ftrace message on success and/or failure of sending a lease break response to the server. Example output: TASK-PID CPU# |||| TIMESTAMP FUNCTION | | | |||| | | kworker/1:1-5681 [001] .... 11123.530457: smb3_lease_done: sid=0x291e3e0f tid=0x8ba43071 lease_key=0x1852ca0d3ecd9b55847750a86716fde lease_state=0x0 Signed-off-by: Steve French --- fs/cifs/smb2pdu.c | 10 +++++- fs/cifs/trace.h | 79 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+), 1 deletion(-) diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 5f1d9994fd7a..0628f1146fc5 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -4277,6 +4277,8 @@ SMB2_lease_break(const unsigned int xid, struct cifs_tcon *tcon, struct kvec iov[1]; struct kvec rsp_iov; int resp_buf_type; + __u64 *please_key_high; + __u64 *please_key_low; cifs_dbg(FYI, "SMB2_lease_break\n"); rc = smb2_plain_req_init(SMB2_OPLOCK_BREAK, tcon, (void **) &req, @@ -4306,10 +4308,16 @@ SMB2_lease_break(const unsigned int xid, struct cifs_tcon *tcon, rc = cifs_send_recv(xid, ses, &rqst, &resp_buf_type, flags, &rsp_iov); cifs_small_buf_release(req); + please_key_low = (__u64 *)req->LeaseKey; + please_key_high = (__u64 *)(req->LeaseKey+8); if (rc) { cifs_stats_fail_inc(tcon, SMB2_OPLOCK_BREAK_HE); + trace_smb3_lease_err(le32_to_cpu(lease_state), tcon->tid, + ses->Suid, *please_key_low, *please_key_high, rc); cifs_dbg(FYI, "Send error in Lease Break = %d\n", rc); - } + } else + trace_smb3_lease_done(le32_to_cpu(lease_state), tcon->tid, + ses->Suid, *please_key_low, *please_key_high); return rc; } diff --git a/fs/cifs/trace.h b/fs/cifs/trace.h index 43e5bd417b81..d18942164720 100644 --- a/fs/cifs/trace.h +++ b/fs/cifs/trace.h @@ -460,6 +460,85 @@ 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_lease_done_class, + TP_PROTO(__u32 lease_state, + __u32 tid, + __u64 sesid, + __u64 lease_key_low, + __u64 lease_key_high), + TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high), + TP_STRUCT__entry( + __field(__u32, lease_state) + __field(__u32, tid) + __field(__u64, sesid) + __field(__u64, lease_key_low) + __field(__u64, lease_key_high) + ), + TP_fast_assign( + __entry->lease_state = lease_state; + __entry->tid = tid; + __entry->sesid = sesid; + __entry->lease_key_low = lease_key_low; + __entry->lease_key_high = lease_key_high; + ), + TP_printk("sid=0x%llx tid=0x%x lease_key=0x%llx%llx lease_state=0x%x", + __entry->sesid, __entry->tid, __entry->lease_key_high, + __entry->lease_key_low, __entry->lease_state) +) + +#define DEFINE_SMB3_LEASE_DONE_EVENT(name) \ +DEFINE_EVENT(smb3_lease_done_class, smb3_##name, \ + TP_PROTO(__u32 lease_state, \ + __u32 tid, \ + __u64 sesid, \ + __u64 lease_key_low, \ + __u64 lease_key_high), \ + TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high)) + +DEFINE_SMB3_LEASE_DONE_EVENT(lease_done); + +DECLARE_EVENT_CLASS(smb3_lease_err_class, + TP_PROTO(__u32 lease_state, + __u32 tid, + __u64 sesid, + __u64 lease_key_low, + __u64 lease_key_high, + int rc), + TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high, rc), + TP_STRUCT__entry( + __field(__u32, lease_state) + __field(__u32, tid) + __field(__u64, sesid) + __field(__u64, lease_key_low) + __field(__u64, lease_key_high) + __field(int, rc) + ), + TP_fast_assign( + __entry->lease_state = lease_state; + __entry->tid = tid; + __entry->sesid = sesid; + __entry->lease_key_low = lease_key_low; + __entry->lease_key_high = lease_key_high; + __entry->rc = rc; + ), + TP_printk("sid=0x%llx tid=0x%x lease_key=0x%llx%llx lease_state=0x%x rc=%d", + __entry->sesid, __entry->tid, __entry->lease_key_high, + __entry->lease_key_low, __entry->lease_state, __entry->rc) +) + +#define DEFINE_SMB3_LEASE_ERR_EVENT(name) \ +DEFINE_EVENT(smb3_lease_err_class, smb3_##name, \ + TP_PROTO(__u32 lease_state, \ + __u32 tid, \ + __u64 sesid, \ + __u64 lease_key_low, \ + __u64 lease_key_high, \ + int rc), \ + TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high, rc)) + +DEFINE_SMB3_LEASE_ERR_EVENT(lease_err); + DECLARE_EVENT_CLASS(smb3_reconnect_class, TP_PROTO(__u64 currmid, char *hostname), -- 2.17.1