Received: by 10.223.164.202 with SMTP id h10csp545787wrb; Tue, 7 Nov 2017 10:19:42 -0800 (PST) X-Google-Smtp-Source: ABhQp+RWzuW2foDziDVEFyuo5MahKlT6LLXpwD0mqBg860xi7u9LS4hwMFFphI/ygzgFwzmIZCsd X-Received: by 10.99.114.29 with SMTP id n29mr19505788pgc.237.1510078782045; Tue, 07 Nov 2017 10:19:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510078782; cv=none; d=google.com; s=arc-20160816; b=S7iuZc1gFwuApHcut/1sAg/zDlJZ1ekRob+7HVTtSTVLo8YkHo8lSotWpvCuhQW3/x wJe7YkOyTmNre/7z1taut748nsNZmaYZIW+hIPOzcBta5dwyqWLHVYyvqjowK1DrbAAv qzVjhLUqoQgHTaeof8Lh90LNlvzbKG0wJdWu9hAGEoEaA3T5nI9Qkr5+35kc8RTLquBW 91RTXGQC2td5bv/WhAv/hzZD4E6bhnUU16wrJCCZ78iFaB5uGxtxClhim27UMPQDVeae JlyZqJS8i8tiVyx3dtru8Ce0ajOtQAohHnN5A1EWFrKoDLJlAN1YBOndUDvFB8FhnZV8 tJcg== 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=AbnOvrBm48SAyPJklhI4bkHNnylVV4NhPJQq/OapeQA=; b=dwIQ92c4lqWx6izaDF4x3Ph2iB7S9mjJchYI8mRbHcBKXLKPw0tE55BtoTouUPT7l/ zsViWAFvY/iwk+cbl/lc8vwWFeHccloeipstwP8rbb6H9Ao6qMFklpdfIyf9huQicq0k R8ZCdxcbeT1enH6/K/KKW1brUAfsJP+FabvsUzp1XqH3IItpLwYFfIURhEhpdC2lLGUx hHEHOXRU2A+cd8IhUuRH+b0aV9sExN85Ln/vDOMocHbNeKUHoJeSd+of6cYoyULi98yG hk5ZDVzWbiBut2V+fNBvx3306ctDifGOUy3UjsgQCz3NyLBIvFrfhcvLExcnBWqOFhh8 Z/+g== 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 s137si1821022pgc.317.2017.11.07.10.19.28; Tue, 07 Nov 2017 10:19:42 -0800 (PST) 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 S1754067AbdKGI5Q (ORCPT + 91 others); Tue, 7 Nov 2017 03:57:16 -0500 Received: from a2nlsmtp01-02.prod.iad2.secureserver.net ([198.71.225.36]:34054 "EHLO a2nlsmtp01-02.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752195AbdKGI5G (ORCPT ); Tue, 7 Nov 2017 03:57:06 -0500 Received: from linuxonhyperv.com ([107.180.71.197]) by : HOSTING RELAY : with SMTP id BzfqebZ9POdJ4BzfqeYoom; Tue, 07 Nov 2017 01:56:05 -0700 x-originating-ip: 107.180.71.197 Received: from longli by linuxonhyperv.com with local (Exim 4.89) (envelope-from ) id 1eBzfq-0003L7-Co; Tue, 07 Nov 2017 01:55:58 -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 v7 09/22] CIFS: SMBD: Implement function to reconnect to a SMB Direct transport Date: Tue, 7 Nov 2017 01:55:01 -0700 Message-Id: <20171107085514.12693-10-longli@exchange.microsoft.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171107085514.12693-1-longli@exchange.microsoft.com> References: <20171107085514.12693-1-longli@exchange.microsoft.com> X-CMAE-Envelope: MS4wfKipmAxzaSlp55LBvBksFMnxPMQdG6tce0Ixn5uJyuzfMTeqNVvXxCp76VOOd7eUlpiUEA0woNYacwMxi8UhcZzEATfMY43kHUw8iyMsctgWtqI6K7bt iIXbOSrad7KDTHKphDTODRcliR07nw9D+TGCMF7LwZIEtHkjwuy1t/xsHDfV1tPlolIN80WaeLWiCk1PrmHJWGw/IQzrDCCfVGJsl6VtpakehnKuv8BbOaW1 NtcNO2LnpTqOBYfmiNNvGRKHl0zyG+TVgFccUOWLYM8wArjceKBCB7n7P4h0aFEyLZ+P6NapJe5ZItVCMaDOquxX0DBtJ39UTOG22QvtMsw+Hvivm4CVYbrj zsVvIaQyhPV6C7XQF0AjtgDSU6st5ube6geb3ucMM688OVLC6H3+Zy81D7p3UkebyR+kT74MqbxrDt/h0naYRpVVem+FEzvaqe7UBmf8GR/1eNu5xi8sfA7W gWtlj310c04I6ulsLLMJOhK9di1fq+X1sEVbog== 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 1db39a34..9f23330 100644 --- a/fs/cifs/smbdirect.c +++ b/fs/cifs/smbdirect.c @@ -1392,6 +1392,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 1585984422768672560@xxx Tue Dec 05 22:23:30 +0000 2017 X-GM-THRID: 1585306402641105437 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread