From patchwork Mon Oct 2 02:30:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Long Li X-Patchwork-Id: 9980189 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 6C9AA60365 for ; Mon, 2 Oct 2017 02:36:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 57A5C2893A for ; Mon, 2 Oct 2017 02:36:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4C7D9289BE; Mon, 2 Oct 2017 02:36:51 +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=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 0EA5F2893A for ; Mon, 2 Oct 2017 02:36:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751916AbdJBCbz (ORCPT ); Sun, 1 Oct 2017 22:31:55 -0400 Received: from a2nlsmtp01-02.prod.iad2.secureserver.net ([198.71.225.36]:43320 "EHLO a2nlsmtp01-02.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751383AbdJBCbw (ORCPT ); Sun, 1 Oct 2017 22:31:52 -0400 Received: from linuxonhyperv.com ([107.180.71.197]) by : HOSTING RELAY : with SMTP id yqVHdsk4oiuNpyqVHdg8tq; Sun, 01 Oct 2017 19:30:51 -0700 x-originating-ip: 107.180.71.197 Received: from longli by linuxonhyperv.com with local (Exim 4.89) (envelope-from ) id 1dyqVH-0000xK-MH; Sun, 01 Oct 2017 19:30:43 -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 Cc: Long Li Subject: [Patch v4 09/22] CIFS: SMBD: Implement function to destroy a SMBDirect connection Date: Sun, 1 Oct 2017 19:30:17 -0700 Message-Id: <20171002023030.3582-10-longli@exchange.microsoft.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171002023030.3582-1-longli@exchange.microsoft.com> References: <20171002023030.3582-1-longli@exchange.microsoft.com> X-CMAE-Envelope: MS4wfNOCeAxPyG/VxwBwxwlzqFPI0uGDOOZwk0k2bcin23FEr+xfhtzOPvMB4144110CGuNkYQTftlE+ojPzqTBzOVQa0nQxo1vkLyWkbhjCh4spqWkeM9Ah h3gbJZvTHnA6d7x03I9HES9kV4Z7mmVosYbopPlv7aEhCEIO+jH24ngvSpWalyfHjmufUICdeILUA7IKFxglruTNKAE85zN3QJUpDyhZy7FSJAtRnaJe3B54 lcs2PU6/XM4PvFR/x/UfPXvsQ8vFIx41QQ/VT7s7AWcp2fXBYN6kokEPTYx87GX+siKOdTufaOqAQp+zc8WN4insSZFF2PA6TDQ+r8i6NWQeHaWCatZxyS25 Bis50yJEybHdaPrPwrpUTvMcdjAed7r7Sk24r5PGbjILlDKREHSOqEVBwI2cn4CS+NqAHcgWIOSH39cZ8g9Rv9ZvAySvVM77L0A/2KnyEAwgE3+YyiXgCyMK oqekXqbPvtRexXMA 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 SMBDirect connection. This is used by upper layer to free all SMBDirect connection and transport resources. Signed-off-by: Long Li --- fs/cifs/smbdirect.c | 16 ++++++++++++++++ fs/cifs/smbdirect.h | 3 +++ 2 files changed, 19 insertions(+) diff --git a/fs/cifs/smbdirect.c b/fs/cifs/smbdirect.c index 1f0f33c..cb129c2 100644 --- a/fs/cifs/smbdirect.c +++ b/fs/cifs/smbdirect.c @@ -1416,6 +1416,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 diff --git a/fs/cifs/smbdirect.h b/fs/cifs/smbdirect.h index 9818852..d14a484 100644 --- a/fs/cifs/smbdirect.h +++ b/fs/cifs/smbdirect.h @@ -252,6 +252,9 @@ struct smbd_connection *smbd_get_connection( /* Reconnect SMBDirect session */ int smbd_reconnect(struct TCP_Server_Info *server); +/* Destroy SMBDirect session */ +void smbd_destroy(struct smbd_connection *info); + void profiling_display_histogram( struct seq_file *m, unsigned long long array[]); #endif