From patchwork Wed Nov 20 16:15:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Aur=C3=A9lien_Aptel?= X-Patchwork-Id: 11254371 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EC09E6C1 for ; Wed, 20 Nov 2019 16:16:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D667B2071B for ; Wed, 20 Nov 2019 16:16:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728728AbfKTQQE (ORCPT ); Wed, 20 Nov 2019 11:16:04 -0500 Received: from mx2.suse.de ([195.135.220.15]:46662 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728305AbfKTQQE (ORCPT ); Wed, 20 Nov 2019 11:16:04 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 9A4A8B2F95; Wed, 20 Nov 2019 16:16:02 +0000 (UTC) From: Aurelien Aptel To: linux-cifs@vger.kernel.org Cc: smfrench@gmail.com, Aurelien Aptel Subject: [PATCH 1/2] cifs: dump channel info in DebugData Date: Wed, 20 Nov 2019 17:15:58 +0100 Message-Id: <20191120161559.30295-1-aaptel@suse.com> X-Mailer: git-send-email 2.16.4 Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org * show server&TCP states for extra channels * mention if an interface has a channel connected to it Signed-off-by: Aurelien Aptel --- fs/cifs/cifs_debug.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c index efb2928ff6c8..c2dd07903d56 100644 --- a/fs/cifs/cifs_debug.c +++ b/fs/cifs/cifs_debug.c @@ -121,6 +121,27 @@ static void cifs_debug_tcon(struct seq_file *m, struct cifs_tcon *tcon) seq_putc(m, '\n'); } +static void +cifs_dump_channel(struct seq_file *m, int i, struct cifs_chan *chan) +{ + struct TCP_Server_Info *server = chan->server; + + seq_printf(m, "\t\tChannel %d Number of credits: %d Dialect 0x%x " + "TCP status: %d Instance: %d Local Users To Server: %d " + "SecMode: 0x%x Req On Wire: %d In Send: %d " + "In MaxReq Wait: %d\n", + i+1, + server->credits, + server->dialect, + server->tcpStatus, + server->reconnect_instance, + server->srv_count, + server->sec_mode, + in_flight(server), + atomic_read(&server->in_send), + atomic_read(&server->num_waiters)); +} + static void cifs_dump_iface(struct seq_file *m, struct cifs_server_iface *iface) { @@ -377,6 +398,13 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v) if (ses->sign) seq_puts(m, " signed"); + if (ses->chan_count > 1) { + seq_printf(m, "\n\n\tExtra Channels: %lu\n", + ses->chan_count-1); + for (j = 1; j < ses->chan_count; j++) + cifs_dump_channel(m, j, &ses->chans[j]); + } + seq_puts(m, "\n\tShares:"); j = 0; @@ -415,8 +443,13 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v) seq_printf(m, "\n\tServer interfaces: %zu\n", ses->iface_count); for (j = 0; j < ses->iface_count; j++) { + struct cifs_server_iface *iface; + + iface = &ses->iface_list[j]; seq_printf(m, "\t%d)", j); - cifs_dump_iface(m, &ses->iface_list[j]); + cifs_dump_iface(m, iface); + if (is_ses_using_iface(ses, iface)) + seq_puts(m, "\t\t[CONNECTED]\n"); } spin_unlock(&ses->iface_lock); } From patchwork Wed Nov 20 16:15:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Aur=C3=A9lien_Aptel?= X-Patchwork-Id: 11254373 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C70C21593 for ; Wed, 20 Nov 2019 16:16:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A753820715 for ; Wed, 20 Nov 2019 16:16:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728247AbfKTQQG (ORCPT ); Wed, 20 Nov 2019 11:16:06 -0500 Received: from mx2.suse.de ([195.135.220.15]:46676 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728305AbfKTQQG (ORCPT ); Wed, 20 Nov 2019 11:16:06 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id AD353B2FA8; Wed, 20 Nov 2019 16:16:04 +0000 (UTC) From: Aurelien Aptel To: linux-cifs@vger.kernel.org Cc: smfrench@gmail.com, Aurelien Aptel Subject: [PATCH 2/2] cifs: try harder to open new channels Date: Wed, 20 Nov 2019 17:15:59 +0100 Message-Id: <20191120161559.30295-2-aaptel@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20191120161559.30295-1-aaptel@suse.com> References: <20191120161559.30295-1-aaptel@suse.com> Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Previously we would only loop over the iface list once. This patch tries to loop over multiple times until all channels are opened. It will also try to reuse RSS ifaces. Signed-off-by: Aurelien Aptel --- fs/cifs/sess.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c index ee6bf47b6cfe..fb3bdc44775c 100644 --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c @@ -76,6 +76,7 @@ int cifs_try_adding_channels(struct cifs_ses *ses) int left = ses->chan_max - ses->chan_count; int i = 0; int rc = 0; + int tries = 0; if (left <= 0) { cifs_dbg(FYI, @@ -89,29 +90,40 @@ int cifs_try_adding_channels(struct cifs_ses *ses) return 0; } - /* ifaces are sorted by speed, try them in order */ - for (i = 0; left > 0 && i < ses->iface_count; i++) { + /* + * Keep connecting to same, fastest, iface for all channels as + * long as its RSS. Try next fastest one if not RSS or channel + * creation fails. + */ + while (left > 0) { struct cifs_server_iface *iface; + tries++; + if (tries > 3*ses->chan_max) { + cifs_dbg(FYI, "too many attempt at opening channels (%d channels left to open)\n", + left); + break; + } + iface = &ses->iface_list[i]; - if (is_ses_using_iface(ses, iface) && !iface->rss_capable) + if (is_ses_using_iface(ses, iface) && !iface->rss_capable) { + i = (i+1) % ses->iface_count; continue; + } rc = cifs_ses_add_channel(ses, iface); if (rc) { - cifs_dbg(FYI, "failed to open extra channel\n"); + cifs_dbg(FYI, "failed to open extra channel on iface#%d rc=%d\n", + i, rc); + i = (i+1) % ses->iface_count; continue; } - cifs_dbg(FYI, "successfully opened new channel\n"); + cifs_dbg(FYI, "successfully opened new channel on iface#%d\n", + i); left--; } - /* - * TODO: if we still have channels left to open try to connect - * to same RSS-capable iface multiple times - */ - return ses->chan_count - old_chan_count; }