From patchwork Sun Nov 5 05:43:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Long Li X-Patchwork-Id: 10041979 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 84D1C601EB for ; Sun, 5 Nov 2017 05:50:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7869C2962D for ; Sun, 5 Nov 2017 05:50:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6D6CD29636; Sun, 5 Nov 2017 05:50:21 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable 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 260B52962D for ; Sun, 5 Nov 2017 05:50:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750975AbdKEFtH (ORCPT ); Sun, 5 Nov 2017 01:49:07 -0400 Received: from a2nlsmtp01-03.prod.iad2.secureserver.net ([198.71.225.37]:57418 "EHLO a2nlsmtp01-03.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750839AbdKEFpx (ORCPT ); Sun, 5 Nov 2017 01:45:53 -0400 Received: from linuxonhyperv.com ([107.180.71.197]) by : HOSTING RELAY : with SMTP id BDjUelRlZKv33BDjUekKct; 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-0006F0-Ne; 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 11/22] CIFS: SMBD: Implement function to destroy a SMB Direct connection Date: Sat, 4 Nov 2017 22:43:53 -0700 Message-Id: <20171105054404.23886-12-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-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Long Li Add function to tear down a SMB Direct connection. This is used by upper layer to free all SMB Direct connection and transport resources. Signed-off-by: Long Li --- fs/cifs/smbdirect.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/fs/cifs/smbdirect.c b/fs/cifs/smbdirect.c index f3ae3dc..5952276 100644 --- a/fs/cifs/smbdirect.c +++ b/fs/cifs/smbdirect.c @@ -1393,6 +1393,22 @@ static void idle_connection_timer(struct work_struct *work) info->keep_alive_interval*HZ); } +/* Destroy this SMBD connection, called from upper layer */ +void smbd_destroy(struct smbd_connection *info) +{ + log_rdma_event(INFO, "destroying rdma session\n"); + + /* Kick off the disconnection process */ + smbd_disconnect_rdma_connection(info); + + log_rdma_event(INFO, "wait for transport being destroyed\n"); + wait_event(info->wait_destroy, + info->transport_status == SMBD_DESTROYED); + + destroy_workqueue(info->workqueue); + kfree(info); +} + /* * Reconnect this SMBD connection, called from upper layer * return value: 0 on success, or actual error code