From patchwork Fri Jan 25 01:47:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ronnie Sahlberg X-Patchwork-Id: 10780347 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 E295313B5 for ; Fri, 25 Jan 2019 01:47:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D17932EC4D for ; Fri, 25 Jan 2019 01:47:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C61272EC79; Fri, 25 Jan 2019 01:47:43 +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.9 required=2.0 tests=BAYES_00,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 6B8072EC4D for ; Fri, 25 Jan 2019 01:47:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728339AbfAYBrn (ORCPT ); Thu, 24 Jan 2019 20:47:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55256 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727983AbfAYBrn (ORCPT ); Thu, 24 Jan 2019 20:47:43 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0006931A32C; Fri, 25 Jan 2019 01:47:42 +0000 (UTC) Received: from test1135.test.redhat.com (vpn2-54-76.bne.redhat.com [10.64.54.76]) by smtp.corp.redhat.com (Postfix) with ESMTP id 874246DAF5; Fri, 25 Jan 2019 01:47:42 +0000 (UTC) From: Ronnie Sahlberg To: linux-cifs Cc: Steve French Subject: [PATCH] cifs: add a counter for number of reconnects to a server Date: Fri, 25 Jan 2019 11:47:33 +1000 Message-Id: <20190125014733.19868-2-lsahlber@redhat.com> In-Reply-To: <20190125014733.19868-1-lsahlber@redhat.com> References: <20190125014733.19868-1-lsahlber@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 25 Jan 2019 01:47:43 +0000 (UTC) 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 Signed-off-by: Ronnie Sahlberg --- fs/cifs/cifs_debug.c | 2 ++ fs/cifs/cifsglob.h | 4 ++++ fs/cifs/connect.c | 1 + 3 files changed, 7 insertions(+) diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c index e92a2fee3c57..35187a3399a8 100644 --- a/fs/cifs/cifs_debug.c +++ b/fs/cifs/cifs_debug.c @@ -327,6 +327,8 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v) atomic_read(&server->smbd_conn->mr_used_count)); skip_rdma: #endif + seq_printf(m, "\nNumber of reconnects: %d", + server->num_reconnects); seq_printf(m, "\nNumber of credits: %d Dialect 0x%x", server->credits, server->dialect); if (server->sign) diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 9f1d6315dc5c..011ed5de2a45 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -716,6 +716,10 @@ struct TCP_Server_Info { * reconnect. */ int nr_targets; + /* + * Number of reconnects. + */ + int num_reconnects; }; struct cifs_credits { diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 6ad2e6d379bd..0c401ddc0a6f 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -512,6 +512,7 @@ cifs_reconnect(struct TCP_Server_Info *server) /* do not want to be sending data on a socket we are freeing */ cifs_dbg(FYI, "%s: tearing down socket\n", __func__); mutex_lock(&server->srv_mutex); + server->num_reconnects++; if (server->ssocket) { cifs_dbg(FYI, "State: 0x%x Flags: 0x%lx\n", server->ssocket->state, server->ssocket->flags);