From patchwork Wed Oct 18 23:09:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Long Li X-Patchwork-Id: 10015517 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 4D9D5602C8 for ; Wed, 18 Oct 2017 23:14:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 40BC42868D for ; Wed, 18 Oct 2017 23:14:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 353E2287AD; Wed, 18 Oct 2017 23:14:27 +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.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 DB22C2868D for ; Wed, 18 Oct 2017 23:14:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751628AbdJRXNn (ORCPT ); Wed, 18 Oct 2017 19:13:43 -0400 Received: from a2nlsmtp01-05.prod.iad2.secureserver.net ([198.71.225.49]:37998 "EHLO a2nlsmtp01-05.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751516AbdJRXK5 (ORCPT ); Wed, 18 Oct 2017 19:10:57 -0400 Received: from linuxonhyperv.com ([107.180.71.197]) by : HOSTING RELAY : with SMTP id 4xT8ej0vRe1QA4xT8enUYB; Wed, 18 Oct 2017 16:09:55 -0700 x-originating-ip: 107.180.71.197 Received: from longli by linuxonhyperv.com with local (Exim 4.89) (envelope-from ) id 1e4xT8-0005VB-F2; Wed, 18 Oct 2017 16:09:46 -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, Tom Talpey , Matthew Wilcox , Stephen Hemminger Cc: Long Li Subject: [Patch v5 09/21] CIFS: SMBD: Implement function to destroy a SMB Direct connection Date: Wed, 18 Oct 2017 16:09:08 -0700 Message-Id: <20171018230920.21042-10-longli@exchange.microsoft.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171018230920.21042-1-longli@exchange.microsoft.com> References: <20171018230920.21042-1-longli@exchange.microsoft.com> X-CMAE-Envelope: MS4wfJ/BuENV/CbcvoHzu6kD93leXBo9w4Eu52IKW9LZtimYp644CkywumzA/Oq20/7gmihdtOclQhag4dlLw9aFEcViOQ8xordYIl8RHKUShVFG4iAwrQms MuEtgBiwaE7j+Jfo08XXMJzfiUbgxALeYbFA2DFMyz12Sla3krxvfwZlobHwoX4sMiMvSRXEcRKzrB7rtuOz9oXkEW4uE2Rmt1SHr6rQYqfkSTYmHWXgGvJD oghdvoj0CWaYM2d6LIbasTc0JIqg/U/UGe+J0x+71yGeCxhpH84VsLYSAM8oP77KX6qhNjmALb7wczoWqHa58M7VO0yYrr8+5HmBsGCJ7TTdebj2zruLU7+p othzHZl1RkRU0egbczJmaeVrobR99pMFdLxQycJXgaXdFEqj1KyOP3mWSe4UzlYRz7DprtJor04ycFpMICWcKSSJx8XUom74oyzhmJjIGjKhNL7hF1zGDoFK GsIYbxDS14rzdwuX 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 f54e7d8..f507de3 100644 --- a/fs/cifs/smbdirect.c +++ b/fs/cifs/smbdirect.c @@ -1392,6 +1392,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