From patchwork Fri Feb 1 20:03:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 10793647 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 9881414E1 for ; Fri, 1 Feb 2019 20:04:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A47D32C9E for ; Fri, 1 Feb 2019 20:04:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E4BC330BE; Fri, 1 Feb 2019 20:04:26 +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 196D732C9E for ; Fri, 1 Feb 2019 20:04:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730302AbfBAUEZ (ORCPT ); Fri, 1 Feb 2019 15:04:25 -0500 Received: from mail-pg1-f172.google.com ([209.85.215.172]:42880 "EHLO mail-pg1-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729192AbfBAUEZ (ORCPT ); Fri, 1 Feb 2019 15:04:25 -0500 Received: by mail-pg1-f172.google.com with SMTP id d72so3417710pga.9 for ; Fri, 01 Feb 2019 12:04:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=fQMmL3qaWXSf0y+ycF2h9CuuA+10oAyqhSQqmtJm53E=; b=CxNVFQwClE7zSkGxR/WP9+iN42mb7pEozejN1PXd2BH5MVPkU32NC6cxnZHnWVPojf YuBgfM7AaLSQBcNzPrnqkTmcsiGX9TeaoZC79nnjL8HNRi+DMgev2ctRxHzG7QhDAVpi 31YPzwcDB10xxzyUkrL/czMy7QDzH2GcMopti8e/j/RrBseK1H7Q8KN9TVANcnbmlgu6 qrdHZrg6/AO+zekDUsBlT92vxvqihzWU2MCxm3Kv45dAE8Y5Zd1pfKyogiJhz5bh8ytH mFYypVMnocSESR1xpKEG9KQPYJduJVoKxnghde14P6aLYnsB6ddxPsMXICj1VDxdoPo2 XNTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=fQMmL3qaWXSf0y+ycF2h9CuuA+10oAyqhSQqmtJm53E=; b=O2teOaniVnAczfWVj20wym0umPUj4d2ltXZyejI4DXLMHs+Kz1vR11wjl8UiHY9Jbc 15vxt5X7G6okcxT12DNqVoDvWjimQfP1ftObxuz0kjXrb0ah6d2Ozd5NXi8+/OGytubc lB30NZgzhC7FEgSuZWGvvL6gbKipBtWKkCG2uAJRNY+gZum+EYX18geZv/bIyyl2JtJf vmumLCtmhOuXuKVXtCS05k2Oak46tKGN/SNUu8vxrJmvxaTdmIxvJC6kq+ymFaEcYG7o r9pHhnCVQTSH2pMOegcb6xhawkLutwYjgPJaToD/I6jHBcTWuHiKf81s6DURCbeNiscu UyZQ== X-Gm-Message-State: AHQUAub6mQ52kEHlDYNy49gptLTWw7bjhxMGdos0nceHtwgC6vO6f3+C wzgsU+JQm2sVIYMmUfVqiPGzNFA= X-Google-Smtp-Source: AHgI3IaFg1fQuIy/QQJf+zUKD1OPH4wQ6Vg9+xxxgjEs4i56VsHw++h5x2G0Hu44JO6FN4O/SMxWjg== X-Received: by 2002:a63:cf48:: with SMTP id b8mr3621411pgj.17.1549051463970; Fri, 01 Feb 2019 12:04:23 -0800 (PST) Received: from ubuntu-vm.corp.microsoft.com ([2001:4898:80e8:0:a18e:4e9f:6b7c:507d]) by smtp.gmail.com with ESMTPSA id x11sm24247451pfe.72.2019.02.01.12.04.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 01 Feb 2019 12:04:22 -0800 (PST) From: Pavel Shilovsky X-Google-Original-From: Pavel Shilovsky To: linux-cifs@vger.kernel.org Subject: [PATCH 02/23] CIFS: Fix trace command logging for SMB2 reads and writes Date: Fri, 1 Feb 2019 12:03:50 -0800 Message-Id: <1549051452-5968-3-git-send-email-pshilov@microsoft.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1549051452-5968-1-git-send-email-pshilov@microsoft.com> References: <1549051452-5968-1-git-send-email-pshilov@microsoft.com> 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 Currently we log success once we send an async IO request to the server. Instead we need to analyse a response and then log success or failure for a particular command. Also fix argument list for read logging. Cc: # 4.18 Signed-off-by: Pavel Shilovsky Signed-off-by: Steve French --- fs/cifs/smb2pdu.c | 46 ++++++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 2ff209e..4b5ab9c 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -3241,8 +3241,17 @@ smb2_readv_callback(struct mid_q_entry *mid) rdata->mr = NULL; } #endif - if (rdata->result) + if (rdata->result) { cifs_stats_fail_inc(tcon, SMB2_READ_HE); + trace_smb3_read_err(0 /* xid */, + rdata->cfile->fid.persistent_fid, + tcon->tid, tcon->ses->Suid, rdata->offset, + rdata->bytes, rdata->result); + } else + trace_smb3_read_done(0 /* xid */, + rdata->cfile->fid.persistent_fid, + tcon->tid, tcon->ses->Suid, + rdata->offset, rdata->got_bytes); queue_work(cifsiod_wq, &rdata->work); DeleteMidQEntry(mid); @@ -3317,13 +3326,11 @@ smb2_async_readv(struct cifs_readdata *rdata) if (rc) { kref_put(&rdata->refcount, cifs_readdata_release); cifs_stats_fail_inc(io_parms.tcon, SMB2_READ_HE); - trace_smb3_read_err(rc, 0 /* xid */, io_parms.persistent_fid, - io_parms.tcon->tid, io_parms.tcon->ses->Suid, - io_parms.offset, io_parms.length); - } else - trace_smb3_read_done(0 /* xid */, io_parms.persistent_fid, - io_parms.tcon->tid, io_parms.tcon->ses->Suid, - io_parms.offset, io_parms.length); + trace_smb3_read_err(0 /* xid */, io_parms.persistent_fid, + io_parms.tcon->tid, + io_parms.tcon->ses->Suid, + io_parms.offset, io_parms.length, rc); + } cifs_small_buf_release(buf); return rc; @@ -3367,10 +3374,11 @@ SMB2_read(const unsigned int xid, struct cifs_io_parms *io_parms, if (rc != -ENODATA) { cifs_stats_fail_inc(io_parms->tcon, SMB2_READ_HE); cifs_dbg(VFS, "Send error in read = %d\n", rc); + trace_smb3_read_err(xid, req->PersistentFileId, + io_parms->tcon->tid, ses->Suid, + io_parms->offset, io_parms->length, + rc); } - trace_smb3_read_err(rc, xid, req->PersistentFileId, - io_parms->tcon->tid, ses->Suid, - io_parms->offset, io_parms->length); free_rsp_buf(resp_buftype, rsp_iov.iov_base); return rc == -ENODATA ? 0 : rc; } else @@ -3459,8 +3467,17 @@ smb2_writev_callback(struct mid_q_entry *mid) wdata->mr = NULL; } #endif - if (wdata->result) + if (wdata->result) { cifs_stats_fail_inc(tcon, SMB2_WRITE_HE); + trace_smb3_write_err(0 /* no xid */, + wdata->cfile->fid.persistent_fid, + tcon->tid, tcon->ses->Suid, wdata->offset, + wdata->bytes, wdata->result); + } else + trace_smb3_write_done(0 /* no xid */, + wdata->cfile->fid.persistent_fid, + tcon->tid, tcon->ses->Suid, + wdata->offset, wdata->bytes); queue_work(cifsiod_wq, &wdata->work); DeleteMidQEntry(mid); @@ -3602,10 +3619,7 @@ smb2_async_writev(struct cifs_writedata *wdata, wdata->bytes, rc); kref_put(&wdata->refcount, release); cifs_stats_fail_inc(tcon, SMB2_WRITE_HE); - } else - trace_smb3_write_done(0 /* no xid */, req->PersistentFileId, - tcon->tid, tcon->ses->Suid, wdata->offset, - wdata->bytes); + } async_writev_out: cifs_small_buf_release(req);