Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp719315imm; Thu, 13 Sep 2018 06:47:36 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbhskYMWwuEz2d11R7ElCh5ha995ntV06y6095YFvaZKT1Om4JtYWv1FTJ/IZASDgI2H7Cx X-Received: by 2002:a17:902:1745:: with SMTP id i63-v6mr7393747pli.3.1536846456834; Thu, 13 Sep 2018 06:47:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536846456; cv=none; d=google.com; s=arc-20160816; b=YFNCCJrTuFC9jlPUhADpkUL9wbKn/n519NH8kqzLwggg+TGBJ7MkKolRVV+ACplzMT C0DeICMmvO7oRhwydYtty8QI8ZnLzPYvbjKutV0ig5u8YD3eUsyQio+0w6dHzzmN1wAN WyjtGsCA895IbBbFvjaQmSFTudC6MgxVBj2EgK89Ffwxc7Cg2+P723lfjMlhPnNvrKzz 5+K1XAmV+hTpXmsSslHDOmFzAaepeH6OiJ61X15yJ6HNDGvqLuXst+6/mvfJuYL9CnuT StZIa6g/XBx1oesJb5WQglyfTHB5etIBjiOSdhz3ONO98mxRYIB3VsQjFB8ybCsymQb2 8NOQ== 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=fdXhVghrz/g1AfhVrX+lkEq7s17AOu2k8i06uXwUIVQ=; b=Jh6fzmgYFTZCRoX3zXJvS5m87ryaSDSg33qOQpBq76VM3xAfHVh9UnrCNflCUr57mV R4GoBWDO/Fdwn7v6Z9WIn+M701Q0h+CbAL+WTmwRcU2rETIfYzx13xZw0kdC37ZHWL+O BOeGO9t16nmeT/Bag6DqrRrTelVLiexrNAT2tds0CkvzlcC7UfSevLxvsOH9acVfaFqv cylRX8PUxC+pTPjMro2SiJkPReBQEOiWFwPZ2k3Z8kY1SpIIvA/0r8f3BHmus7GGcVly AsjDiSr52LwzGfTeuMSXq8s+7FNlUoz3oGAO8XRvrIRwTusjpq0OqDHIy+U5JeUVLejU pr5g== 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 d3-v6si4320696pgk.610.2018.09.13.06.47.21; Thu, 13 Sep 2018 06:47:36 -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 S1730216AbeIMSze (ORCPT + 99 others); Thu, 13 Sep 2018 14:55:34 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:60786 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729449AbeIMSzd (ORCPT ); Thu, 13 Sep 2018 14:55:33 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 38741D10; Thu, 13 Sep 2018 13:46:00 +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.14 072/115] smb3: fix reset of bytes read and written stats Date: Thu, 13 Sep 2018 15:31:32 +0200 Message-Id: <20180913131828.114602175@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180913131823.327472833@linuxfoundation.org> References: <20180913131823.327472833@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.14-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 @@ -289,6 +289,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, @@ -301,6 +305,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); }