Received: by 10.223.164.202 with SMTP id h10csp101558wrb; Wed, 22 Nov 2017 16:42:55 -0800 (PST) X-Google-Smtp-Source: AGs4zMYQLn/cUgGxLMAMXIXACqWEajefq8ipzIJHbvWfw9rmzpnl3M43j4WoeJh7ANSlqAElwW0Z X-Received: by 10.98.215.19 with SMTP id b19mr20723935pfh.94.1511397775117; Wed, 22 Nov 2017 16:42:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511397775; cv=none; d=google.com; s=arc-20160816; b=OpE+arJZ9j8ma9dUOOOEpW0EhlafisrtASD/JYM9YaUd071iXxV8wfteWEVUPQpiIj 92wnceO0dBoYqRqkt98jxlFBYfzNP2SqkG/7Oc9RbWMzPW6w41lbWl6W9V4HLOejYM4R Qy2ljWYH6m3iqFCdfQ47RiZFGJjj23lZRFFP0ZF1HDn01weIJZDS/dlJdu82U8f9Vg12 aHw9OnVutI55jIUjk2B2pOBCPM2i5aLS7N+/HQ/aGTwxP3ZmeMzeIEO0gihlzb5atzpR /jYI0t2n0xjQBy+IjqHLBZrTPBNKHngO/7/zBDoiSpJ6I9+OuaHa3OgH0NL1wNIyf069 YSbA== 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=Xe51iqkn3gSgLPy8YYZIXWnZMUmvYnBO/b2RdBHzlxw=; b=aIx2TRcJZNPeRUfE92msYVRN+yVOVKO9NF41Bq0Kmi1fe9bnva2dT5zh0uzUqaIV3O sO+/oaCBkR4uZRcgiHpZIwugskH2E22tMDUW6F9m4DG6gM5qU/9QEfj5sp0tZA73C69p n2Vp4iN6nM2SPfNsmxEoC7qjpRPKlscF/SfbrFAlFz8m+Ma8bQq2f7PwpBVkbPIab4A1 mg2Gl417ceHrimmAED+U5pGSQUgfJ/qt/m4chFHD/SZ1ptN1fMgSnmPzO1lkulB+3cDN khkPfk64OBN/fw3fckn4EeI9/2Fa1YfJipInpfowGAYO5zmlZE6RWoBz2eJTT/7JaKca LnoA== 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 l14si2028823pgn.57.2017.11.22.16.42.44; Wed, 22 Nov 2017 16:42:55 -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 S1752892AbdKWAkW (ORCPT + 76 others); Wed, 22 Nov 2017 19:40:22 -0500 Received: from a2nlsmtp01-05.prod.iad2.secureserver.net ([198.71.225.49]:37644 "EHLO a2nlsmtp01-05.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752836AbdKWAkR (ORCPT ); Wed, 22 Nov 2017 19:40:17 -0500 Received: from linuxonhyperv.com ([107.180.71.197]) by : HOSTING RELAY : with SMTP id HfXbe5G79ZHUgHfXbe8HOX; Wed, 22 Nov 2017 17:39:15 -0700 x-originating-ip: 107.180.71.197 Received: from longli by linuxonhyperv.com with local (Exim 4.89) (envelope-from ) id 1eHfXb-0004Sk-2r; Wed, 22 Nov 2017 17:38:55 -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 v8 02/16] CIFS: SMBD: Implement function to reconnect to a SMB Direct transport Date: Wed, 22 Nov 2017 17:38:35 -0700 Message-Id: <20171123003849.17093-3-longli@exchange.microsoft.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171123003849.17093-1-longli@exchange.microsoft.com> References: <20171123003849.17093-1-longli@exchange.microsoft.com> X-CMAE-Envelope: MS4wfPF3FfXcRss02iuIIPD/Cl2sMQH7uivAVwNt8xr4jYwJoc2Liv75ilshXnJANLjUwIlsigD2pjgc5siYRVer5h8qmQ7QM6+LIMmw1x9zIxt0IXoviDYN GWphHxcqAhtMyufICwVR36YA2yWVWBR6Xw72ZZfPzdhQ++LJTB6tabDvb/KgTC+2Pwdxsk0Eft5v1tUs+6+fWd0A6tqz5gZeuAxKibMZbmQaHfF3059zWJGj R4dJUY8eBMHsDLPwz4KKNhXSH+t9V3v73RIc1vwj0qRC6BQvt4B7ms4pfJBv4G5JC5lWEnPHPM6aBDo+pqUIBwdZcDeTelZFpBplJLASpahrXD9j5QBUYWER lBSHMVmERrDf/0245RHDZ/F/mZXRaSxS9WG5exuaoDdnssZ8A4zkhXcNLqKy8KIszMYAHpLkzYR0QV+Ko+iOvsmJsNZY1s4rRi67r8JBRpoTF88hFDSgb07v YpEXLbgp7wEUGT89G+MB/sEhYbIYQiAkpS7tCA== 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 ++++++++++++++++++++++++++++++++++++ fs/cifs/smbdirect.h | 4 ++++ 2 files changed, 40 insertions(+) diff --git a/fs/cifs/smbdirect.c b/fs/cifs/smbdirect.c index 862cdf9..a96058a 100644 --- a/fs/cifs/smbdirect.c +++ b/fs/cifs/smbdirect.c @@ -1387,6 +1387,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); diff --git a/fs/cifs/smbdirect.h b/fs/cifs/smbdirect.h index 25b3782..8948f06 100644 --- a/fs/cifs/smbdirect.h +++ b/fs/cifs/smbdirect.h @@ -247,11 +247,15 @@ struct smbd_response { struct smbd_connection *smbd_get_connection( struct TCP_Server_Info *server, struct sockaddr *dstaddr); +/* Reconnect SMBDirect session */ +int smbd_reconnect(struct TCP_Server_Info *server); + #else #define cifs_rdma_enabled(server) 0 struct smbd_connection {}; static inline void *smbd_get_connection( struct TCP_Server_Info *server, struct sockaddr *dstaddr) {return NULL;} +static inline int smbd_reconnect(struct TCP_Server_Info *server) {return -1;} #endif #endif -- 2.7.4 From 1584808775033030189@xxx Wed Nov 22 22:57:05 +0000 2017 X-GM-THRID: 1584808775033030189 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread