Received: by 10.223.164.197 with SMTP id h5csp686553wrb; Sat, 4 Nov 2017 22:51:19 -0700 (PDT) X-Google-Smtp-Source: ABhQp+TgBztM0Gw7uHicVcK/WD1vmAXTZKH5wCYNY9FuEbcql/3aHr0wsIzoBVPiCImLrh7FXSd+ X-Received: by 10.159.247.199 with SMTP id v7mr11077258plz.321.1509861079383; Sat, 04 Nov 2017 22:51:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509861079; cv=none; d=google.com; s=arc-20160816; b=eGXe665iQa6wV6zDZq0sNZ+Y9T4MXEfLYViOe8T0hn5teeZXJCbwQnv4WQUdGNgzSA z+/BL4wIrX0xCEwKilFjw3XuVntqRuUSaeIxMc37uh6p/lGRkDf2jPDpwbLEp3VEINgg DoutejzEt8Boj3ouJKHA7IEhU2L/NBSBNdbdzA6XalkQVoZZYm/hT5Rd52JavCYPozmy nZ2hupsfQsl2Vy7i/hqSh4jaMfVXGbAn2mbWANBc3kVStQD3IeKuPNG7QWrGosYhYhEB zIq6ItTtgIKr805ccL+Q1vFdm8VaDibeEwGGyXOy1Saatg8aoDDWIyk/o0Xyc7VOs+jF WPaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=Fu6ul3U723GqDGtI0s6m8qAEfQXrV2j+R1SMNxw5zeI=; b=hsCUP4x8h0bW+tdjPchMYsedJ4bR8AglYcT9NOG1YieHpb61Ybe7u29N+ttTihRsSR 8aGd+OK8Iu6qHJyEbGlf55zrCAGNxBT7Xmvveq0uGlfxUS06sGkJeHtGpqgd6PZcmWKz R6XcVIIbjez4U1rP9I3qk2KFbFY7AADFHIQIotzKJ9mAtFdo4EdFO8eEy7SNnf/pJfYD +4dzg5vHGVFe/Y65x7Nw/c6+8jx7nZ0XCKUzhgMsjIxQEupPU4yhRBxX5nHB+AgRyGIV 8CshhI7dLCT5gdBKOQXWa0GEatqx3jKWrZ7NPY/m7bVkQVGSmSZ/xja7zpgHWNIFjcaX NesA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=exchange.microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b9si9308278pgu.17.2017.11.04.22.51.06; Sat, 04 Nov 2017 22:51:19 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=exchange.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753380AbdKEFtM (ORCPT + 96 others); Sun, 5 Nov 2017 01:49:12 -0400 Received: from a2nlsmtp01-03.prod.iad2.secureserver.net ([198.71.225.37]:57420 "EHLO a2nlsmtp01-03.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750844AbdKEFpx (ORCPT ); Sun, 5 Nov 2017 01:45:53 -0400 Received: from linuxonhyperv.com ([107.180.71.197]) by : HOSTING RELAY : with SMTP id BDjUelRlBKv33BDjUekKcW; Sat, 04 Nov 2017 22:44:52 -0700 x-originating-ip: 107.180.71.197 Received: from longli by linuxonhyperv.com with local (Exim 4.89) (envelope-from ) id 1eBDjU-0006Eo-GQ; Sat, 04 Nov 2017 22:44:32 -0700 From: Long Li To: Steve French , linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, Christoph Hellwig , Tom Talpey , Matthew Wilcox , Stephen Hemminger Cc: Long Li Subject: [Patch v6 09/22] CIFS: SMBD: Implement function to reconnect to a SMB Direct transport Date: Sat, 4 Nov 2017 22:43:51 -0700 Message-Id: <20171105054404.23886-10-longli@exchange.microsoft.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171105054404.23886-1-longli@exchange.microsoft.com> References: <20171105054404.23886-1-longli@exchange.microsoft.com> X-CMAE-Envelope: MS4wfOydmL2V0YaE7d+okmNHChkgrrlfAE8j4yxuWyV5qMJzOUL6I/AbTzA9Xr2lwjXOmImfEdG//2hPv5J2Bxs6DCSWwagCPgyYESXWchWASy6Tvz6ebU9Y aBk0Wvik9oUpZXej5dxLJLYhuI6vyEmG9Sws5efV8VcHRFr7Dwsffb7wSIcu0RlOv6/cqJws8L1QSz91AJEK7mLDz5Mzt39QUxXHIWcfY+Dfwrqol7rShO7C qLYyIUzUS8YHM4h9MGQNjhVqBh1Wyj+HWCyReWpCIbIGCycCq3EQjks2Dx0AojgHeqyAUJ+WRwPQzf2VKJ3hpJ1R6JwwGZiRU906bFY3CwOckH96niZ/fvcf DpbVrbIKkAMg5YjF9kKE6fSzrOce7wjyPRm9D3scD2kNNsP0bTl8VhQOPtNmJhXEGTjEoS/LUQ3uOLde+whVOVHyFQUHK2JbXzxihygujPy4t6/fSIRMlGkT +yZ3vTr/+ShU9bepqxSqcN9S98OLApvmD6eBBA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Long Li Add function to implement a reconnect to SMB Direct. This involves tearing down the current connection and establishing/negotiating a new connection. Signed-off-by: Long Li --- fs/cifs/smbdirect.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/fs/cifs/smbdirect.c b/fs/cifs/smbdirect.c index 47d999f..f3ae3dc 100644 --- a/fs/cifs/smbdirect.c +++ b/fs/cifs/smbdirect.c @@ -1393,6 +1393,42 @@ static void idle_connection_timer(struct work_struct *work) info->keep_alive_interval*HZ); } +/* + * Reconnect this SMBD connection, called from upper layer + * return value: 0 on success, or actual error code + */ +int smbd_reconnect(struct TCP_Server_Info *server) +{ + log_rdma_event(INFO, "reconnecting rdma session\n"); + + if (!server->smbd_conn) { + log_rdma_event(ERR, "rdma session already destroyed\n"); + return -EINVAL; + } + + /* + * This is possible if transport is disconnected and we haven't received + * notification from RDMA, but upper layer has detected timeout + */ + if (server->smbd_conn->transport_status == SMBD_CONNECTED) { + log_rdma_event(INFO, "disconnecting transport\n"); + smbd_disconnect_rdma_connection(server->smbd_conn); + } + + /* wait until the transport is destroyed */ + wait_event(server->smbd_conn->wait_destroy, + server->smbd_conn->transport_status == SMBD_DESTROYED); + + destroy_workqueue(server->smbd_conn->workqueue); + kfree(server->smbd_conn); + + log_rdma_event(INFO, "creating rdma session\n"); + server->smbd_conn = smbd_get_connection( + server, (struct sockaddr *) &server->dstaddr); + + return server->smbd_conn ? 0 : -ENOENT; +} + static void destroy_caches_and_workqueue(struct smbd_connection *info) { destroy_receive_buffers(info); -- 2.7.4 From 1583176862597072542@xxx Sat Nov 04 22:38:32 +0000 2017 X-GM-THRID: 1583085205353134492 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread