From patchwork Sun May 31 19:45:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 11580995 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 17585739 for ; Sun, 31 May 2020 19:45:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F2F2320723 for ; Sun, 31 May 2020 19:45:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="vC1upYum" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727084AbgEaTp2 (ORCPT ); Sun, 31 May 2020 15:45:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726882AbgEaTp2 (ORCPT ); Sun, 31 May 2020 15:45:28 -0400 Received: from mail-yb1-xb2f.google.com (mail-yb1-xb2f.google.com [IPv6:2607:f8b0:4864:20::b2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EC30C061A0E for ; Sun, 31 May 2020 12:45:28 -0700 (PDT) Received: by mail-yb1-xb2f.google.com with SMTP id u17so4116306ybi.0 for ; Sun, 31 May 2020 12:45:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=PWWGgV7lOf0aD0UjcTv3kbIjxrM4iXu+/Zc9puPkmX4=; b=vC1upYumMb0seoMA5NdXQVviiFqNsiat+9LpiROpqCfl9zu9dQgW0tYDlsHlot4Bnm vrxhYx4cvab5TEl0yJ5unwQHaRNOF+FJqZurGqnS5UrcFERkIWaylLFyCJoyNM9pbDNL aXti6bIUpifTpT+u25rVcvqOOLOnO1IYZKwrraW9Dhhkn5Q01KIYH2z57Km0mSFB0guZ eP4Da2Q6iIc6XIW7pwN/N8mu0vDGLFOT46PX9+s3q8JEOnExCXEkiW7V8iC6E0fhNw3w OcQReCIq7E22EwgDulqLwLxNanyidA3sXr6BfTNoBeLLzeY/C757BX+5mGJPXErIMs23 VKAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=PWWGgV7lOf0aD0UjcTv3kbIjxrM4iXu+/Zc9puPkmX4=; b=XVG5BgLHh5axmN1M6xfpW0TxspED8YHLOSr4/Q2qQUbWkeGS58I7F1Sbcp2D0LRr3L RX2S1o6TMH0FivBKYdxrD//ioRSyxO1aWhqTG5cnEpzkZIu3IYCS6boIZS5EKmIbUl/8 796VksYJWEyC49iOZ9Egd9F7uBs6bZ8kkvzd73w//WFeqnbW8+/XvJzDL4SFo02LeluC a3tLI3be+xHk3TNVG/02XyDo+/AGowo9defN2FUoQhchFbSbJviYSDCY+J11gizIndHj SI1vp2A2oRsCJtV1n55GzDTrZx9Ma0PMn2SVE4OyZquPuxZB/KLZGa1GJvpzmerKaopI KaIA== X-Gm-Message-State: AOAM530pPauww16N6LrnU2dLpaCaI4QsnEWgJlIsolfSn93MSGvzshS6 MDL6JQDxUlpO6HLzqZ4Z1y7gUeMYl4Se3aGH4JW5V8a2c7Y= X-Google-Smtp-Source: ABdhPJykTErxvEEZcSzdGQv5bZxmAx451ZE21qYuI2+iA+dOv+H9lcNYNeVmyyovP9D1bGUZTLc6z570smDzKNXsMaA= X-Received: by 2002:a25:6c6:: with SMTP id 189mr18013684ybg.375.1590954326932; Sun, 31 May 2020 12:45:26 -0700 (PDT) MIME-Version: 1.0 From: Steve French Date: Sun, 31 May 2020 14:45:16 -0500 Message-ID: Subject: [PATCH 4 of 4][SMB3] multichannel: try to rebind when reconnecting a channel To: CIFS , samba-technical Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Here is the final patch of Aurelien's 4 patch series for improving multichannel performance. There is still some work to do (on additional reconnect improvements e.g.) but the performance numbers in my testing looked really good. first steps in trying to make channels properly reconnect. * add cifs_ses_find_chan() function to find the enclosing cifs_chan struct it belongs to * while we have the session lock and are redoing negprot and sess.setup in smb2_reconnect() redo the binding of channels. Signed-off-by: Aurelien Aptel Signed-off-by: Steve French From 2d82ec2eff07b545c093097bb5bb9043c525a5e6 Mon Sep 17 00:00:00 2001 From: Aurelien Aptel Date: Fri, 24 Apr 2020 16:55:31 +0200 Subject: [PATCH 4/4] cifs: multichannel: try to rebind when reconnecting a channel first steps in trying to make channels properly reconnect. * add cifs_ses_find_chan() function to find the enclosing cifs_chan struct it belongs to * while we have the session lock and are redoing negprot and sess.setup in smb2_reconnect() redo the binding of channels. Signed-off-by: Aurelien Aptel Signed-off-by: Steve French --- fs/cifs/cifsproto.h | 2 ++ fs/cifs/sess.c | 16 ++++++++++++++++ fs/cifs/smb2pdu.c | 16 ++++++++++++++++ 3 files changed, 34 insertions(+) diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index 8fd44645e9b5..5852d74c1dde 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h @@ -592,6 +592,8 @@ void cifs_free_hash(struct crypto_shash **shash, struct sdesc **sdesc); extern void rqst_page_get_length(struct smb_rqst *rqst, unsigned int page, unsigned int *len, unsigned int *offset); +struct cifs_chan * +cifs_ses_find_chan(struct cifs_ses *ses, struct TCP_Server_Info *server); int cifs_try_adding_channels(struct cifs_ses *ses); int cifs_ses_add_channel(struct cifs_ses *ses, struct cifs_server_iface *iface); diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c index 9a426db21fae..ae6a8125e8cf 100644 --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c @@ -150,6 +150,22 @@ int cifs_try_adding_channels(struct cifs_ses *ses) return ses->chan_count - old_chan_count; } +/* + * If server is a channel of ses, return the corresponding enclosing + * cifs_chan otherwise return NULL. + */ +struct cifs_chan * +cifs_ses_find_chan(struct cifs_ses *ses, struct TCP_Server_Info *server) +{ + int i; + + for (i = 0; i < ses->chan_count; i++) { + if (ses->chans[i].server == server) + return &ses->chans[i]; + } + return NULL; +} + int cifs_ses_add_channel(struct cifs_ses *ses, struct cifs_server_iface *iface) { diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index e41cffd8c95b..341d1b60c5a6 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -355,15 +355,31 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon, goto out; } + /* + * If we are reconnecting an extra channel, bind + */ + if (server->is_channel) { + ses->binding = true; + ses->binding_chan = cifs_ses_find_chan(ses, server); + } + rc = cifs_negotiate_protocol(0, tcon->ses); if (!rc && tcon->ses->need_reconnect) { rc = cifs_setup_session(0, tcon->ses, nls_codepage); if ((rc == -EACCES) && !tcon->retry) { rc = -EHOSTDOWN; + ses->binding = false; + ses->binding_chan = NULL; mutex_unlock(&tcon->ses->session_mutex); goto failed; } } + /* + * End of channel binding + */ + ses->binding = false; + ses->binding_chan = NULL; + if (rc || !tcon->need_reconnect) { mutex_unlock(&tcon->ses->session_mutex); goto out; -- 2.20.1