Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp733511imm; Thu, 13 Sep 2018 07:00:46 -0700 (PDT) X-Google-Smtp-Source: ANB0VdagoUFnpzztTjXUCOMut7BtC3NiInZmS5h00mbmUNH4mvMqonK2MXy1HzqjRNbcuaicCtQ6 X-Received: by 2002:a63:eb0e:: with SMTP id t14-v6mr7386407pgh.198.1536847246786; Thu, 13 Sep 2018 07:00:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536847246; cv=none; d=google.com; s=arc-20160816; b=dIAkat0Q+07MhZSJGEBSMKsrqfuZlR/6s4P7liIHUhV5n1GmgkrhQ1AJ2utiErprkJ /dRQIzE1KTHXSMcKkAol+DiOKo8M5US0rHNoCs6q8iAB8TcX5SlG0HHLWgUA9wPUDr64 oGDdjo+q8405TukCaz/4ZgyqleMvYgWahYkKFK+MEq4CKErWvj9PXnKNYSYV/xL+4per bDHipGpBbrZy5XPtjKZnQIX7w9iVCAvp7RWr9g4cAI79S3dkgCFrhfJ2PbIUoJtKO4BF SDwtBQePTauVIlrkq2eX9y1pHPEvRHuiyAwrqiLTj7X8IBjLt6NM/AH5VrEU2wN3eGQg Dcig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=PUbF31Zau8+mKErt8/TVhmxQ3J/rzeAdeN16Xy43MCQ=; b=HE8eKLJ65TusKF22NvTtSjIkno7WFz4CdPfyu01Xthgwp+SeV7t8Ay22ReALZGZ7Cq /B4WmBkaXR98sUAVrU1FJizI3EUnvOHf7UdIBKn5tsjnGF1UL6AZFCSAwHPsiwrSo8fO IujjhBvlBtyPoxCpi+VBCQapsCT2TvKEZMQ2WO+yX7YE0x9zle6Liha7sCz+zNv0Lr97 keQB+CQoq1StnbERwSQssoM+QjHznDDkTSYyv5UglGh+vq+ZmsRYZ++HelE3Tth20gEF zcwn03xMqbDg57OufLwKi7H7Yks/36yIA7meivFZO0PM0w+X3gxC3VCX6wTkgsQ5uInM Q/KA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p61-v6si4152301plb.55.2018.09.13.07.00.31; Thu, 13 Sep 2018 07:00:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731688AbeIMTIq (ORCPT + 99 others); Thu, 13 Sep 2018 15:08:46 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:34788 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729011AbeIMTIq (ORCPT ); Thu, 13 Sep 2018 15:08:46 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 63D03D15; Thu, 13 Sep 2018 13:59:08 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Steve French , Aurelien Aptel , Sasha Levin Subject: [PATCH 4.18 120/197] smb3: fix reset of bytes read and written stats Date: Thu, 13 Sep 2018 15:31:09 +0200 Message-Id: <20180913131846.345983527@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180913131841.568116777@linuxfoundation.org> References: <20180913131841.568116777@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Steve French [ Upstream commit c281bc0c7412308c7ec0888904f7c99353da4796 ] echo 0 > /proc/fs/cifs/Stats is supposed to reset the stats but there were four (see example below) that were not reset (bytes read and witten, total vfs ops and max ops at one time). ... 0 session 0 share reconnects Total vfs operations: 100 maximum at one time: 2 1) \\localhost\test SMBs: 0 Bytes read: 502092 Bytes written: 31457286 TreeConnects: 0 total 0 failed TreeDisconnects: 0 total 0 failed ... This patch fixes cifs_stats_proc_write to properly reset those four. Signed-off-by: Steve French Reviewed-by: Aurelien Aptel Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- fs/cifs/cifs_debug.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/fs/cifs/cifs_debug.c +++ b/fs/cifs/cifs_debug.c @@ -383,6 +383,10 @@ static ssize_t cifs_stats_proc_write(str atomic_set(&totBufAllocCount, 0); atomic_set(&totSmBufAllocCount, 0); #endif /* CONFIG_CIFS_STATS2 */ + spin_lock(&GlobalMid_Lock); + GlobalMaxActiveXid = 0; + GlobalCurrentXid = 0; + spin_unlock(&GlobalMid_Lock); spin_lock(&cifs_tcp_ses_lock); list_for_each(tmp1, &cifs_tcp_ses_list) { server = list_entry(tmp1, struct TCP_Server_Info, @@ -395,6 +399,10 @@ static ssize_t cifs_stats_proc_write(str struct cifs_tcon, tcon_list); atomic_set(&tcon->num_smbs_sent, 0); + spin_lock(&tcon->stat_lock); + tcon->bytes_read = 0; + tcon->bytes_written = 0; + spin_unlock(&tcon->stat_lock); if (server->ops->clear_stats) server->ops->clear_stats(tcon); }